From 3175d796876c476a872af3a267a49efe03f10596 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sat, 29 Sep 2018 20:50:52 -0400 Subject: test: test-common.sh: Roll chroot_before in to common_before The big reason for having it separate was that we needed to install an expensive after(). But, since that part of cleanup is now owned by testenv, that's not a concern. --- test/librechroot-test.sh | 2 -- test/libremakepkg-test.sh | 2 -- test/librestage-test.sh | 3 --- test/test-common.sh | 29 +++++++++++------------------ 4 files changed, 11 insertions(+), 25 deletions(-) diff --git a/test/librechroot-test.sh b/test/librechroot-test.sh index 31f9237..e476f6f 100644 --- a/test/librechroot-test.sh +++ b/test/librechroot-test.sh @@ -3,8 +3,6 @@ describe librechroot . ./test-common.sh -setup_chrootdir - it_creates_repo_for_new_chroots() { require network sudo || return 0 libremessages msg 'Creating a chroot, may take a few minutes' &>/dev/tty diff --git a/test/libremakepkg-test.sh b/test/libremakepkg-test.sh index 58adcca..ce3aa80 100644 --- a/test/libremakepkg-test.sh +++ b/test/libremakepkg-test.sh @@ -3,8 +3,6 @@ describe libremakepkg . ./test-common.sh -setup_chrootdir - it_builds_a_trivial_package() { require network sudo || return 0 cp libremakepkg.d/PKGBUILD-hello "$tmpdir/PKGBUILD" diff --git a/test/librestage-test.sh b/test/librestage-test.sh index 7e29a3a..8caf5d6 100644 --- a/test/librestage-test.sh +++ b/test/librestage-test.sh @@ -3,11 +3,8 @@ describe librestage . ./test-common.sh -setup_chrootdir - 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/test-common.sh b/test/test-common.sh index af7900e..478694c 100755 --- a/test/test-common.sh +++ b/test/test-common.sh @@ -35,6 +35,17 @@ common_before() { %commit eot export GPGKEY="$(gpg --quiet --list-secret-keys --with-colons | awk -F: '/^sec:/{print substr($5,9)}')" + + # Configure libretools + export chrootdir="${chrootdir:-$TMPDIR/chroots}" + + 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 } common_after() { @@ -54,24 +65,6 @@ after() { common_after } -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 - } -} - # Utility functions for use in test definitions ###################### require() ( -- cgit v1.2.2