From 54a877ef47adb6a10faaf6b54e3051d8bd95d522 Mon Sep 17 00:00:00 2001 From: Tom Krizek Date: Mon, 7 Nov 2022 15:58:40 +0100 Subject: [PATCH 1/4] Force quiet mode when using testcrypto.sh directly When testcrypto.sh is used as a standalone script, always use quiet mode to avoid using undefined commands (such as echo_i) which require inclusion of the entire conf.sh machinery. (cherry picked from commit ba35a6df9cf4d18d1ccbfdf7a6130a48e5eef2b7) --- bin/tests/system/testcrypto.sh | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/bin/tests/system/testcrypto.sh b/bin/tests/system/testcrypto.sh index 72237777d9..2be22f3652 100755 --- a/bin/tests/system/testcrypto.sh +++ b/bin/tests/system/testcrypto.sh @@ -11,22 +11,27 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. +prog=$0 +args="" +quiet=0 +msg="cryptography" + if test -z "$KEYGEN"; then . ../conf.sh alg="-a $DEFAULT_ALGORITHM -b $DEFAULT_BITS" else alg="" + quiet=1 + args="-q" fi -prog=$0 -args="" -quiet=0 -msg="cryptography" while test "$#" -gt 0; do case $1 in -q) - args="$args -q" - quiet=1 + if test $quiet -eq 0; then + args="$args -q" + quiet=1 + fi ;; rsa|RSA|rsasha1|RSASHA1) alg="-a RSASHA1" From 0079745f9753d9c901c853d410332d1f385b66c5 Mon Sep 17 00:00:00 2001 From: Tom Krizek Date: Mon, 7 Nov 2022 16:38:49 +0100 Subject: [PATCH 2/4] Ensure test interpreters are defined before common config Nothing from conf.sh.common is required to set these values. On the contrary, a Python interpreter needs to be set in order to randomize the algorithm set (which happens in conf.sh.common). (cherry picked from commit 492992dca8512e6cb2cd44c849656e9fa23b287d) --- bin/tests/system/conf.sh.in | 38 +++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 21 deletions(-) diff --git a/bin/tests/system/conf.sh.in b/bin/tests/system/conf.sh.in index 19d00991fa..8d4a55c21c 100644 --- a/bin/tests/system/conf.sh.in +++ b/bin/tests/system/conf.sh.in @@ -67,6 +67,23 @@ export KRB5_CONFIG=/dev/null # use local keytab instead of default /etc/krb5.keytab export KRB5_KTNAME=dns.keytab +# +# Programs detected by configure +# Variables will be empty if no program was found by configure +# +export SHELL=@SHELL@ +export CURL=@CURL@ +export NC=@NC@ +export XMLLINT=@XMLLINT@ +export XSLTPROC=@XSLTPROC@ +export PYTEST=@PYTEST@ + +# +# Interpreters for system tests detected by configure +# +export PERL=$(command -v "@PERL@") +export PYTHON=$(command -v "@PYTHON@" || true) + # Load common values . $TOP_SRCDIR/bin/tests/system/conf.sh.common @@ -98,24 +115,3 @@ tcp" PARALLELDIRS="$PARALLEL_COMMON $PARALLEL_UNIX" SUBDIRS="$SEQUENTIALDIRS $PARALLELDIRS" - -# Use the CONFIG_SHELL detected by configure for tests -export SHELL=@SHELL@ - -# CURL will be empty if no program was found by configure -export CURL=@CURL@ - -# NC will be empty if no program was found by configure -export NC=@NC@ - -# XMLLINT will be empty if no program was found by configure -export XMLLINT=@XMLLINT@ - -# XSLTPROC will be empty if no program was found by configure -export XSLTPROC=@XSLTPROC@ - -# PERL will be an empty string if no perl interpreter was found. -export PERL=$(command -v "@PERL@") - -export PYTHON=$(command -v "@PYTHON@" || true) -export PYTEST=@PYTEST@ From efa09a37f3e6e128d35b74fff7928083cd8e0731 Mon Sep 17 00:00:00 2001 From: Tom Krizek Date: Tue, 8 Nov 2022 14:54:14 +0100 Subject: [PATCH 3/4] Make Perl interpreter required for system tests This change has no practical impact, as Perl was already required for all system tests, this check only makes it more explicit. (cherry picked from commit 084d72d1d5ea38f4ccc600fd04d61fed1c3124c3) --- bin/tests/system/conf.sh.in | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bin/tests/system/conf.sh.in b/bin/tests/system/conf.sh.in index 8d4a55c21c..98a6e3d69e 100644 --- a/bin/tests/system/conf.sh.in +++ b/bin/tests/system/conf.sh.in @@ -81,7 +81,11 @@ export PYTEST=@PYTEST@ # # Interpreters for system tests detected by configure # -export PERL=$(command -v "@PERL@") +export PERL=$(command -v "@PERL@" || true) +if ! test -x "$PERL"; then + echo "Perl interpreter is required for system tests." + exit 77 +fi export PYTHON=$(command -v "@PYTHON@" || true) # Load common values From 45b003316ffa02d1defafd595b669dca5bf47777 Mon Sep 17 00:00:00 2001 From: Tom Krizek Date: Tue, 8 Nov 2022 14:55:17 +0100 Subject: [PATCH 4/4] Make Python interpreter required for system tests This introduces a Python dependency for running system tests. It is needed in order to: - write new test control scripts in Python - gradually rewrite old Perl scripts into Python if needed - eventually introduce pytest as the new test runner framework This commit is not intended to be backported to 9.16. (cherry picked from commit 56416ebd65554a8101a21d72d81c59a7073c7271) --- bin/tests/system/conf.sh.in | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bin/tests/system/conf.sh.in b/bin/tests/system/conf.sh.in index 98a6e3d69e..e1549b3701 100644 --- a/bin/tests/system/conf.sh.in +++ b/bin/tests/system/conf.sh.in @@ -87,6 +87,10 @@ if ! test -x "$PERL"; then exit 77 fi export PYTHON=$(command -v "@PYTHON@" || true) +if ! test -x "$PYTHON"; then + echo "Python interpreter is required for system tests." + exit 77 +fi # Load common values . $TOP_SRCDIR/bin/tests/system/conf.sh.common