From e9d514995f07298c4bd984dbc1b2e128fb0a486f Mon Sep 17 00:00:00 2001 From: ngie Date: Wed, 23 Dec 2015 10:31:46 +0000 Subject: [PATCH] MFC r292319: 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) Sponsored by: EMC / Isilon Storage Division git-svn-id: svn://svn.freebsd.org/base/stable/10@292655 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- tests/freebsd_test_suite/macros.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/freebsd_test_suite/macros.h b/tests/freebsd_test_suite/macros.h index 8d95f0532..98da0eded 100644 --- a/tests/freebsd_test_suite/macros.h +++ b/tests/freebsd_test_suite/macros.h @@ -38,6 +38,13 @@ #include +#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", \ -- 2.45.0