summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/libredbdiff-test.sh4
-rw-r--r--test/librefetch-test.sh4
-rw-r--r--test/librerelease-test.sh4
-rw-r--r--test/librestage-test.sh5
-rw-r--r--test/pkgbuild-check-nonfree-test.sh4
-rwxr-xr-xtest/test-common.sh47
6 files changed, 38 insertions, 30 deletions
diff --git a/test/libredbdiff-test.sh b/test/libredbdiff-test.sh
index 222e667..8c2f6e3 100644
--- a/test/libredbdiff-test.sh
+++ b/test/libredbdiff-test.sh
@@ -3,7 +3,9 @@
describe libredbdiff
. ./test-common.sh
-common_before() {
+before() {
+ common_before
+
mkdir -p "$XDG_CONFIG_HOME/libretools"
printf '%s\n' \
'statedir="$PWD"' \
diff --git a/test/librefetch-test.sh b/test/librefetch-test.sh
index 43b34fc..d734b41 100644
--- a/test/librefetch-test.sh
+++ b/test/librefetch-test.sh
@@ -6,7 +6,9 @@ describe librefetch
KEYSERVER=hkp://pool.sks-keyservers.net
GPG="gpg --quiet --batch --no-tty --no-permission-warning --keyserver ${KEYSERVER}"
-common_before() {
+before() {
+ common_before
+
mkdir -p "$XDG_CONFIG_HOME"/{pacman,libretools} "$tmpdir/workdir/srcdest"
cat <<EOF > "$XDG_CONFIG_HOME/pacman/makepkg.conf"
diff --git a/test/librerelease-test.sh b/test/librerelease-test.sh
index 86da995..b8e6e75 100644
--- a/test/librerelease-test.sh
+++ b/test/librerelease-test.sh
@@ -3,7 +3,9 @@
describe librerelease
. ./test-common.sh
-common_before() {
+before() {
+ common_before
+
mkdir -p $XDG_CONFIG_HOME/libretools
{
echo "WORKDIR='$tmpdir/workdir'"
diff --git a/test/librestage-test.sh b/test/librestage-test.sh
index 97e7df5..7e29a3a 100644
--- a/test/librestage-test.sh
+++ b/test/librestage-test.sh
@@ -5,7 +5,10 @@ describe librestage
setup_chrootdir
-common_before() {
+before() {
+ common_before
+ chroot_before
+
mkdir -p $XDG_CONFIG_HOME/libretools
echo "WORKDIR='$tmpdir/workdir'" > $XDG_CONFIG_HOME/libretools/libretools.conf
diff --git a/test/pkgbuild-check-nonfree-test.sh b/test/pkgbuild-check-nonfree-test.sh
index 0d412e8..fe7459d 100644
--- a/test/pkgbuild-check-nonfree-test.sh
+++ b/test/pkgbuild-check-nonfree-test.sh
@@ -3,7 +3,9 @@
describe pkgbuild-check-nonfree
. ./test-common.sh
-common_before() {
+before() {
+ common_before
+
mkdir -p $XDG_CONFIG_HOME/libretools
echo "BLACKLIST='phony://example.com'" >$XDG_CONFIG_HOME/libretools/libretools.conf
diff --git a/test/test-common.sh b/test/test-common.sh
index ff43344..af7900e 100755
--- a/test/test-common.sh
+++ b/test/test-common.sh
@@ -7,19 +7,7 @@ fi
# per-test setup/teardown ############################################
-_common_before() {
- :
-}
-
common_before() {
- :
-}
-
-common_after() {
- :
-}
-
-before() {
tmpdir="$(mktemp -d --tmpdir "test-${roundup_desc//\//-}.${roundup_test_name}.XXXXXXXXXXXX")"
chmod 755 "$tmpdir"
@@ -47,13 +35,9 @@ before() {
%commit
eot
export GPGKEY="$(gpg --quiet --list-secret-keys --with-colons | awk -F: '/^sec:/{print substr($5,9)}')"
-
- _common_before
- common_before
}
-after() {
- common_after
+common_after() {
gpg-connect-agent KILLAGENT /bye || true
if [[ -f "$tmpdir/.used-sudo" ]]; then
sudo rm -rf -- "$tmpdir"
@@ -62,16 +46,29 @@ after() {
fi
}
-setup_chrootdir() {
- export chrootdir="${chrootdir:-$TMPDIR/chroots}"
- _common_before() {
- mkdir -p "$XDG_CONFIG_HOME"/libretools
+before() {
+ common_before
+}
- echo "BLACKLIST=https://git.parabola.nu/blacklist.git/plain/blacklist.txt" >"$XDG_CONFIG_HOME"/libretools/libretools.conf
+after() {
+ common_after
+}
- printf 'CHROOTDIR=%q\n' "${chrootdir}" > "$XDG_CONFIG_HOME"/libretools/chroot.conf
- printf 'CHROOT=%q\n' default >> "$XDG_CONFIG_HOME"/libretools/chroot.conf
- echo "CHROOTEXTRAPKG=()" >> "$XDG_CONFIG_HOME"/libretools/chroot.conf
+chroot_before() {
+ mkdir -p "$XDG_CONFIG_HOME"/libretools
+
+ echo "BLACKLIST=https://git.parabola.nu/blacklist.git/plain/blacklist.txt" >"$XDG_CONFIG_HOME"/libretools/libretools.conf
+
+ printf 'CHROOTDIR=%q\n' "${chrootdir}" > "$XDG_CONFIG_HOME"/libretools/chroot.conf
+ printf 'CHROOT=%q\n' default >> "$XDG_CONFIG_HOME"/libretools/chroot.conf
+ echo "CHROOTEXTRAPKG=()" >> "$XDG_CONFIG_HOME"/libretools/chroot.conf
+}
+
+setup_chrootdir() {
+ export chrootdir="${chrootdir:-$TMPDIR/chroots}"
+ before() {
+ common_before
+ chroot_before
}
}