* lib/asan-dg.exp: Don't run tests if ulimit -v is set.
authorJason Merrill <jason@redhat.com>
Wed, 11 Apr 2018 23:43:28 +0000 (19:43 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Wed, 11 Apr 2018 23:43:28 +0000 (19:43 -0400)
From-SVN: r259333

gcc/testsuite/ChangeLog
gcc/testsuite/lib/asan-dg.exp

index 9bb1a703a2bb7e72da558b55b8b59222eeb5ee49..578e73b15e8c46c3692aea306c3bacb49b92d94f 100644 (file)
@@ -1,3 +1,8 @@
+2018-04-11  Jason Merrill  <jason@redhat.com>
+
+       * lib/asan-dg.exp (check_effective_target_fsanitize_address): False
+       if ulimit -v is set.
+
 2018-04-11  Bin Cheng  <bin.cheng@arm.com>
 
        PR testsuite/85190
index 25f1de458798328fc3d0d9b7e6ada7489ce62f23..39451b98a60bf67c0356e1d2a0c9edbb1b858b88 100644 (file)
 # code, 0 otherwise.
 
 proc check_effective_target_fsanitize_address {} {
-    return [check_no_compiler_messages fsanitize_address executable {
+    if ![check_no_compiler_messages fsanitize_address executable {
        int main (void) { return 0; }
-    }]
+    }] {
+       return 0;
+    }
+
+    # asan doesn't work if there's a ulimit on virtual memory.
+    if ![is_remote target] {
+       if [catch {exec sh -c "ulimit -v"} ulimit_v] {
+           # failed to get ulimit
+       } elseif [regexp {^[0-9]+$} $ulimit_v] {
+           # ulimit -v gave a numeric limit
+           warning "skipping asan tests due to ulimit -v"
+           return 0;
+       }
+    }
+
+    return 1;
 }
 
 proc asan_include_flags {} {