[compiler-rt] [Fuzzer] Make signal tests work with internal shell (PR #203445)
Aiden Grossman via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 11 20:02:03 PDT 2026
https://github.com/boomanaiden154 created https://github.com/llvm/llvm-project/pull/203445
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.
>From 12f47987d2b561d91833cace89e18c5a881a0ed0 Mon Sep 17 00:00:00 2001
From: Aiden Grossman <aidengrossman at google.com>
Date: Fri, 12 Jun 2026 03:00:20 +0000
Subject: [PATCH] [Fuzzer] Make signal tests work with internal shell
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.
---
compiler-rt/test/fuzzer/fork-sigusr.test | 6 +++---
compiler-rt/test/fuzzer/merge-sigusr.test | 8 ++++----
compiler-rt/test/fuzzer/sigint.test | 6 +++---
compiler-rt/test/fuzzer/sigusr.test | 6 +++---
4 files changed, 13 insertions(+), 13 deletions(-)
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
More information about the llvm-commits
mailing list