[compiler-rt] r226438 - [sanitizer] Move options-related tests to sanitizer_common.

Evgeniy Stepanov eugeni.stepanov at gmail.com
Mon Jan 19 01:21:44 PST 2015


Author: eugenis
Date: Mon Jan 19 03:21:44 2015
New Revision: 226438

URL: http://llvm.org/viewvc/llvm-project?rev=226438&view=rev
Log:
[sanitizer] Move options-related tests to sanitizer_common.

And handle help=1 in standalone LSan.

Added:
    compiler-rt/trunk/test/asan/TestCases/asan_options-help.cc   (with props)
    compiler-rt/trunk/test/sanitizer_common/TestCases/options-help.cc
      - copied, changed from r226434, compiler-rt/trunk/test/asan/TestCases/asan_options-help.cc
    compiler-rt/trunk/test/sanitizer_common/TestCases/options-include.cc
      - copied, changed from r226434, compiler-rt/trunk/test/asan/TestCases/asan_options-include.cc
    compiler-rt/trunk/test/sanitizer_common/TestCases/options-invalid.cc
      - copied, changed from r226434, compiler-rt/trunk/test/asan/TestCases/asan_options-invalid.cc
Removed:
    compiler-rt/trunk/test/asan/TestCases/asan_options-include.cc
    compiler-rt/trunk/test/asan/TestCases/asan_options-invalid.cc
Modified:
    compiler-rt/trunk/lib/lsan/lsan_common.cc

Modified: compiler-rt/trunk/lib/lsan/lsan_common.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lsan_common.cc?rev=226438&r1=226437&r2=226438&view=diff
==============================================================================
--- compiler-rt/trunk/lib/lsan/lsan_common.cc (original)
+++ compiler-rt/trunk/lib/lsan/lsan_common.cc Mon Jan 19 03:21:44 2015
@@ -70,8 +70,13 @@ static void InitializeFlags(bool standal
     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(...)                           \

Added: compiler-rt/trunk/test/asan/TestCases/asan_options-help.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/asan_options-help.cc?rev=226438&view=auto
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/asan_options-help.cc (added)
+++ compiler-rt/trunk/test/asan/TestCases/asan_options-help.cc Mon Jan 19 03:21:44 2015
@@ -0,0 +1,9 @@
+// RUN: %clangxx_asan -O0 %s -o %t
+// RUN: ASAN_OPTIONS=help=1 %run %t 2>&1 | FileCheck %s
+
+int main() {
+}
+
+// CHECK: Available flags for AddressSanitizer:
+// CHECK-DAG: handle_segv
+// CHECK-DAG: check_initialization_order

Propchange: compiler-rt/trunk/test/asan/TestCases/asan_options-help.cc
------------------------------------------------------------------------------
    svn:eol-style = LF

Removed: compiler-rt/trunk/test/asan/TestCases/asan_options-include.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/asan_options-include.cc?rev=226437&view=auto
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/asan_options-include.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/asan_options-include.cc (removed)
@@ -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

Removed: compiler-rt/trunk/test/asan/TestCases/asan_options-invalid.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/asan_options-invalid.cc?rev=226437&view=auto
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/asan_options-invalid.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/asan_options-invalid.cc (removed)
@@ -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

Copied: compiler-rt/trunk/test/sanitizer_common/TestCases/options-help.cc (from r226434, compiler-rt/trunk/test/asan/TestCases/asan_options-help.cc)
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/sanitizer_common/TestCases/options-help.cc?p2=compiler-rt/trunk/test/sanitizer_common/TestCases/options-help.cc&p1=compiler-rt/trunk/test/asan/TestCases/asan_options-help.cc&r1=226434&r2=226438&rev=226438&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/asan_options-help.cc (original)
+++ compiler-rt/trunk/test/sanitizer_common/TestCases/options-help.cc Mon Jan 19 03:21:44 2015
@@ -1,9 +1,8 @@
-// RUN: %clangxx_asan -O0 %s -o %t
-// RUN: ASAN_OPTIONS=help=1 %run %t 2>&1 | FileCheck %s
+// RUN: %clangxx -O0 %s -o %t
+// RUN: %tool_options=help=1 %run %t 2>&1 | FileCheck %s
 
 int main() {
 }
 
-// CHECK: Available flags for AddressSanitizer:
-// CHECK-DAG: handle_segv
-// CHECK-DAG: check_initialization_order
+// CHECK: Available flags for {{.*}}Sanitizer:
+// CHECK: handle_segv

Copied: compiler-rt/trunk/test/sanitizer_common/TestCases/options-include.cc (from r226434, compiler-rt/trunk/test/asan/TestCases/asan_options-include.cc)
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/sanitizer_common/TestCases/options-include.cc?p2=compiler-rt/trunk/test/sanitizer_common/TestCases/options-include.cc&p1=compiler-rt/trunk/test/asan/TestCases/asan_options-include.cc&r1=226434&r2=226438&rev=226438&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/asan_options-include.cc (original)
+++ compiler-rt/trunk/test/sanitizer_common/TestCases/options-include.cc Mon Jan 19 03:21:44 2015
@@ -1,13 +1,13 @@
-// RUN: %clangxx_asan -O0 %s -o %t
+// RUN: %clangxx -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: echo -e "help=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: %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: ASAN_OPTIONS="include='%t.options1.txt',verbosity=0" %run %t 2>&1 | tee %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: ASAN_OPTIONS="include='%t.options-not-found.txt',verbosity=0" not %run %t 2>&1 | tee %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>
@@ -16,6 +16,6 @@ int main() {
   fprintf(stderr, "done\n");
 }
 
-// CHECK-VERBOSITY1: Parsed ASAN_OPTIONS:
-// CHECK-VERBOSITY0-NOT: Parsed ASAN_OPTIONS:
+// CHECK-VERBOSITY1: Available flags for
+// CHECK-VERBOSITY0-NOT: Available flags for
 // CHECK-NOT-FOUND: Failed to read options from

Copied: compiler-rt/trunk/test/sanitizer_common/TestCases/options-invalid.cc (from r226434, compiler-rt/trunk/test/asan/TestCases/asan_options-invalid.cc)
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/sanitizer_common/TestCases/options-invalid.cc?p2=compiler-rt/trunk/test/sanitizer_common/TestCases/options-invalid.cc&p1=compiler-rt/trunk/test/asan/TestCases/asan_options-invalid.cc&r1=226434&r2=226438&rev=226438&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/asan_options-invalid.cc (original)
+++ compiler-rt/trunk/test/sanitizer_common/TestCases/options-invalid.cc Mon Jan 19 03:21:44 2015
@@ -1,5 +1,5 @@
-// RUN: %clangxx_asan -O0 %s -o %t
-// RUN: ASAN_OPTIONS=invalid_option_name=10 not %run %t 2>&1 | FileCheck %s
+// RUN: %clangxx -O0 %s -o %t
+// RUN: %tool_options=invalid_option_name=10 not %run %t 2>&1 | FileCheck %s
 
 int main() {
 }





More information about the llvm-commits mailing list