Skip to content

Commit 550f87b

Browse files
committed
testsuite: test signal propagation
Problem: There is no test in the testsuite that verifies that the broker propagates nonfatal signals to jobs. Add a test as issues/t5105-signal-propagation.sh that ensures a nested instance propagates SIGUSR1 down to a leaf child job.
1 parent aecfd32 commit 550f87b

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

t/Makefile.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,7 @@ dist_check_SCRIPTS = \
344344
issues/t4711-job-list-purge-inactive.sh \
345345
issues/t4771-flux-start-bash.sh \
346346
issues/t4852-t_submit-legacy.sh \
347+
issues/t5105-signal-propagation.sh \
347348
python/__init__.py \
348349
python/subflux.py \
349350
python/tap \
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/bin/sh
2+
# Run an 3 level nested instance, with a test job at the final level
3+
4+
waitfile=$SHARNESS_TEST_SRCDIR/scripts/waitfile.lua
5+
6+
cat <<EOF >test.py
7+
import signal
8+
import time
9+
import flux
10+
import os
11+
12+
h = flux.Flux()
13+
level = h.attr_get("instance-level")
14+
jobid = os.getenv("FLUX_JOB_ID")
15+
signal.signal(
16+
signal.SIGUSR1,
17+
lambda x, y: print(f"job {jobid} in level {level} got SIGUSR1", flush=True),
18+
)
19+
open("ready", 'a').close()
20+
signal.pause()
21+
EOF
22+
23+
id=$(flux submit --output=log flux start \
24+
flux run flux start \
25+
flux run flux python ./test.py)
26+
27+
$waitfile -t 30 -v ready
28+
29+
flux job kill -s SIGUSR1 $id
30+
31+
$waitfile -t 30 -v -p "got SIGUSR1" log
32+
33+
flux job status --json -v $id
34+
35+
# vi: ts=4 sw=4 expandtab
36+

0 commit comments

Comments
 (0)