aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorShuah Khan (Samsung OSG) <shuah@kernel.org>2018-05-04 16:26:10 -0400
committerShuah Khan (Samsung OSG) <shuah@kernel.org>2018-05-30 17:29:06 -0400
commite6ee6ae4a170335d685571f38510505dd62cc6a4 (patch)
treeb36dc2e7b58228e2acecbcf2fe204144db579e39 /tools
parente1890c502ca7f0bb13a7372dc8945f5e06832346 (diff)
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')
-rw-r--r--tools/testing/selftests/mqueue/mq_open_tests.c8
-rw-r--r--tools/testing/selftests/mqueue/mq_perf_tests.c8
2 files changed, 8 insertions, 8 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 @@
33#include <mqueue.h> 33#include <mqueue.h>
34#include <error.h> 34#include <error.h>
35 35
36#include "../kselftest.h"
37
36static char *usage = 38static char *usage =
37"Usage:\n" 39"Usage:\n"
38" %s path\n" 40" %s path\n"
@@ -262,12 +264,10 @@ int main(int argc, char *argv[])
262 } 264 }
263 } 265 }
264 266
265 if (getuid() != 0) { 267 if (getuid() != 0)
266 fprintf(stderr, "Not running as root, but almost all tests " 268 ksft_exit_skip("Not running as root, but almost all tests "
267 "require root in order to modify\nsystem settings. " 269 "require root in order to modify\nsystem settings. "
268 "Exiting.\n"); 270 "Exiting.\n");
269 exit(1);
270 }
271 271
272 /* Find out what files there are for us to make tweaks in */ 272 /* Find out what files there are for us to make tweaks in */
273 def_msgs = fopen(DEF_MSGS, "r+"); 273 def_msgs = fopen(DEF_MSGS, "r+");
diff --git a/tools/testing/selftests/mqueue/mq_perf_tests.c b/tools/testing/selftests/mqueue/mq_perf_tests.c
index 8188f72de93c..b019e0b8221c 100644
--- a/tools/testing/selftests/mqueue/mq_perf_tests.c
+++ b/tools/testing/selftests/mqueue/mq_perf_tests.c
@@ -39,6 +39,8 @@
39#include <popt.h> 39#include <popt.h>
40#include <error.h> 40#include <error.h>
41 41
42#include "../kselftest.h"
43
42static char *usage = 44static char *usage =
43"Usage:\n" 45"Usage:\n"
44" %s [-c #[,#..] -f] path\n" 46" %s [-c #[,#..] -f] path\n"
@@ -626,12 +628,10 @@ int main(int argc, char *argv[])
626 cpus_to_pin[0] = cpus_online - 1; 628 cpus_to_pin[0] = cpus_online - 1;
627 } 629 }
628 630
629 if (getuid() != 0) { 631 if (getuid() != 0)
630 fprintf(stderr, "Not running as root, but almost all tests " 632 ksft_exit_skip("Not running as root, but almost all tests "
631 "require root in order to modify\nsystem settings. " 633 "require root in order to modify\nsystem settings. "
632 "Exiting.\n"); 634 "Exiting.\n");
633 exit(1);
634 }
635 635
636 max_msgs = fopen(MAX_MSGS, "r+"); 636 max_msgs = fopen(MAX_MSGS, "r+");
637 max_msgsize = fopen(MAX_MSGSIZE, "r+"); 637 max_msgsize = fopen(MAX_MSGSIZE, "r+");