From owner-svn-src-all@freebsd.org Wed Dec 16 13:56:45 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3A9A6A49D55; Wed, 16 Dec 2015 13:56:45 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D5AD511AB; Wed, 16 Dec 2015 13:56:44 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBG5isRQ086554; Wed, 16 Dec 2015 05:44:54 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBG5isHx086553; Wed, 16 Dec 2015 05:44:54 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201512160544.tBG5isHx086553@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Wed, 16 Dec 2015 05:44:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292319 - head/tests/freebsd_test_suite X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Dec 2015 13:56:45 -0000 Author: ngie Date: Wed Dec 16 05:44:53 2015 New Revision: 292319 URL: https://svnweb.freebsd.org/changeset/base/292319 Log: 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 Modified: head/tests/freebsd_test_suite/macros.h Modified: head/tests/freebsd_test_suite/macros.h ============================================================================== --- head/tests/freebsd_test_suite/macros.h Wed Dec 16 05:19:07 2015 (r292318) +++ head/tests/freebsd_test_suite/macros.h Wed Dec 16 05:44:53 2015 (r292319) @@ -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", \