Hi!

asan.exp tests obviously require libsanitizer, but were only checking for
-fsanitize=address compiler support (plus looking for the libsanitizer
and if found, adding link options as needed).
This patch let's us skip all asan tests if the library isn't available.

Committed as obvious after testing on x86_64-linux with/without
libsanitizer.

2012-12-04  Jakub Jelinek  <ja...@redhat.com>

        PR testsuite/55587
        * lib/asan-dg.exp (asan_init): Return 1 if libasan has been found,
        0 if not.
        * g++.dg/asan/asan.exp: Don't run gcc-dg-runtest if [asan_init]
        returned 0.
        * gcc.dg/asan/asan.exp: Likewise.

--- gcc/testsuite/lib/asan-dg.exp.jj    2012-12-03 12:43:20.000000000 +0100
+++ gcc/testsuite/lib/asan-dg.exp       2012-12-04 12:41:46.184413648 +0100
@@ -91,6 +91,10 @@ proc asan_init { args } {
            set TEST_ALWAYS_FLAGS "$link_flags -fsanitize=address -g"
        }
     }
+    if { $link_flags != "" } {
+       return 1
+    }
+    return 0
 }
 
 #
--- gcc/testsuite/g++.dg/asan/asan.exp.jj       2012-11-14 23:57:07.000000000 
+0100
+++ gcc/testsuite/g++.dg/asan/asan.exp  2012-12-04 12:39:01.086372375 +0100
@@ -26,11 +26,13 @@ if ![check_effective_target_faddress_san
 
 # Initialize `dg'.
 dg-init
-asan_init
+if [asan_init] {
 
 # Main loop.
 gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.C 
$srcdir/c-c++-common/asan/*.c]] ""
 
+}
+
 # All done.
 asan_finish
 dg-finish
--- gcc/testsuite/gcc.dg/asan/asan.exp.jj       2012-11-14 23:57:07.000000000 
+0100
+++ gcc/testsuite/gcc.dg/asan/asan.exp  2012-12-04 12:38:20.000000000 +0100
@@ -28,11 +28,13 @@ if ![check_effective_target_faddress_san
 
 # Initialize `dg'.
 dg-init
-asan_init
+if [asan_init] {
 
 # Main loop.
 gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c 
$srcdir/c-c++-common/asan/*.c]] ""
 
+}
+
 # All done.
 asan_finish
 dg-finish

        Jakub

Reply via email to