Skip to content

Commit

Permalink
test_firmware: wrap custom sysfs load tests into helper
Browse files Browse the repository at this point in the history
These can run on certain kernel configs. This will allow
us later to enable these tests under the right kernel
configurations.

Signed-off-by: Luis R. Rodriguez <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
mcgrof authored and gregkh committed Nov 29, 2017
1 parent 59106c8 commit 82bdf49
Showing 1 changed file with 28 additions and 15 deletions.
43 changes: 28 additions & 15 deletions tools/testing/selftests/firmware/fw_fallback.sh
Original file line number Diff line number Diff line change
Expand Up @@ -256,24 +256,37 @@ run_sysfs_main_tests()
set -e
}

run_sysfs_main_tests
run_sysfs_custom_load_tests()
{
if load_fw_custom "$NAME" "$FW" ; then
if ! diff -q "$FW" /dev/test_firmware >/dev/null ; then
echo "$0: firmware was not loaded" >&2
exit 1
else
echo "$0: custom fallback loading mechanism works"
fi
fi

if load_fw_custom "$NAME" "$FW" ; then
if ! diff -q "$FW" /dev/test_firmware >/dev/null ; then
echo "$0: firmware was not loaded" >&2
exit 1
else
echo "$0: custom fallback loading mechanism works"
if load_fw_custom "$NAME" "$FW" ; then
if ! diff -q "$FW" /dev/test_firmware >/dev/null ; then
echo "$0: firmware was not loaded" >&2
exit 1
else
echo "$0: custom fallback loading mechanism works"
fi
fi
fi

if load_fw_custom_cancel "nope-$NAME" "$FW" ; then
if diff -q "$FW" /dev/test_firmware >/dev/null ; then
echo "$0: firmware was expected to be cancelled" >&2
exit 1
else
echo "$0: cancelling custom fallback mechanism works"
if load_fw_custom_cancel "nope-$NAME" "$FW" ; then
if diff -q "$FW" /dev/test_firmware >/dev/null ; then
echo "$0: firmware was expected to be cancelled" >&2
exit 1
else
echo "$0: cancelling custom fallback mechanism works"
fi
fi
fi
}

run_sysfs_main_tests
run_sysfs_custom_load_tests

exit 0

0 comments on commit 82bdf49

Please sign in to comment.