summaryrefslogtreecommitdiff
blob: 41dd2cd6fb0c283f175ea74dca3d98f511760bab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
From 5be7797f96db606c16701b6cb7e218a487c4cf4a Mon Sep 17 00:00:00 2001
From: Christopher Byrne <salah.coronya@gmail.com>
Date: Sat, 6 Nov 2021 15:36:48 -0500
Subject: [PATCH] test: Rename bash variable WORKDIR to MYWORKDIR

Gentoo Portage ALSO uses the variable WORKDIR, and this results in
Portage deleting the entire tree if the tests are run under it

Signed-off-by: Christopher Byrne <salah.coronya@gmail.com>
---
 tests/functions.sh     | 12 ++++++------
 tests/sign_verify.test |  6 +++---
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/tests/functions.sh b/tests/functions.sh
index 8f6f02d..eb6b34a 100755
--- a/tests/functions.sh
+++ b/tests/functions.sh
@@ -250,8 +250,8 @@ _enable_gost_engine() {
 # Show test stats and exit into automake test system
 # with proper exit code (same as ours). Do cleanups.
 _report_exit_and_cleanup() {
-  if [ -n "${WORKDIR}" ]; then
-    rm -rf "${WORKDIR}"
+  if [ -n "${MYWORKDIR}" ]; then
+    rm -rf "${MYWORKDIR}"
   fi
 
   if [ $testsfail -gt 0 ]; then
@@ -277,19 +277,19 @@ _report_exit_and_cleanup() {
 }
 
 # Setup SoftHSM for local testing by calling the softhsm_setup script.
-# Use the provided workdir as the directory where SoftHSM will store its state
+# Use the provided myworkdir as the directory where SoftHSM will store its state
 # into.
 # Upon successfully setting up SoftHSM, this function sets the global variables
 # OPENSSL_ENGINE and OPENSSL_KEYFORM so that the openssl command line tool can
 # use SoftHSM. Also the PKCS11_KEYURI global variable is set to the test key's
 # pkcs11 URI.
 _softhsm_setup() {
-  local workdir="$1"
+  local myworkdir="$1"
 
   local msg
 
-  export SOFTHSM_SETUP_CONFIGDIR="${workdir}/softhsm"
-  export SOFTHSM2_CONF="${workdir}/softhsm/softhsm2.conf"
+  export SOFTHSM_SETUP_CONFIGDIR="${myworkdir}/softhsm"
+  export SOFTHSM2_CONF="${myworkdir}/softhsm/softhsm2.conf"
 
   mkdir -p "${SOFTHSM_SETUP_CONFIGDIR}"
 
diff --git a/tests/sign_verify.test b/tests/sign_verify.test
index c56290a..b619c22 100755
--- a/tests/sign_verify.test
+++ b/tests/sign_verify.test
@@ -29,7 +29,7 @@ fi
 ./gen-keys.sh >/dev/null 2>&1
 
 trap _report_exit_and_cleanup EXIT
-WORKDIR=$(mktemp -d)
+MYWORKDIR=$(mktemp -d)
 set -f # disable globbing
 
 # Determine keyid from a cert
@@ -426,7 +426,7 @@ expect_fail \
   check_sign TYPE=ima KEY=gost2012_256-B ALG=md_gost12_512 PREFIX=0x0302 OPTS=
 
 # Test signing with key described by pkcs11 URI
-_softhsm_setup "${WORKDIR}"
+_softhsm_setup "${MYWORKDIR}"
 if [ -n "${PKCS11_KEYURI}" ]; then
   expect_pass check_sign FILE=pkcs11test TYPE=ima KEY=${PKCS11_KEYURI} ALG=sha256 PREFIX=0x030204aabbccdd0100 OPTS=--keyid=aabbccdd
   expect_pass check_sign FILE=pkcs11test TYPE=ima KEY=${PKCS11_KEYURI} ALG=sha1   PREFIX=0x030202aabbccdd0100 OPTS=--keyid=aabbccdd
@@ -436,4 +436,4 @@ else
   expect_pass __skip
   expect_pass __skip
 fi
-_softhsm_teardown "${WORKDIR}"
+_softhsm_teardown "${MYWORKDIR}"
-- 
2.32.0