selftests/livepatch: add test skip handling
authorJoe Lawrence <joe.lawrence@redhat.com>
Wed, 24 Jul 2019 20:05:58 +0000 (16:05 -0400)
committerShuah Khan <skhan@linuxfoundation.org>
Wed, 24 Jul 2019 20:17:46 +0000 (14:17 -0600)
commit527d37e9e575bc0e9024de9b499385e7bb31f1ad
tree2ff06b3557d70c031cc76f67f9ff3dae0f9dc4b8
parent2e05ec4834f9bb7fe3575e4c48acebebfa1e24d9
selftests/livepatch: add test skip handling

Add a skip() message function that stops the test, logs an explanation,
and sets the "skip" return code (4).

Before loading a livepatch self-test kernel module, first verify that
we've built and installed it by running a 'modprobe --dry-run'.  This
should catch a few environment issues, including !CONFIG_LIVEPATCH and
!CONFIG_TEST_LIVEPATCH.  In these cases, exit gracefully with the new
skip() function.

Reported-by: Jiri Benc <jbenc@redhat.com>
Suggested-by: Shuah Khan <shuah@kernel.org>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Signed-off-by: Joe Lawrence <joe.lawrence@redhat.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
tools/testing/selftests/livepatch/functions.sh