[gnome-keysign: 7/11] tests: increase robustness to support non-existant directories




commit f917f4ebf23810ed45b92fd00ad9feefd34cc671
Author: Tobias Mueller <muelli cryptobitch de>
Date:   Wed Oct 7 20:11:10 2020 +0200

    tests: increase robustness to support non-existant directories
    
    With this change the scripts can be run even if the directories do not
    already exist. Yeah, that's a pretty common situation. Calling "mv"
    would fail. There is probably a flag for ignoring non-existant sources.
    I could have used a shell test, i.e. [[ ]] or "test", but I felt like
    not requiring the bash syntax nor figuring out what the correct
    parameters for the "test" program are. By explicitly creating the
    directory, we should achieve maximal compatibility.

 tests/create_attestee.sh | 1 +
 tests/create_attestor.sh | 1 +
 2 files changed, 2 insertions(+)
---
diff --git a/tests/create_attestee.sh b/tests/create_attestee.sh
index 4120831..2c550a2 100755
--- a/tests/create_attestee.sh
+++ b/tests/create_attestee.sh
@@ -4,6 +4,7 @@
 ATTESTEE_DIR=/tmp/gks-attestee
 
 rm -rf "${ATTESTEE_DIR}.bak"
+mkdir -p $ATTESTEE_DIR
 mv -f "$ATTESTEE_DIR" "${ATTESTEE_DIR}.bak"
 mkdir -p $ATTESTEE_DIR
 echo -n | env GNUPGHOME=${ATTESTEE_DIR}  gpg --pinentry-mode loopback --batch --no-tty --yes --passphrase-fd 
0 --quick-generate-key attestee example com
diff --git a/tests/create_attestor.sh b/tests/create_attestor.sh
index 12e1e1c..7ace175 100755
--- a/tests/create_attestor.sh
+++ b/tests/create_attestor.sh
@@ -4,6 +4,7 @@
 ATTESTOR_DIR=/tmp/gks-attestor
 
 rm -rf "${ATTESTOR_DIR}.bak"
+mkdir -p $ATTESTOR_DIR
 mv -f "$ATTESTOR_DIR" "${ATTESTOR_DIR}.bak"
 mkdir -p $ATTESTOR_DIR
 echo -n | env GNUPGHOME=${ATTESTOR_DIR}  gpg --pinentry-mode loopback --batch --no-tty --yes --passphrase-fd 
0 --quick-generate-key attestor example com


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]