diff --git a/compiler-rt/lib/memprof/memprof_flags.inc b/compiler-rt/lib/memprof/memprof_flags.inc --- a/compiler-rt/lib/memprof/memprof_flags.inc +++ b/compiler-rt/lib/memprof/memprof_flags.inc @@ -35,7 +35,7 @@ "realloc(p, 0) is equivalent to free(p) by default (Same as the " "POSIX standard). If set to false, realloc(p, 0) will return a " "pointer to an allocated space which can not be used.") -MEMPROF_FLAG(bool, print_text, true, +MEMPROF_FLAG(bool, print_text, false, "If set, prints the heap profile in text format. Else use the raw binary serialization format.") MEMPROF_FLAG(bool, print_terse, false, "If set, prints memory profile in a terse format. Only applicable if print_text = true.") diff --git a/compiler-rt/test/memprof/TestCases/atexit_stats.cpp b/compiler-rt/test/memprof/TestCases/atexit_stats.cpp --- a/compiler-rt/test/memprof/TestCases/atexit_stats.cpp +++ b/compiler-rt/test/memprof/TestCases/atexit_stats.cpp @@ -1,8 +1,8 @@ // Check atexit option. // RUN: %clangxx_memprof -O0 %s -o %t -// RUN: %env_memprof_opts=log_path=stderr:atexit=1 %run %t 2>&1 | FileCheck %s -// RUN: %env_memprof_opts=log_path=stderr:atexit=0 %run %t 2>&1 | FileCheck %s --check-prefix=NOATEXIT +// RUN: %env_memprof_opts=print_text=true:log_path=stderr:atexit=1 %run %t 2>&1 | FileCheck %s +// RUN: %env_memprof_opts=print_text=true:log_path=stderr:atexit=0 %run %t 2>&1 | FileCheck %s --check-prefix=NOATEXIT // CHECK: MemProfiler exit stats: // CHECK: Stats: {{[0-9]+}}M malloced ({{[0-9]+}}M for overhead) by {{[0-9]+}} calls diff --git a/compiler-rt/test/memprof/TestCases/dump_process_map.cpp b/compiler-rt/test/memprof/TestCases/dump_process_map.cpp --- a/compiler-rt/test/memprof/TestCases/dump_process_map.cpp +++ b/compiler-rt/test/memprof/TestCases/dump_process_map.cpp @@ -1,8 +1,8 @@ // Check print_module_map option. // RUN: %clangxx_memprof -O0 %s -o %t -// RUN: %env_memprof_opts=log_path=stderr:print_module_map=1 %run %t 2>&1 | FileCheck %s -// RUN: %env_memprof_opts=log_path=stderr:print_module_map=0 %run %t 2>&1 | FileCheck %s --check-prefix=NOMAP +// RUN: %env_memprof_opts=print_text=true:log_path=stderr:print_module_map=1 %run %t 2>&1 | FileCheck %s +// RUN: %env_memprof_opts=print_text=true:log_path=stderr:print_module_map=0 %run %t 2>&1 | FileCheck %s --check-prefix=NOMAP // CHECK: Process memory map follows: // CHECK: dump_process_map.cpp.tmp diff --git a/compiler-rt/test/memprof/TestCases/log_path_test.cpp b/compiler-rt/test/memprof/TestCases/log_path_test.cpp --- a/compiler-rt/test/memprof/TestCases/log_path_test.cpp +++ b/compiler-rt/test/memprof/TestCases/log_path_test.cpp @@ -3,19 +3,19 @@ // // RUN: %clangxx_memprof %s -o %t -// stderr log_path -// RUN: %env_memprof_opts=log_path=stderr %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-GOOD --dump-input=always +// stderr print_text=true:log_path +// RUN: %env_memprof_opts=print_text=true:log_path=stderr %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-GOOD --dump-input=always -// Good log_path. +// Good print_text=true:log_path. // RUN: rm -f %t.log.* -// RUN: %env_memprof_opts=log_path=%t.log %run %t +// RUN: %env_memprof_opts=print_text=true:log_path=%t.log %run %t // RUN: FileCheck %s --check-prefix=CHECK-GOOD --dump-input=always < %t.log.* -// Invalid log_path. -// RUN: %env_memprof_opts=log_path=/dev/null/INVALID not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-INVALID --dump-input=always +// Invalid print_text=true:log_path. +// RUN: %env_memprof_opts=print_text=true:log_path=/dev/null/INVALID not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-INVALID --dump-input=always -// Too long log_path. -// RUN: %env_memprof_opts=log_path=`for((i=0;i<10000;i++)); do echo -n $i; done` \ +// Too long print_text=true:log_path. +// RUN: %env_memprof_opts=print_text=true:log_path=`for((i=0;i<10000;i++)); do echo -n $i; done` \ // RUN: not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-LONG --dump-input=always // Specifying the log name via the __memprof_profile_filename variable. diff --git a/compiler-rt/test/memprof/TestCases/malloc-size-too-big.cpp b/compiler-rt/test/memprof/TestCases/malloc-size-too-big.cpp --- a/compiler-rt/test/memprof/TestCases/malloc-size-too-big.cpp +++ b/compiler-rt/test/memprof/TestCases/malloc-size-too-big.cpp @@ -1,8 +1,8 @@ // RUN: %clangxx_memprof -O0 %s -o %t -// RUN: %env_memprof_opts=log_path=stderr:allocator_may_return_null=0 not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-SUMMARY -// RUN: %env_memprof_opts=log_path=stderr:allocator_may_return_null=1 %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-NULL +// RUN: %env_memprof_opts=print_text=true:log_path=stderr:allocator_may_return_null=0 not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-SUMMARY +// RUN: %env_memprof_opts=print_text=true:log_path=stderr:allocator_may_return_null=1 %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-NULL // Test print_summary -// RUN: %env_memprof_opts=log_path=stderr:allocator_may_return_null=0:print_summary=0 not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-NOSUMMARY +// RUN: %env_memprof_opts=print_text=true:log_path=stderr:allocator_may_return_null=0:print_summary=0 not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-NOSUMMARY #include #include diff --git a/compiler-rt/test/memprof/TestCases/memprof_merge_mib.cpp b/compiler-rt/test/memprof/TestCases/memprof_merge_mib.cpp --- a/compiler-rt/test/memprof/TestCases/memprof_merge_mib.cpp +++ b/compiler-rt/test/memprof/TestCases/memprof_merge_mib.cpp @@ -1,6 +1,6 @@ // RUN: %clangxx_memprof %s -o %t -// RUN: %env_memprof_opts=log_path=stdout %run %t | FileCheck %s +// RUN: %env_memprof_opts=print_text=true:log_path=stdout %run %t | FileCheck %s #include #include diff --git a/compiler-rt/test/memprof/TestCases/memprof_profile_dump.cpp b/compiler-rt/test/memprof/TestCases/memprof_profile_dump.cpp --- a/compiler-rt/test/memprof/TestCases/memprof_profile_dump.cpp +++ b/compiler-rt/test/memprof/TestCases/memprof_profile_dump.cpp @@ -1,7 +1,7 @@ // RUN: %clangxx_memprof %s -o %t -// RUN: %env_memprof_opts=log_path=stdout %run %t | FileCheck --check-prefix=CHECK-TEXT %s -// RUN: %env_memprof_opts=log_path=stdout,print_text=false %run %t > %t.memprofraw +// RUN: %env_memprof_opts=print_text=true:log_path=stdout %run %t | FileCheck --check-prefix=CHECK-TEXT %s +// RUN: %env_memprof_opts=print_text=true:log_path=stdout,print_text=false %run %t > %t.memprofraw // RUN: od -c -N 8 %t.memprofraw | FileCheck --check-prefix=CHECK-RAW %s #include diff --git a/compiler-rt/test/memprof/TestCases/stress_dtls.c b/compiler-rt/test/memprof/TestCases/stress_dtls.c --- a/compiler-rt/test/memprof/TestCases/stress_dtls.c +++ b/compiler-rt/test/memprof/TestCases/stress_dtls.c @@ -7,9 +7,9 @@ // RUN: %clang_memprof %s -ldl -pthread -o %t // RUN: %run %t 0 3 // RUN: %run %t 2 3 -// RUN: %env_memprof_opts=log_path=stderr:verbosity=2 %run %t 10 2 2>&1 | FileCheck %s -// RUN: %env_memprof_opts=log_path=stderr:verbosity=2:intercept_tls_get_addr=1 %run %t 10 2 2>&1 | FileCheck %s -// RUN: %env_memprof_opts=log_path=stderr:verbosity=2:intercept_tls_get_addr=0 %run %t 10 2 2>&1 | FileCheck %s --check-prefix=CHECK0 +// RUN: %env_memprof_opts=print_text=true:log_path=stderr:verbosity=2 %run %t 10 2 2>&1 | FileCheck %s +// RUN: %env_memprof_opts=print_text=true:log_path=stderr:verbosity=2:intercept_tls_get_addr=1 %run %t 10 2 2>&1 | FileCheck %s +// RUN: %env_memprof_opts=print_text=true:log_path=stderr:verbosity=2:intercept_tls_get_addr=0 %run %t 10 2 2>&1 | FileCheck %s --check-prefix=CHECK0 // CHECK: ==__tls_get_addr: // CHECK: Creating thread 0 // CHECK: ==__tls_get_addr: diff --git a/compiler-rt/test/memprof/TestCases/test_malloc_load_store.c b/compiler-rt/test/memprof/TestCases/test_malloc_load_store.c --- a/compiler-rt/test/memprof/TestCases/test_malloc_load_store.c +++ b/compiler-rt/test/memprof/TestCases/test_malloc_load_store.c @@ -3,10 +3,10 @@ // before exit. // RUN: %clang_memprof -O0 %s -o %t -// RUN: %env_memprof_opts=log_path=stderr %run %t 2>&1 | FileCheck %s +// RUN: %env_memprof_opts=print_text=true:log_path=stderr %run %t 2>&1 | FileCheck %s // RUN: %clang_memprof -DFREE -O0 %s -o %t -// RUN: %env_memprof_opts=log_path=stderr %run %t 2>&1 | FileCheck %s +// RUN: %env_memprof_opts=print_text=true:log_path=stderr %run %t 2>&1 | FileCheck %s // This is actually: // Memory allocation stack id = STACKID diff --git a/compiler-rt/test/memprof/TestCases/test_memintrin.cpp b/compiler-rt/test/memprof/TestCases/test_memintrin.cpp --- a/compiler-rt/test/memprof/TestCases/test_memintrin.cpp +++ b/compiler-rt/test/memprof/TestCases/test_memintrin.cpp @@ -1,6 +1,6 @@ // Check profile with calls to memory intrinsics. -// RUN: %clangxx_memprof -O0 %s -o %t && %env_memprof_opts=log_path=stderr %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_memprof -O0 %s -o %t && %env_memprof_opts=print_text=true:log_path=stderr %run %t 2>&1 | FileCheck %s // This is actually: // Memory allocation stack id = STACKIDP diff --git a/compiler-rt/test/memprof/TestCases/test_new_load_store.cpp b/compiler-rt/test/memprof/TestCases/test_new_load_store.cpp --- a/compiler-rt/test/memprof/TestCases/test_new_load_store.cpp +++ b/compiler-rt/test/memprof/TestCases/test_new_load_store.cpp @@ -3,14 +3,14 @@ // before exit. // RUN: %clangxx_memprof -O0 %s -o %t -// RUN: %env_memprof_opts=log_path=stderr %run %t 2>&1 | FileCheck %s +// RUN: %env_memprof_opts=print_text=true:log_path=stderr %run %t 2>&1 | FileCheck %s // RUN: %clangxx_memprof -DFREE -O0 %s -o %t -// RUN: %env_memprof_opts=log_path=stderr %run %t 2>&1 | FileCheck %s +// RUN: %env_memprof_opts=print_text=true:log_path=stderr %run %t 2>&1 | FileCheck %s // Try again with callbacks instead of inline sequences // RUN: %clangxx_memprof -mllvm -memprof-use-callbacks -O0 %s -o %t -// RUN: %env_memprof_opts=log_path=stderr %run %t 2>&1 | FileCheck %s +// RUN: %env_memprof_opts=print_text=true:log_path=stderr %run %t 2>&1 | FileCheck %s // This is actually: // Memory allocation stack id = STACKID diff --git a/compiler-rt/test/memprof/TestCases/test_terse.cpp b/compiler-rt/test/memprof/TestCases/test_terse.cpp --- a/compiler-rt/test/memprof/TestCases/test_terse.cpp +++ b/compiler-rt/test/memprof/TestCases/test_terse.cpp @@ -3,10 +3,10 @@ // deallocated before exit. // RUN: %clangxx_memprof -O0 %s -o %t -// RUN: %env_memprof_opts=log_path=stderr:print_terse=1 %run %t 2>&1 | FileCheck %s +// RUN: %env_memprof_opts=print_text=true:log_path=stderr:print_terse=1 %run %t 2>&1 | FileCheck %s // RUN: %clangxx_memprof -DFREE -O0 %s -o %t -// RUN: %env_memprof_opts=log_path=stderr:print_terse=1 %run %t 2>&1 | FileCheck %s +// RUN: %env_memprof_opts=print_text=true:log_path=stderr:print_terse=1 %run %t 2>&1 | FileCheck %s // CHECK: MIB:[[STACKID:[0-9]+]]/1/40.00/40/40/20.00/20/20/[[AVELIFETIME:[0-9]+]].00/[[AVELIFETIME]]/[[AVELIFETIME]]/{{[01]}}/0/0/0 // CHECK: Stack for id [[STACKID]]: diff --git a/compiler-rt/test/memprof/TestCases/unaligned_loads_and_stores.cpp b/compiler-rt/test/memprof/TestCases/unaligned_loads_and_stores.cpp --- a/compiler-rt/test/memprof/TestCases/unaligned_loads_and_stores.cpp +++ b/compiler-rt/test/memprof/TestCases/unaligned_loads_and_stores.cpp @@ -1,4 +1,4 @@ -// RUN: %clangxx_memprof -O0 %s -o %t && %env_memprof_opts=log_path=stderr %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_memprof -O0 %s -o %t && %env_memprof_opts=print_text=true:log_path=stderr %run %t 2>&1 | FileCheck %s // This is actually: // Memory allocation stack id = STACKID diff --git a/compiler-rt/test/memprof/lit.cfg.py b/compiler-rt/test/memprof/lit.cfg.py --- a/compiler-rt/test/memprof/lit.cfg.py +++ b/compiler-rt/test/memprof/lit.cfg.py @@ -30,7 +30,9 @@ # Platform-specific default MEMPROF_OPTIONS for lit tests. default_memprof_opts = list(config.default_sanitizer_opts) -default_memprof_opts_str = ':'.join(default_memprof_opts) +# We need a trailing ':' since the substitution from the test is appended to +# this string. +default_memprof_opts_str = ':'.join(default_memprof_opts) + ':' if default_memprof_opts_str: config.environment['MEMPROF_OPTIONS'] = default_memprof_opts_str config.substitutions.append(('%env_memprof_opts=',