On Tue, Apr 3, 2018 at 12:56 PM, Jason Merrill <ja...@redhat.com> wrote:
> On Mon, Mar 26, 2018 at 4:01 PM, Jason Merrill <ja...@redhat.com> wrote:
>>
>> On Mon, Mar 26, 2018 at 2:55 PM, Andreas Schwab <sch...@linux-m68k.org>
>> wrote:
>> > On Mär 26 2018, Jakub Jelinek <ja...@redhat.com> wrote:
>> >> On Mon, Mar 26, 2018 at 08:33:41PM +0200, Andreas Schwab wrote:
>> >>> On Mär 26 2018, Jason Merrill <ja...@redhat.com> wrote:
>> >>>
>> >>> >     if [catch {exec sh ulimit -v} ulimit_v] {
>> >>>
>> >>> expect1.1> exec sh ulimit -v
>> >>> sh: ulimit: No such file or directory
>> >>>     while executing
>> >>> "exec sh ulimit -v"
>> >>
>> >> Perhaps
>> >>       if [catch {exec sh -c ulimit -v} ulimit_v] {
>> >
>> > expect1.1> exec sh -c ulimit -v
>> > unlimited
>> > expect1.2> exec sh -c {ulimit -v}
>> > 4194304
>>
>> OK, so
>>
>> 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
>>         return
>>     }
>> }
>
>
> This version adds a warning.  OK for trunk?
commit 4ef44677627206e8ccc097a3dc3c411f6c4baece
Author: Jason Merrill <ja...@redhat.com>
Date:   Fri Mar 23 11:14:50 2018 -0400

            * gcc.dg/asan/asan.exp: Don't run tests if ulimit -v is set.
    
            * g++.dg/asan/asan.exp: Likewise.

diff --git a/gcc/testsuite/g++.dg/asan/asan.exp b/gcc/testsuite/g++.dg/asan/asan.exp
index 4ee8dd98697..5663ac6b635 100644
--- a/gcc/testsuite/g++.dg/asan/asan.exp
+++ b/gcc/testsuite/g++.dg/asan/asan.exp
@@ -24,6 +24,17 @@ load_lib asan-dg.exp
 dg-init
 asan_init
 
+# 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
+    }
+}
+
 # Main loop.
 if [check_effective_target_fsanitize_address] {
   gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.C $srcdir/c-c++-common/asan/*.c]] "" ""
diff --git a/gcc/testsuite/gcc.dg/asan/asan.exp b/gcc/testsuite/gcc.dg/asan/asan.exp
index 7b669056a97..11135765911 100644
--- a/gcc/testsuite/gcc.dg/asan/asan.exp
+++ b/gcc/testsuite/gcc.dg/asan/asan.exp
@@ -26,6 +26,17 @@ load_lib asan-dg.exp
 dg-init
 asan_init
 
+# 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
+    }
+}
+
 # Main loop.
 if [check_effective_target_fsanitize_address] {
   gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c $srcdir/c-c++-common/asan/*.c]] "" ""

Reply via email to