Skip to content

Commit

Permalink
test_firmware: add test case for SIGCHLD on sync fallback
Browse files Browse the repository at this point in the history
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 <mfuzzey@parkeon.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
mcgrof authored and gregkh committed Aug 10, 2017
1 parent 1f5000b commit 0d1f417
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions tools/testing/selftests/firmware/fw_fallback.sh
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,27 @@ load_fw_custom_cancel()
wait
}

load_fw_fallback_with_child()
{
local name="$1"
local file="$2"

# This is the value already set but we want to be explicit
echo 4 >/sys/class/firmware/timeout

sleep 1 &
SECONDS_BEFORE=$(date +%s)
echo -n "$name" >"$DIR"/trigger_request 2>/dev/null
SECONDS_AFTER=$(date +%s)
SECONDS_DELTA=$(($SECONDS_AFTER - $SECONDS_BEFORE))
if [ "$SECONDS_DELTA" -lt 4 ]; then
RET=1
else
RET=0
fi
wait
return $RET
}

trap "test_finish" EXIT

Expand Down Expand Up @@ -221,4 +242,14 @@ else
echo "$0: cancelling custom fallback mechanism works"
fi

set +e
load_fw_fallback_with_child "nope-signal-$NAME" "$FW"
if [ "$?" -eq 0 ]; then
echo "$0: SIGCHLD on sync ignored as expected" >&2
else
echo "$0: error - sync firmware request cancelled due to SIGCHLD" >&2
exit 1
fi
set -e

exit 0

0 comments on commit 0d1f417

Please sign in to comment.