aboutsummaryrefslogtreecommitdiff
path: root/testcases/lib
diff options
context:
space:
mode:
authorAlexey Kodanev <alexey.kodanev@oracle.com>2018-09-20 14:30:16 +0300
committerAlexey Kodanev <alexey.kodanev@oracle.com>2018-09-20 14:36:03 +0300
commit1f70b0a9cb0607de131c932f6c7041ebbbab4d6d (patch)
tree0a9443fdb4db890eebb8400521b7e492a96a1423 /testcases/lib
parentd365ea2dee8e141eff3ccef62543cc88f6d95f52 (diff)
lib/tst_test.c: add 'needs_drivers' option with tst_check_drivers cmd
The drivers are checked with modprobe. If modprobe is not available on the system, the checks are silently skipped. Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com> Reviewed-by: Petr Vorel <petr.vorel@gmail.com> Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
Diffstat (limited to 'testcases/lib')
-rw-r--r--testcases/lib/.gitignore1
-rw-r--r--testcases/lib/Makefile2
-rw-r--r--testcases/lib/tst_check_drivers.c25
3 files changed, 27 insertions, 1 deletions
diff --git a/testcases/lib/.gitignore b/testcases/lib/.gitignore
index a9034e401..d83a48e2a 100644
--- a/testcases/lib/.gitignore
+++ b/testcases/lib/.gitignore
@@ -1,5 +1,6 @@
/tst_sleep
/tst_random
+/tst_check_drivers
/tst_checkpoint
/tst_rod
/tst_kvcmp
diff --git a/testcases/lib/Makefile b/testcases/lib/Makefile
index 3547e16dc..e1dea3b05 100644
--- a/testcases/lib/Makefile
+++ b/testcases/lib/Makefile
@@ -28,6 +28,6 @@ INSTALL_TARGETS := *.sh
MAKE_TARGETS := tst_sleep tst_random tst_checkpoint tst_rod tst_kvcmp\
tst_device tst_net_iface_prefix tst_net_ip_prefix tst_net_vars\
- tst_getconf tst_supported_fs
+ tst_getconf tst_supported_fs tst_check_drivers
include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/lib/tst_check_drivers.c b/testcases/lib/tst_check_drivers.c
new file mode 100644
index 000000000..e21bdab1f
--- /dev/null
+++ b/testcases/lib/tst_check_drivers.c
@@ -0,0 +1,25 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/* Copyright (c) 2018 Oracle and/or its affiliates. All Rights Reserved. */
+
+#include <stdio.h>
+#include "tst_kernel.h"
+
+int main(int argc, const char *argv[])
+{
+ const char *name;
+ int i;
+
+ if (argc < 2) {
+ fprintf(stderr, "Please provide kernel driver list\n");
+ return 1;
+ }
+
+ for (i = 1; (name = argv[i]); ++i) {
+ if (tst_check_driver(name)) {
+ fprintf(stderr, "%s", name);
+ return 1;
+ }
+ }
+
+ return 0;
+}