svn commit: r346446 - user/ngie/bug-237403/tests/sys/opencrypto
Enji Cooper
ngie at FreeBSD.org
Tue Sep 3 14:07:13 UTC 2019
Author: ngie
Date: Sat Apr 20 16:01:04 2019
New Revision: 346446
URL: https://svnweb.freebsd.org/changeset/base/346446
Log:
Hack away at runtests
- Do not rely on local copy of dpkt module. Rely on py-dpkt, instead. The
reason for this is that this removes the need for introducing localized fixes
to dpkt.py, as upstream has changed significantly in the last few years, and
now supports both python 2.x and python 3.
- Convert tests to TAP format. This adds improved introspection, as the plain
tests have little to no introspection, and kyua lacks python unittest engine
support. As such, remove `set -ex`, as it would impede being able to run this
test with TAP cleanly.
Deleted:
user/ngie/bug-237403/tests/sys/opencrypto/dpkt.py
Modified:
user/ngie/bug-237403/tests/sys/opencrypto/Makefile
user/ngie/bug-237403/tests/sys/opencrypto/runtests.sh
Modified: user/ngie/bug-237403/tests/sys/opencrypto/Makefile
==============================================================================
--- user/ngie/bug-237403/tests/sys/opencrypto/Makefile Sat Apr 20 15:57:05 2019 (r346445)
+++ user/ngie/bug-237403/tests/sys/opencrypto/Makefile Sat Apr 20 16:01:04 2019 (r346446)
@@ -12,12 +12,12 @@ CFLAGS.poly1305_test.c += -I${SRCTOP}/sys/opencrypto
ATF_TESTS_C+= blake2_test poly1305_test
-PLAIN_TESTS_SH= runtests
+TAP_TESTS_SH+= runtests
-TEST_METADATA.runtests+= required_programs="python2"
+TEST_METADATA.runtests+= required_programs="python"
TEST_METADATA.runtests+= required_user="root"
-PYMODULES= cryptodev.py cryptodevh.py cryptotest.py dpkt.py
+PYMODULES= cryptodev.py cryptodevh.py cryptotest.py
${PACKAGE}FILES+= ${PYMODULES}
Modified: user/ngie/bug-237403/tests/sys/opencrypto/runtests.sh
==============================================================================
--- user/ngie/bug-237403/tests/sys/opencrypto/runtests.sh Sat Apr 20 15:57:05 2019 (r346445)
+++ user/ngie/bug-237403/tests/sys/opencrypto/runtests.sh Sat Apr 20 16:01:04 2019 (r346446)
@@ -29,13 +29,18 @@
# $FreeBSD$
#
-set -ex
+: ${PYTHON=python}
if [ ! -d /usr/local/share/nist-kat ]; then
- echo 'Skipping, nist-kat package not installed for test vectors.'
+ echo "1..0 # SKIP: nist-kat package not installed for test vectors"
exit 0
fi
+if ! $PYTHON -c "from dpkt import dpkt"; then
+ echo "1..0 # SKIP: py-dpkt package not installed"
+ exit 0
+fi
+
loaded_modules=
cleanup_tests()
{
@@ -52,7 +57,11 @@ trap cleanup_tests EXIT INT TERM
for required_module in nexus/aesni cryptodev; do
if ! kldstat -q -m $required_module; then
- kldload ${required_module#nexus/}
+ module_to_load=${required_module#nexus/}
+ if ! kldload ${module_to_load}; then
+ echo "1..0 # SKIP: could not load ${module_to_load}"
+ exit 0
+ fi
loaded_modules="$loaded_modules $required_module"
fi
done
@@ -61,6 +70,11 @@ done
oldcdas=$(sysctl -e kern.cryptodevallowsoft)
sysctl kern.cryptodevallowsoft=1
-python2 $(dirname $0)/cryptotest.py
+echo "1..1"
+if "$PYTHON" $(dirname $0)/cryptotest.py; then
+ echo "ok 1"
+else
+ echo "not ok 1"
+fi
sysctl "$oldcdas"
More information about the svn-src-user
mailing list