diff options
author | Shuah Khan (Samsung OSG) <shuah@kernel.org> | 2018-05-04 21:06:46 +0300 |
---|---|---|
committer | Shuah Khan (Samsung OSG) <shuah@kernel.org> | 2018-05-31 00:29:06 +0300 |
commit | 113812868c40c5bb09b0e2cc7d168dee5649952f (patch) | |
tree | 4c5119f254ba2d27c01f1530f390299d1f1c4013 /tools/testing/selftests/media_tests | |
parent | f9fedb2719b1aed80f8e614b2b1f54df94ae1ebb (diff) | |
download | linux-113812868c40c5bb09b0e2cc7d168dee5649952f.tar.xz |
selftests: media_tests: return Kselftest Skip code for skipped tests
When media_tests test is skipped because of unmet dependencies and/or
unsupported configuration, it exits with error which is treated as a
fail by the Kselftest framework. This leads to false negative result
even when the test could not be run.
Change it to return kselftest skip code when a test gets skipped to
clearly report that the test could not be run.
Change it to use ksft_exit_skip() when the test is skipped.
Signed-off-by: Shuah Khan (Samsung OSG) <shuah@kernel.org>
Diffstat (limited to 'tools/testing/selftests/media_tests')
-rw-r--r-- | tools/testing/selftests/media_tests/Makefile | 3 | ||||
-rw-r--r-- | tools/testing/selftests/media_tests/media_device_open.c | 8 | ||||
-rw-r--r-- | tools/testing/selftests/media_tests/media_device_test.c | 8 |
3 files changed, 10 insertions, 9 deletions
diff --git a/tools/testing/selftests/media_tests/Makefile b/tools/testing/selftests/media_tests/Makefile index c82cec2497de..60826d7d37d4 100644 --- a/tools/testing/selftests/media_tests/Makefile +++ b/tools/testing/selftests/media_tests/Makefile @@ -1,5 +1,6 @@ # SPDX-License-Identifier: GPL-2.0 +# +CFLAGS += -I../ -I../../../../usr/include/ TEST_GEN_PROGS := media_device_test media_device_open video_device_test -all: $(TEST_GEN_PROGS) include ../lib.mk diff --git a/tools/testing/selftests/media_tests/media_device_open.c b/tools/testing/selftests/media_tests/media_device_open.c index a5ce5434bafd..93183a37b133 100644 --- a/tools/testing/selftests/media_tests/media_device_open.c +++ b/tools/testing/selftests/media_tests/media_device_open.c @@ -34,6 +34,8 @@ #include <sys/stat.h> #include <linux/media.h> +#include "../kselftest.h" + int main(int argc, char **argv) { int opt; @@ -61,10 +63,8 @@ int main(int argc, char **argv) } } - if (getuid() != 0) { - printf("Please run the test as root - Exiting.\n"); - exit(-1); - } + if (getuid() != 0) + ksft_exit_skip("Please run the test as root - Exiting.\n"); /* Open Media device and keep it open */ fd = open(media_device, O_RDWR); diff --git a/tools/testing/selftests/media_tests/media_device_test.c b/tools/testing/selftests/media_tests/media_device_test.c index d8bb1e15d1d9..4b9953359e40 100644 --- a/tools/testing/selftests/media_tests/media_device_test.c +++ b/tools/testing/selftests/media_tests/media_device_test.c @@ -39,6 +39,8 @@ #include <time.h> #include <linux/media.h> +#include "../kselftest.h" + int main(int argc, char **argv) { int opt; @@ -66,10 +68,8 @@ int main(int argc, char **argv) } } - if (getuid() != 0) { - printf("Please run the test as root - Exiting.\n"); - exit(-1); - } + if (getuid() != 0) + ksft_exit_skip("Please run the test as root - Exiting.\n"); /* Generate random number of interations */ srand((unsigned int) time(NULL)); |