On Wed, Apr 11, 2018 at 2:07 PM, Jakub Jelinek <ja...@redhat.com> wrote:
> On Wed, Apr 11, 2018 at 01:59:40PM -0400, Jason Merrill wrote:
>> And this one puts the check in asan_init rather than its users.  OK?
>
> tsan tests have the same problem.

Hmm, tsan tests work fine for me under ulimit -v.

> Wouldn't it be better to have a helper procedure for this and use it next to
> if [check_effective_target_fsanitize_address]

Ah, of course, that's where it belongs.  Done below.

> What exactly does return -code return?

It forces the caller to return as well.
commit f980f806f93982ba54390d45ac5ccc8b350b160c
Author: Jason Merrill <ja...@redhat.com>
Date:   Fri Mar 23 11:14:50 2018 -0400

            * lib/asan-dg.exp: Don't run tests if ulimit -v is set.

diff --git a/gcc/testsuite/lib/asan-dg.exp b/gcc/testsuite/lib/asan-dg.exp
index 25f1de45879..39451b98a60 100644
--- a/gcc/testsuite/lib/asan-dg.exp
+++ b/gcc/testsuite/lib/asan-dg.exp
@@ -18,9 +18,24 @@
 # 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 {} {

Reply via email to