svn commit: r337933 - in head/tests: freebsd_test_suite sys/opencrypto

Alan Somers asomers at FreeBSD.org
Thu Aug 16 23:49:57 UTC 2018


Author: asomers
Date: Thu Aug 16 23:49:56 2018
New Revision: 337933
URL: https://svnweb.freebsd.org/changeset/base/337933

Log:
  Fix sys/opencrypto/blake2_test when kern.cryptodevallowsoft=0
  
  Two of these testcases require software crypto to be enabled. Curiously, it
  isn't by default.
  
  PR:		230671
  Reported by:	Jenkins
  Reviewed by:	cem
  MFC after:	2 weeks
  Differential Revision:	https://reviews.freebsd.org/D16755

Modified:
  head/tests/freebsd_test_suite/macros.h
  head/tests/sys/opencrypto/blake2_test.c

Modified: head/tests/freebsd_test_suite/macros.h
==============================================================================
--- head/tests/freebsd_test_suite/macros.h	Thu Aug 16 23:46:38 2018	(r337932)
+++ head/tests/freebsd_test_suite/macros.h	Thu Aug 16 23:49:56 2018	(r337933)
@@ -31,6 +31,7 @@
 
 #include <sys/param.h>
 #include <sys/module.h>
+#include <sys/sysctl.h>
 #include <string.h>
 #include <errno.h>
 #include <stdio.h>
@@ -50,6 +51,17 @@
 		atf_tc_skip("module %s could not be resolved: %s",	\
 		    _mod_name, strerror(errno));			\
 	}								\
+} while(0)
+
+#define ATF_REQUIRE_SYSCTL_INT(_mib_name, _required_value) do {		\
+	int value;							\
+	size_t size = sizeof(value);					\
+	if (sysctlbyname(_mib_name, &value, &size, NULL, 0) == -1) {	\
+		atf_tc_skip("sysctl for %s failed: %s", _mib_name,	\
+		    strerror(errno));					\
+	}								\
+	if (value != _required_value)					\
+		atf_tc_skip("requires %s=%d", _mib_name, _required_value); \
 } while(0)
 
 #define	PLAIN_REQUIRE_FEATURE(_feature_name, _exit_code) do {		\

Modified: head/tests/sys/opencrypto/blake2_test.c
==============================================================================
--- head/tests/sys/opencrypto/blake2_test.c	Thu Aug 16 23:46:38 2018	(r337932)
+++ head/tests/sys/opencrypto/blake2_test.c	Thu Aug 16 23:49:56 2018	(r337933)
@@ -172,12 +172,14 @@ test_blake2s_vectors(int crid, const char *modname)
 ATF_TC_WITHOUT_HEAD(blake2b_vectors);
 ATF_TC_BODY(blake2b_vectors, tc)
 {
+	ATF_REQUIRE_SYSCTL_INT("kern.cryptodevallowsoft", 1);
 	test_blake2b_vectors(CRYPTO_FLAG_SOFTWARE, "nexus/cryptosoft");
 }
 
 ATF_TC_WITHOUT_HEAD(blake2s_vectors);
 ATF_TC_BODY(blake2s_vectors, tc)
 {
+	ATF_REQUIRE_SYSCTL_INT("kern.cryptodevallowsoft", 1);
 	test_blake2s_vectors(CRYPTO_FLAG_SOFTWARE, "nexus/cryptosoft");
 }
 


More information about the svn-src-all mailing list