diff options
Diffstat (limited to 'test/test-common.sh')
-rwxr-xr-x | test/test-common.sh | 47 |
1 files changed, 22 insertions, 25 deletions
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 } } |