Skip to content

Commit 0d1f417

Browse files
mcgrofgregkh
authored andcommitted
test_firmware: add test case for SIGCHLD on sync fallback
It has been reported that SIGCHLD will trigger an immediate abort on sync firmware requests which rely on the sysfs interface for a trigger. This is unexpected behaviour, this reproduces this issue. This test case currenty fails. Reported-by: Martin Fuzzey <[email protected]> Signed-off-by: Luis R. Rodriguez <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 1f5000b commit 0d1f417

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

tools/testing/selftests/firmware/fw_fallback.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,27 @@ load_fw_custom_cancel()
134134
wait
135135
}
136136

137+
load_fw_fallback_with_child()
138+
{
139+
local name="$1"
140+
local file="$2"
141+
142+
# This is the value already set but we want to be explicit
143+
echo 4 >/sys/class/firmware/timeout
144+
145+
sleep 1 &
146+
SECONDS_BEFORE=$(date +%s)
147+
echo -n "$name" >"$DIR"/trigger_request 2>/dev/null
148+
SECONDS_AFTER=$(date +%s)
149+
SECONDS_DELTA=$(($SECONDS_AFTER - $SECONDS_BEFORE))
150+
if [ "$SECONDS_DELTA" -lt 4 ]; then
151+
RET=1
152+
else
153+
RET=0
154+
fi
155+
wait
156+
return $RET
157+
}
137158

138159
trap "test_finish" EXIT
139160

@@ -221,4 +242,14 @@ else
221242
echo "$0: cancelling custom fallback mechanism works"
222243
fi
223244

245+
set +e
246+
load_fw_fallback_with_child "nope-signal-$NAME" "$FW"
247+
if [ "$?" -eq 0 ]; then
248+
echo "$0: SIGCHLD on sync ignored as expected" >&2
249+
else
250+
echo "$0: error - sync firmware request cancelled due to SIGCHLD" >&2
251+
exit 1
252+
fi
253+
set -e
254+
224255
exit 0

0 commit comments

Comments
 (0)