aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/mqueue/mq_open_tests.c
diff options
context:
space:
mode:
authorShuah Khan (Samsung OSG) <shuah@kernel.org>2018-05-04 14:26:10 -0600
committerShuah Khan (Samsung OSG) <shuah@kernel.org>2018-05-30 15:29:06 -0600
commite6ee6ae4a170335d685571f38510505dd62cc6a4 (patch)
treeb36dc2e7b58228e2acecbcf2fe204144db579e39 /tools/testing/selftests/mqueue/mq_open_tests.c
parentselftests: memory-hotplug: return Kselftest Skip code for skipped tests (diff)
downloadlinux-dev-e6ee6ae4a170335d685571f38510505dd62cc6a4.tar.xz
linux-dev-e6ee6ae4a170335d685571f38510505dd62cc6a4.zip
selftests: mqueue: return Kselftest Skip code for skipped tests
When mqueue 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/mqueue/mq_open_tests.c')
-rw-r--r--tools/testing/selftests/mqueue/mq_open_tests.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/tools/testing/selftests/mqueue/mq_open_tests.c b/tools/testing/selftests/mqueue/mq_open_tests.c
index 677140aa25fd..9403ac01ba11 100644
--- a/tools/testing/selftests/mqueue/mq_open_tests.c
+++ b/tools/testing/selftests/mqueue/mq_open_tests.c
@@ -33,6 +33,8 @@
#include <mqueue.h>
#include <error.h>
+#include "../kselftest.h"
+
static char *usage =
"Usage:\n"
" %s path\n"
@@ -262,12 +264,10 @@ int main(int argc, char *argv[])
}
}
- if (getuid() != 0) {
- fprintf(stderr, "Not running as root, but almost all tests "
+ if (getuid() != 0)
+ ksft_exit_skip("Not running as root, but almost all tests "
"require root in order to modify\nsystem settings. "
"Exiting.\n");
- exit(1);
- }
/* Find out what files there are for us to make tweaks in */
def_msgs = fopen(DEF_MSGS, "r+");