[compiler-rt] [Fuzzer] Make signal tests work with internal shell (PR #203445)

via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 11 20:02:41 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-compiler-rt-sanitizer

Author: Aiden Grossman (boomanaiden154)

<details>
<summary>Changes</summary>

Wrap some commands in bash as it seemed like the least bad option. The alternative is to use setsid and run the other commands in the internal shell, but them it's impossible to use wait and we run into reliability issues because of that.

---
Full diff: https://github.com/llvm/llvm-project/pull/203445.diff


4 Files Affected:

- (modified) compiler-rt/test/fuzzer/fork-sigusr.test (+3-3) 
- (modified) compiler-rt/test/fuzzer/merge-sigusr.test (+4-4) 
- (modified) compiler-rt/test/fuzzer/sigint.test (+3-3) 
- (modified) compiler-rt/test/fuzzer/sigusr.test (+3-3) 


``````````diff
diff --git a/compiler-rt/test/fuzzer/fork-sigusr.test b/compiler-rt/test/fuzzer/fork-sigusr.test
index 4f796171fbd11..11514205510ad 100644
--- a/compiler-rt/test/fuzzer/fork-sigusr.test
+++ b/compiler-rt/test/fuzzer/fork-sigusr.test
@@ -5,9 +5,9 @@ RUN: rm -rf %t
 RUN: mkdir -p %t
 RUN: %cpp_compiler %S/SleepOneSecondTest.cpp -o %t/ForkSIGUSR
 
-RUN: %run %t/ForkSIGUSR -fork=3 -ignore_crashes=1 2>%t/log & export PID=$!
-RUN: sleep 3
-RUN: kill -SIGUSR2 $PID
+RUN: bash -c "%run %t/ForkSIGUSR -fork=3 -ignore_crashes=1 > /dev/null 2>%t/log & export PID=\$!; \
+RUN: sleep 3; \
+RUN: kill -SIGUSR2 \$PID"
 RUN: sleep 6
 RUN: cat %t/log | FileCheck %s --dump-input=fail
 
diff --git a/compiler-rt/test/fuzzer/merge-sigusr.test b/compiler-rt/test/fuzzer/merge-sigusr.test
index 762ae0d106d28..81e264c8777d9 100644
--- a/compiler-rt/test/fuzzer/merge-sigusr.test
+++ b/compiler-rt/test/fuzzer/merge-sigusr.test
@@ -24,10 +24,10 @@ RUN: echo n > %t/C2/g
 RUN: echo o > %t/C2/g
 
 # Run in new session so we can easily kill child processes all at once.
-RUN: setsid %run %t/LFSIGUSR -merge=1 -merge_control_file=%t/MCF %t/C1 %t/C2 2>%t/log & export PID=$!
-RUN: sleep 3
-RUN: kill -SIGUSR2 -$(ps -o sess= $PID | grep -o '[0-9]*')
-RUN: wait $PID || true
+RUN: bash -c "setsid %run %t/LFSIGUSR -merge=1 -merge_control_file=%t/MCF %t/C1 %t/C2 > /dev/null 2>%t/log & export PID=\$!; \
+RUN: sleep 3; \
+RUN: kill -SIGUSR2 -\$(ps -o sess= \$PID | grep -o '[0-9]*'); \
+RUN: wait \$PID || true"
 RUN: sleep 3
 RUN: cat %t/log | FileCheck %s --dump-input=fail
 RUN: grep C2/g %t/MCF
diff --git a/compiler-rt/test/fuzzer/sigint.test b/compiler-rt/test/fuzzer/sigint.test
index 0e239c3ce5385..48eacd83fea6a 100644
--- a/compiler-rt/test/fuzzer/sigint.test
+++ b/compiler-rt/test/fuzzer/sigint.test
@@ -6,9 +6,9 @@ RUN: rm -rf %t
 RUN: mkdir -p %t
 RUN: %msan_compiler %S/SleepOneSecondTest.cpp -o %t/LFSIGINT
 
-RUN: %run %t/LFSIGINT 2> %t/log & export PID=$!
-RUN: sleep 2
-RUN: kill -SIGINT $PID
+RUN: bash -c "%run %t/LFSIGINT > /dev/null 2> %t/log & export PID=\$!; \
+RUN: sleep 2; \
+RUN: kill -SIGINT \$PID"
 RUN: sleep 3
 RUN: cat %t/log | FileCheck %s
 
diff --git a/compiler-rt/test/fuzzer/sigusr.test b/compiler-rt/test/fuzzer/sigusr.test
index c3d7adf8ea99b..301ed0aa3a25c 100644
--- a/compiler-rt/test/fuzzer/sigusr.test
+++ b/compiler-rt/test/fuzzer/sigusr.test
@@ -6,9 +6,9 @@ RUN: rm -rf %t
 RUN: mkdir -p %t
 RUN: %cpp_compiler %S/SleepOneSecondTest.cpp -o %t/LFSIGUSR
 
-RUN: %run %t/LFSIGUSR 2> %t/log & export PID=$!
-RUN: sleep 2
-RUN: kill -SIGUSR1 $PID
+RUN: bash -c "%run %t/LFSIGUSR > /dev/null 2> %t/log & export PID=\$!; \
+RUN: sleep 2; \
+RUN: kill -SIGUSR1 \$PID"
 RUN: sleep 3
 RUN: cat %t/log | FileCheck %s
 

``````````

</details>


https://github.com/llvm/llvm-project/pull/203445


More information about the llvm-commits mailing list