summaryrefslogtreecommitdiff
path: root/test/lib/common.bash
diff options
context:
space:
mode:
Diffstat (limited to 'test/lib/common.bash')
-rw-r--r--test/lib/common.bash32
1 files changed, 8 insertions, 24 deletions
diff --git a/test/lib/common.bash b/test/lib/common.bash
index 1a16ae0..db6b33e 100644
--- a/test/lib/common.bash
+++ b/test/lib/common.bash
@@ -1,6 +1,6 @@
#!/hint/bash
-if [[ -z $LIBRETOOLS_LIBDIR || -z $_librelib_conf_sh_sysconfdir || -z $_librelib_conf_sh_pkgconfdir ]]; then
+if [[ -z $LIBRETOOLS_LIBRARY_PATH || -z $_librelib_conf_sh_sysconfdir || -z $_librelib_conf_sh_pkgconfdir ]]; then
libremessages error 'Must be run with ./testenv'
exit 1
fi
@@ -26,10 +26,15 @@ common_setup() {
mkdir -p -- "$GNUPGHOME"
chmod 700 -- "$GNUPGHOME"
gpg --quiet --no-tty --batch --gen-key <<-eot
- Key-Type: default
+ Key-Type: DSA
+ Key-Length: 1024
+ Subkey-Type: ECDSA
+ Subkey-Curve: nistp256
+
Key-Usage: sign
Name-Real: Bob Tester
Name-Email: tester@localhost
+
Expire-Date: 0
%no-protection
%commit
@@ -61,7 +66,7 @@ common_setup() {
common_teardown() {
gpg-connect-agent KILLAGENT /bye || true
if [[ -n ${tmpdir:-} ]]; then
- if [[ -f "$tmpdir/.used-sudo" ]]; then
+ if libremessages in_array 'sudo' "${BATS_TEST_TAGS[@]}"; then
sudo rm -rf -- "$tmpdir"
else
rm -rf -- "$tmpdir"
@@ -95,27 +100,6 @@ teardown() {
# Utility functions for use in test definitions ######################
-require() (
- set +x
- local missing=()
- if libremessages in_array "network" "$@" && ! [[ $NETWORK ]]; then
- missing+=('networking')
- fi
- if libremessages in_array "sudo" "$@" && ! [[ $SUDO ]]; then
- missing+=('sudo')
- fi
- if libremessages in_array "btrfs" "$@" && ! [[ "$(stat -f -c %T "$chrootdir" 2>/dev/null || true)" == 'btrfs' ]]; then
- missing+=('btrfs')
- fi
- if (( ${#missing[@]} )); then
- return 1
- fi
- if libremessages in_array "sudo" "$@"; then
- touch "$tmpdir/.used-sudo"
- fi
- return 0
-)
-
empty() {
diff -u /dev/null "$1"
}