From owner-svn-src-stable-12@freebsd.org Thu May 23 01:25:36 2019 Return-Path: Delivered-To: svn-src-stable-12@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 80AF71593EE3; Thu, 23 May 2019 01:25:36 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1E1A4747F2; Thu, 23 May 2019 01:25:36 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CFB9E25C31; Thu, 23 May 2019 01:25:35 +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 x4N1PZlh025999; Thu, 23 May 2019 01:25:35 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4N1PYOr025994; Thu, 23 May 2019 01:25:34 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201905230125.x4N1PYOr025994@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Enji Cooper Date: Thu, 23 May 2019 01:25:34 +0000 (UTC) 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 X-SVN-Group: stable-12 X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: in stable/12: . tests/sys/opencrypto X-SVN-Commit-Revision: 348140 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 1E1A4747F2 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_SHORT(-0.95)[-0.949,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 May 2019 01:25:36 -0000 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