Date: Thu, 23 May 2019 01:25:34 +0000 (UTC) From: Enji Cooper <ngie@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r348140 - in stable/12: . tests/sys/opencrypto Message-ID: <201905230125.x4N1PYOr025994@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: ngie Date: Thu May 23 01:25:34 2019 New Revision: 348140 URL: https://svnweb.freebsd.org/changeset/base/348140 Log: MFC r346431,r347417,r348019: r346431 (by lwhsu): Specify using Python2, these .py files have not been converted to use Python3 yet, but the default Python version in ports has been switched to 3. r347417: Refactor tests/sys/opencrypto/runtests * Convert from plain to TAP for slightly improved introspection when skipping the tests due to requirements not being met. * Test for the net/py-dpkt (origin) package being required when running the tests, instead of relying on a copy of the dpkt.py module from 2014. This enables the tests to work with py3. Subsequently, remove `tests/sys/opencrypto/dpkt.py(c)?` via `make delete-old`. * Parameterize out `python2` as `$PYTHON`. PR: 237403 r348019: Allow the end-user to pass along arguments to cryptotest.py via `$CRYPTOTEST_ARGS` This allows someone to use `-v` to dump out standard output. Deleted: stable/12/tests/sys/opencrypto/dpkt.py Modified: stable/12/ObsoleteFiles.inc stable/12/tests/sys/opencrypto/Makefile stable/12/tests/sys/opencrypto/cryptodev.py stable/12/tests/sys/opencrypto/cryptotest.py stable/12/tests/sys/opencrypto/runtests.sh Directory Properties: stable/12/ (props changed) Modified: stable/12/ObsoleteFiles.inc ============================================================================== --- stable/12/ObsoleteFiles.inc Thu May 23 01:13:12 2019 (r348139) +++ stable/12/ObsoleteFiles.inc Thu May 23 01:25:34 2019 (r348140) @@ -38,6 +38,9 @@ # xargs -n1 | sort | uniq -d; # done +# 20190509: tests/sys/opencrypto requires the net/py-dpkt package. +OLD_FILES+=usr/tests/sys/opencrypto/dpkt.py +OLD_FILES+=usr/tests/sys/opencrypto/dpkt.pyc # 20190412: new libc++ import which bumps version from 7.0.1 to 8.0.0. OLD_FILES+=usr/include/c++/v1/experimental/dynarray # 20190412: new clang import which bumps version from 7.0.1 to 8.0.0. Modified: stable/12/tests/sys/opencrypto/Makefile ============================================================================== --- stable/12/tests/sys/opencrypto/Makefile Thu May 23 01:13:12 2019 (r348139) +++ stable/12/tests/sys/opencrypto/Makefile Thu May 23 01:25:34 2019 (r348140) @@ -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="python" +TEST_METADATA.runtests+= required_programs="python2" 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: stable/12/tests/sys/opencrypto/cryptodev.py ============================================================================== --- stable/12/tests/sys/opencrypto/cryptodev.py Thu May 23 01:13:12 2019 (r348139) +++ stable/12/tests/sys/opencrypto/cryptodev.py Thu May 23 01:25:34 2019 (r348140) @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/local/bin/python2 # # Copyright (c) 2014 The FreeBSD Foundation # Copyright 2014 John-Mark Gurney Modified: stable/12/tests/sys/opencrypto/cryptotest.py ============================================================================== --- stable/12/tests/sys/opencrypto/cryptotest.py Thu May 23 01:13:12 2019 (r348139) +++ stable/12/tests/sys/opencrypto/cryptotest.py Thu May 23 01:25:34 2019 (r348140) @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/local/bin/python2 # # Copyright (c) 2014 The FreeBSD Foundation # All rights reserved. Modified: stable/12/tests/sys/opencrypto/runtests.sh ============================================================================== --- stable/12/tests/sys/opencrypto/runtests.sh Thu May 23 01:13:12 2019 (r348139) +++ stable/12/tests/sys/opencrypto/runtests.sh Thu May 23 01:25:34 2019 (r348140) @@ -29,13 +29,18 @@ # $FreeBSD$ # -set -ex +: ${PYTHON=python2} 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() { @@ -43,6 +48,10 @@ cleanup_tests() set +e + if [ -n "$oldcdas" ]; then + sysctl "$oldcdas" 2>/dev/null + fi + # Unload modules in reverse order for loaded_module in $(echo $loaded_modules | tr ' ' '\n' | sort -r); do kldunload $loaded_module @@ -52,15 +61,28 @@ 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 -# Run software crypto test -oldcdas=$(sysctl -e kern.cryptodevallowsoft) -sysctl kern.cryptodevallowsoft=1 +cdas_sysctl=kern.cryptodevallowsoft +if ! oldcdas=$(sysctl -e $cdas_sysctl); then + echo "1..0 # SKIP: could not resolve sysctl: $cdas_sysctl" + exit 0 +fi +if ! sysctl $cdas_sysctl=1; then + echo "1..0 # SKIP: could not enable /dev/crypto access via $cdas_sysctl sysctl." + exit 0 +fi -python $(dirname $0)/cryptotest.py - -sysctl "$oldcdas" +echo "1..1" +if "$PYTHON" $(dirname $0)/cryptotest.py $CRYPTOTEST_ARGS; then + echo "ok 1" +else + echo "not ok 1" +fi
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201905230125.x4N1PYOr025994>