aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJames Bottomley2020-06-23 16:02:34 -0700
committerGert Doering2020-06-24 09:55:50 +0200
commit013498ddfe0a2b7f8986e9edac2b9f062bdd5fd7 (patch)
tree31bc19a3eb74a902ebfa07ac107d5312b4318c53 /tests
parent21e3e9fc34128d37bd612def2acca29a5a18de77 (diff)
downloadopenvpn-013498ddfe0a2b7f8986e9edac2b9f062bdd5fd7.zip
openvpn-013498ddfe0a2b7f8986e9edac2b9f062bdd5fd7.tar.gz
engine-key tests: make check_engine_keys.sh work with --enable-small
--enable-small eliminates one of the openssl errors the test is looking for, so alter the grep also to account for the message in this version. Additionally output log.txt on failure so any test platform gives an easy clue about what went wrong. Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com> Acked-by: Gert Doering <gert@greenie.muc.de> Message-Id: <1592953354.2103.3.camel@HansenPartnership.com> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg20102.html Signed-off-by: Gert Doering <gert@greenie.muc.de>
Diffstat (limited to 'tests')
-rwxr-xr-xtests/unit_tests/engine-key/check_engine_keys.sh14
1 files changed, 10 insertions, 4 deletions
diff --git a/tests/unit_tests/engine-key/check_engine_keys.sh b/tests/unit_tests/engine-key/check_engine_keys.sh
index e0c9d7b..7e9a0e8 100755
--- a/tests/unit_tests/engine-key/check_engine_keys.sh
+++ b/tests/unit_tests/engine-key/check_engine_keys.sh
@@ -12,6 +12,12 @@ pwdfile="${builddir}/passwd"
sed 's/PRIVATE KEY/TEST ENGINE KEY/' < ${top_srcdir}/sample/sample-keys/client.key > ${key}
echo "$password" > $pwdfile
+# our version of grep to output log.txt on failure in case it's an openssl
+# error mismatch and the grep expression needs updating
+loggrep() {
+ egrep -q "$1" log.txt || { echo '---- begin log.txt ----'; cat log.txt; echo '--- end log.txt ---'; return 1; }
+}
+
# note here we've induced a mismatch in the client key and the server
# cert which openvpn should report and die. Check that it does. Note
# also that this mismatch depends on openssl not openvpn, so it is
@@ -21,10 +27,10 @@ ${top_builddir}/src/openvpn/openvpn --cd ${top_srcdir}/sample --config sample-co
# first off check we died because of a key mismatch. If this doesn't
# pass, suspect openssl of returning different messages and update the
# test accordingly
-grep -q 'X509_check_private_key:key values mismatch' log.txt || { echo "Key mismatch not detected"; exit 1; }
+loggrep '(X509_check_private_key:key values mismatch|func\(128\):reason\(116\))' log.txt || { echo "Key mismatch not detected"; exit 1; }
# now look for the engine prints (these are under our control)
-grep -q 'ENGINE: engine_init called' log.txt || { echo "Engine initialization not detected"; exit 1; }
-grep -q 'ENGINE: engine_load_key called' log.txt || { echo "Key was not loaded from engine"; exit 1; }
-grep -q "ENGINE: engine_load_key got password ${password}" log.txt || { echo "Key password was not retrieved by the engine"; exit 1; }
+loggrep 'ENGINE: engine_init called' || { echo "Engine initialization not detected"; exit 1; }
+loggrep 'ENGINE: engine_load_key called' || { echo "Key was not loaded from engine"; exit 1; }
+loggrep "ENGINE: engine_load_key got password ${password}" || { echo "Key password was not retrieved by the engine"; exit 1; }
exit 0