* 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 9bb1a70..578e73b 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 25f1de4..39451b9 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 {} {