diff options
author | Dan Liew <dan@su-root.co.uk> | 2019-04-08 22:28:27 +0000 |
---|---|---|
committer | Dan Liew <dan@su-root.co.uk> | 2019-04-08 22:28:27 +0000 |
commit | 6501387ab1311ccf724bb5c5de499465110442b1 (patch) | |
tree | 8a8c02612b279b07506d00734c6541751ed4e017 /test/asan/TestCases/Posix | |
parent | 01960879dd36d0ab5a4bb3f8823bacbc9dfc69ca (diff) | |
download | compiler-rt-6501387ab1311ccf724bb5c5de499465110442b1.tar.gz |
[asan_symbolize] Use proper logging infrastructure.
Summary:
The previous logging infrastructure had several problems:
* Debugging output was emitted to standard output which is also where
the symbolized output would go. Interleaving these two separate
bits of information makes inspecting the output difficult and could
potentially break tests.
* Enabling debugging output requires modifying the script which is
not very conveninent.
* When debugging it isn't immediately obvious where the output is
coming from.
This patch uses the Python standard library logging infrastructure
which fixes all of the above problems. Logging is controlled using
two new options.
* `--log-level` - Sets the logging level, default is
`info`.
* `--log-dest` - Set the logging destination, default
is standard error.
Some simple test cases for the feature are included.
rdar://problem/49476995
Reviewers: kubamracek, yln, samsonov, dvyukov, vitalybuka
Subscribers: #sanitizers, llvm-commits
Tags: #llvm, #sanitizers
Differential Revision: https://reviews.llvm.org/D60343
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@357951 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/asan/TestCases/Posix')
3 files changed, 16 insertions, 0 deletions
diff --git a/test/asan/TestCases/Posix/asan_symbolize_script/logging_options_in_help.cc b/test/asan/TestCases/Posix/asan_symbolize_script/logging_options_in_help.cc new file mode 100644 index 000000000..b3df1cb35 --- /dev/null +++ b/test/asan/TestCases/Posix/asan_symbolize_script/logging_options_in_help.cc @@ -0,0 +1,5 @@ +// RUN: %asan_symbolize --help > %t_help_output.txt +// RUN: FileCheck %s -input-file=%t_help_output.txt +// CHECK: optional arguments: +// CHECK: --log-dest +// CHECK: --log-level diff --git a/test/asan/TestCases/Posix/asan_symbolize_script/set_log_dest.cc b/test/asan/TestCases/Posix/asan_symbolize_script/set_log_dest.cc new file mode 100644 index 000000000..f2c309808 --- /dev/null +++ b/test/asan/TestCases/Posix/asan_symbolize_script/set_log_dest.cc @@ -0,0 +1,3 @@ +// RUN: %asan_symbolize --log-level debug --log-dest %t_debug_log_output.txt --help +// RUN: FileCheck %s -input-file=%t_debug_log_output.txt -check-prefix=DEBUG-CHECK +// DEBUG-CHECK: DEBUG: [setup_logging() asan_symbolize.py:{{[0-9]+}}] Logging level set to "debug" diff --git a/test/asan/TestCases/Posix/asan_symbolize_script/set_log_level.cc b/test/asan/TestCases/Posix/asan_symbolize_script/set_log_level.cc new file mode 100644 index 000000000..b30fd6ec3 --- /dev/null +++ b/test/asan/TestCases/Posix/asan_symbolize_script/set_log_level.cc @@ -0,0 +1,8 @@ +// RUN: %asan_symbolize --log-level debug --help 2> %t_debug_log_output.txt +// RUN: FileCheck %s -input-file=%t_debug_log_output.txt -check-prefix=DEBUG-CHECK +// DEBUG-CHECK: DEBUG: [setup_logging() asan_symbolize.py:{{[0-9]+}}] Logging level set to "debug" +// +// FileCheck doesn't like empty files so add stdout too. +// RUN: %asan_symbolize --log-level info --help > %t_info_log_output.txt 2>&1 +// RUN: FileCheck %s -input-file=%t_info_log_output.txt -check-prefix=INFO-CHECK +// INFO-CHECK-NOT: DEBUG: [setup_logging() asan_symbolize.py:{{[0-9]+}}] |