[compiler-rt] 2d37e48 - [compiler-rt][test] Add REQUIRES: shell in tests that use the `ulimit` command (#105339)

via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 26 12:02:19 PDT 2024


Author: Harini0924
Date: 2024-08-26T12:02:16-07:00
New Revision: 2d37e48e2439f70ed394bcca5c065ca2c8f5ae94

URL: https://github.com/llvm/llvm-project/commit/2d37e48e2439f70ed394bcca5c065ca2c8f5ae94
DIFF: https://github.com/llvm/llvm-project/commit/2d37e48e2439f70ed394bcca5c065ca2c8f5ae94.diff

LOG: [compiler-rt][test] Add REQUIRES: shell in tests that use the `ulimit` command (#105339)

This patch adds the `REQUIRES: shell` directive to six test files that
use the `ulimit` command, ensuring these tests are only run in
environments where a full POSIX-compliant shell is available. The lit
internal shell does not use or support the `ulimit` command, which
causes failures when running tests with `LIT_USE_INTERNAL_SHELL=1 ninja
check-compiler-rt`
Specifically, one of the errors encountered is: 
```
# RUN: at line 4
ulimit -s 1000
# executed command: ulimit -s 1000
# .---command stderr------------
# | 'ulimit': command not found
# `-----------------------------
# error: command failed with exit status: 127
```
Since, the lit internal shell doesn't support `ulimit`, adding this
requirement prevents these tests from failing in the lit internal shell,
thereby improving the reliability of the test suite in environments
where the full shell is not available.

This change is relevant for [[RFC] Enabling the Lit Internal Shell by
Default](https://discourse.llvm.org/t/rfc-enabling-the-lit-internal-shell-by-default/80179/3)
fixes:  #102398

Added: 
    

Modified: 
    compiler-rt/test/asan/TestCases/Linux/allocator_oom_test.cpp
    compiler-rt/test/asan/TestCases/Posix/deep_call_stack.cpp
    compiler-rt/test/fuzzer/merge-posix.test
    compiler-rt/test/fuzzer/ulimit.test
    compiler-rt/test/hwasan/TestCases/print-memory-usage.c
    compiler-rt/test/msan/Linux/reexec_unlimited_stack.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/test/asan/TestCases/Linux/allocator_oom_test.cpp b/compiler-rt/test/asan/TestCases/Linux/allocator_oom_test.cpp
index b096624a7f95b9..f60a6a4ef79e6d 100644
--- a/compiler-rt/test/asan/TestCases/Linux/allocator_oom_test.cpp
+++ b/compiler-rt/test/asan/TestCases/Linux/allocator_oom_test.cpp
@@ -31,7 +31,7 @@
 // ASan shadow memory on s390 is too large for this test.
 // AArch64 bots fail on this test.
 // TODO(alekseys): Android lit do not run ulimit on device.
-// REQUIRES: shadow-scale-3
+// REQUIRES: shell, shadow-scale-3
 // UNSUPPORTED: android, target={{(s390|aarch64|powerpc64le).*}}
 
 #include <stdlib.h>

diff  --git a/compiler-rt/test/asan/TestCases/Posix/deep_call_stack.cpp b/compiler-rt/test/asan/TestCases/Posix/deep_call_stack.cpp
index e6e82a47572056..37aa7b11a231ad 100644
--- a/compiler-rt/test/asan/TestCases/Posix/deep_call_stack.cpp
+++ b/compiler-rt/test/asan/TestCases/Posix/deep_call_stack.cpp
@@ -1,4 +1,5 @@
 // Check that UAR mode can handle very deep recusrion.
+// REQUIRES: shell
 // RUN: %clangxx_asan -O2 %s -o %t
 // RUN: ulimit -s 4096
 // RUN: %env_asan_opts=detect_stack_use_after_return=1 %run %t 2>&1 | FileCheck %s

diff  --git a/compiler-rt/test/fuzzer/merge-posix.test b/compiler-rt/test/fuzzer/merge-posix.test
index 9fece647ca60b9..2721668fb97064 100644
--- a/compiler-rt/test/fuzzer/merge-posix.test
+++ b/compiler-rt/test/fuzzer/merge-posix.test
@@ -1,5 +1,5 @@
+REQUIRES: shell
 XFAIL: ios
-UNSUPPORTED: target={{.*windows.*}}
 RUN: %cpp_compiler %S/FullCoverageSetTest.cpp -o %t-FullCoverageSetTest
 
 RUN: rm -rf  %tmp/T1 %tmp/T2

diff  --git a/compiler-rt/test/fuzzer/ulimit.test b/compiler-rt/test/fuzzer/ulimit.test
index 223f2ac9bb6e2e..e330a97cc07c57 100644
--- a/compiler-rt/test/fuzzer/ulimit.test
+++ b/compiler-rt/test/fuzzer/ulimit.test
@@ -1,5 +1,4 @@
-# FIXME: Disabled on Windows for now because Windows has no ulimit command.
-UNSUPPORTED: target={{.*windows.*}}
+REQUIRES: shell
 RUN: %cpp_compiler %S/SimpleTest.cpp -o %t-SimpleTest
 RUN: ulimit -s 1000
 RUN: not %run %t-SimpleTest

diff  --git a/compiler-rt/test/hwasan/TestCases/print-memory-usage.c b/compiler-rt/test/hwasan/TestCases/print-memory-usage.c
index 2c89d4e70ebc74..13652fbd921b0a 100644
--- a/compiler-rt/test/hwasan/TestCases/print-memory-usage.c
+++ b/compiler-rt/test/hwasan/TestCases/print-memory-usage.c
@@ -1,4 +1,5 @@
 // Tests __hwasan_print_memory_usage.
+// REQUIRES: shell
 // RUN: %clang_hwasan %s -o %t
 // RUN: ulimit -s 1000
 // RUN: %run %t 2>&1 | FileCheck %s

diff  --git a/compiler-rt/test/msan/Linux/reexec_unlimited_stack.cpp b/compiler-rt/test/msan/Linux/reexec_unlimited_stack.cpp
index 61492ec34533fe..8dee27047470ea 100644
--- a/compiler-rt/test/msan/Linux/reexec_unlimited_stack.cpp
+++ b/compiler-rt/test/msan/Linux/reexec_unlimited_stack.cpp
@@ -1,5 +1,6 @@
 // MSAN re-execs on unlimited stacks. We use that to verify ReExec() uses the
 // right path.
+// REQUIRES: shell
 // RUN: %clangxx_msan -O0 %s -o %t && ulimit -s unlimited && %run %t | FileCheck %s
 
 #include <stdio.h>


        


More information about the llvm-commits mailing list