aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEnji Cooper <ngie@FreeBSD.org>2015-12-16 05:44:53 +0000
committerEnji Cooper <ngie@FreeBSD.org>2015-12-16 05:44:53 +0000
commit11b249f99e4d4891bd2a21ef796d40073ee15508 (patch)
treefbf19a089c228a780b0cd2581fedaf0113d32d7e
parent6971646f3e5f1d8d44e639435ff11cd59f04aa9b (diff)
downloadsrc-11b249f99e4d4891bd2a21ef796d40073ee15508.tar.gz
src-11b249f99e4d4891bd2a21ef796d40073ee15508.zip
Add ATF_REQUIRE_FEATURE and PLAIN_REQUIRE_FEATURE macros for
testing for kernel features via the feature_present(3) libcall The semantics are similar to the other macros in the header (skip testcase with ATF macro; exit with appropriate exit code with the PLAIN macro) MFC after: 1 week Sponsored by: EMC / Isilon Storage Division
Notes
Notes: svn path=/head/; revision=292319
-rw-r--r--tests/freebsd_test_suite/macros.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/freebsd_test_suite/macros.h b/tests/freebsd_test_suite/macros.h
index 8d95f05324a3..98da0ededbc3 100644
--- a/tests/freebsd_test_suite/macros.h
+++ b/tests/freebsd_test_suite/macros.h
@@ -38,6 +38,13 @@
#include <atf-c.h>
+#define ATF_REQUIRE_FEATURE(_feature_name) do { \
+ if (feature_present(_feature_name) == 0) { \
+ atf_tc_skip("kernel feature (%s) not present", \
+ _feature_name); \
+ } \
+} while(0)
+
#define ATF_REQUIRE_KERNEL_MODULE(_mod_name) do { \
if (modfind(_mod_name) == -1) { \
atf_tc_skip("module %s could not be resolved: %s", \
@@ -45,6 +52,14 @@
} \
} while(0)
+#define PLAIN_REQUIRE_FEATURE(_feature_name, _exit_code) do { \
+ if (feature_present(_feature_name) == 0) { \
+ printf("kernel feature (%s) not present\n", \
+ _feature_name); \
+ _exit(_exit_code); \
+ } \
+} while(0)
+
#define PLAIN_REQUIRE_KERNEL_MODULE(_mod_name, _exit_code) do { \
if (modfind(_mod_name) == -1) { \
printf("module %s could not be resolved: %s\n", \