Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 23 Dec 2015 10:31:46 +0000 (UTC)
From:      Garrett Cooper <ngie@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r292655 - stable/10/tests/freebsd_test_suite
Message-ID:  <201512231031.tBNAVkNo087068@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ngie
Date: Wed Dec 23 10:31:46 2015
New Revision: 292655
URL: https://svnweb.freebsd.org/changeset/base/292655

Log:
  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

Modified:
  stable/10/tests/freebsd_test_suite/macros.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/tests/freebsd_test_suite/macros.h
==============================================================================
--- stable/10/tests/freebsd_test_suite/macros.h	Wed Dec 23 10:23:47 2015	(r292654)
+++ stable/10/tests/freebsd_test_suite/macros.h	Wed Dec 23 10:31:46 2015	(r292655)
@@ -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",		\



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201512231031.tBNAVkNo087068>