summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2018-09-29 19:25:56 -0400
committerLuke Shumaker <lukeshu@lukeshu.com>2018-10-01 17:35:19 -0400
commit985e7e5c401f34d142bf90e6f053deabc29e9691 (patch)
tree90d30468596df10ede2486a200e31f86319b6900
parentdf6c254c316c883a6a36eddfa0b76981b8b0f1a1 (diff)
test: test-common.sh: Add some comments, tidy
-rwxr-xr-xtest/test-common.sh18
1 files changed, 12 insertions, 6 deletions
diff --git a/test/test-common.sh b/test/test-common.sh
index 30356d3..2622ac2 100755
--- a/test/test-common.sh
+++ b/test/test-common.sh
@@ -5,6 +5,8 @@ if [[ -z $LIBRETOOLS_LIBDIR || -z $_librelib_conf_sh_sysconfdir || -z $_librelib
exit 1
fi
+# per-test setup/teardown ############################################
+
_common_before() {
:
}
@@ -18,24 +20,26 @@ common_after() {
}
before() {
- unset PKGDEST SRCDEST SRCPKGDEST LOGDEST
- unset BUILDDIR
- unset PKGEXT SRCEXT
- unset GPGKEY PACKAGER
-
tmpdir="$(mktemp -d --tmpdir "test-${roundup_desc//\//-}.${roundup_test_name}.XXXXXXXXXXXX")"
chmod 755 "$tmpdir"
status=0
+ # Clear the list of makepkg variables
+ unset PKGDEST SRCDEST SRCPKGDEST LOGDEST
+ unset BUILDDIR
+ unset PKGEXT SRCEXT
+ unset GPGKEY PACKAGER
+
+ # Set up a test HOME
export HOME="$tmpdir/home"
export GNUPGHOME="$HOME/.gnupg"
export XDG_CACHE_HOME="$HOME/.cache"
export XDG_CONFIG_HOME="$HOME/.config"
+ # Create a GPGKEY
mkdir -p -- "$GNUPGHOME"
chmod 700 -- "$GNUPGHOME"
- unset GPGKEY
gpg --quiet --no-tty --batch --gen-key <<-eot
Key-Type: default
Key-Usage: sign
@@ -74,6 +78,8 @@ setup_chrootdir() {
}
}
+# Utility functions for use in test definitions ######################
+
require() (
set +x
local missing=()