[sanitizer] Move options-related tests to sanitizer_common.

And handle help=1 in standalone LSan.

llvm-svn: 226438
This commit is contained in:
Evgeniy Stepanov 2015-01-19 09:21:44 +00:00
parent e5b1c0d98e
commit 141c5a9ae0
6 changed files with 41 additions and 28 deletions

View File

@ -70,8 +70,13 @@ static void InitializeFlags(bool standalone) {
OverrideCommonFlags(cf);
}
bool help_before = common_flags()->help;
const char *options = GetEnv("LSAN_OPTIONS");
parser.ParseString(options);
if (!help_before && common_flags()->help)
parser.PrintFlagDescriptions();
}
#define LOG_POINTERS(...) \

View File

@ -1,21 +0,0 @@
// RUN: %clangxx_asan -O0 %s -o %t
// RUN: echo -e "symbolize=1\ninclude='%t.options2.txt'" >%t.options1.txt
// RUN: echo -e "verbosity=1\n" >%t.options2.txt
// RUN: cat %t.options1.txt
// RUN: cat %t.options2.txt
// RUN: ASAN_OPTIONS="verbosity=0:include='%t.options1.txt'" %run %t 2>&1 | tee %t.out
// RUN: FileCheck %s --check-prefix=CHECK-VERBOSITY1 <%t.out
// RUN: ASAN_OPTIONS="include='%t.options1.txt',verbosity=0" %run %t 2>&1 | tee %t.out
// RUN: FileCheck %s --check-prefix=CHECK-VERBOSITY0 <%t.out
// RUN: ASAN_OPTIONS="include='%t.options-not-found.txt',verbosity=0" not %run %t 2>&1 | tee %t.out
// RUN: FileCheck %s --check-prefix=CHECK-NOT-FOUND < %t.out
#include <stdio.h>
int main() {
fprintf(stderr, "done\n");
}
// CHECK-VERBOSITY1: Parsed ASAN_OPTIONS:
// CHECK-VERBOSITY0-NOT: Parsed ASAN_OPTIONS:
// CHECK-NOT-FOUND: Failed to read options from

View File

@ -1,7 +0,0 @@
// RUN: %clangxx_asan -O0 %s -o %t
// RUN: ASAN_OPTIONS=invalid_option_name=10 not %run %t 2>&1 | FileCheck %s
int main() {
}
// CHECK: Unknown flag{{.*}}invalid_option_name

View File

@ -0,0 +1,8 @@
// RUN: %clangxx -O0 %s -o %t
// RUN: %tool_options=help=1 %run %t 2>&1 | FileCheck %s
int main() {
}
// CHECK: Available flags for {{.*}}Sanitizer:
// CHECK: handle_segv

View File

@ -0,0 +1,21 @@
// RUN: %clangxx -O0 %s -o %t
// RUN: echo -e "symbolize=1\ninclude='%t.options2.txt'" >%t.options1.txt
// RUN: echo -e "help=1\n" >%t.options2.txt
// RUN: cat %t.options1.txt
// RUN: cat %t.options2.txt
// RUN: %tool_options="help=0:include='%t.options1.txt'" %run %t 2>&1 | tee %t.out
// RUN: FileCheck %s --check-prefix=CHECK-VERBOSITY1 <%t.out
// RUN: %tool_options="include='%t.options1.txt',help=0" %run %t 2>&1 | tee %t.out
// RUN: FileCheck %s --check-prefix=CHECK-VERBOSITY0 <%t.out
// RUN: %tool_options="include='%t.options-not-found.txt',help=1" not %run %t 2>&1 | tee %t.out
// RUN: FileCheck %s --check-prefix=CHECK-NOT-FOUND < %t.out
#include <stdio.h>
int main() {
fprintf(stderr, "done\n");
}
// CHECK-VERBOSITY1: Available flags for
// CHECK-VERBOSITY0-NOT: Available flags for
// CHECK-NOT-FOUND: Failed to read options from

View File

@ -0,0 +1,7 @@
// RUN: %clangxx -O0 %s -o %t
// RUN: %tool_options=invalid_option_name=10 not %run %t 2>&1 | FileCheck %s
int main() {
}
// CHECK: Unknown flag{{.*}}invalid_option_name