summaryrefslogtreecommitdiff
path: root/test/librechroot-test.sh
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2014-01-05 18:39:47 -0500
committerLuke Shumaker <LukeShu@sbcglobal.net>2014-01-05 18:50:17 -0500
commitfa6e7ccf3914081504681679645fd7cfd803cfdd (patch)
tree021ae0f16368db8b4be9c3b6bcc6cec949e9522e /test/librechroot-test.sh
parentb07f84783a9b3e4e799e93173977882de6c16fa8 (diff)
test/: re-jigger the chroot tests to be fast on btrfs
Diffstat (limited to 'test/librechroot-test.sh')
-rw-r--r--test/librechroot-test.sh24
1 files changed, 14 insertions, 10 deletions
diff --git a/test/librechroot-test.sh b/test/librechroot-test.sh
index 5ca1b37..442abed 100644
--- a/test/librechroot-test.sh
+++ b/test/librechroot-test.sh
@@ -4,30 +4,34 @@ describe librechroot
. ./test-common.sh
+_setup_chrootdir
+
before() {
_before librechroot
+
mkdir -p "$XDG_CONFIG_HOME"/libretools
- echo "CHROOTDIR='$tmpdir/chrootdir'" > "$XDG_CONFIG_HOME"/libretools/chroot.conf
+
+ echo "CHROOTDIR='${chrootdir}'" > "$XDG_CONFIG_HOME"/libretools/chroot.conf
echo "CHROOT='default'" >> "$XDG_CONFIG_HOME"/libretools/chroot.conf
echo "CHROOTEXTRAPKG=()" >> "$XDG_CONFIG_HOME"/libretools/chroot.conf
}
-after() {
+after() (
_after_sudo
-}
+)
it_creates_repo_for_new_chroots() {
require network sudo || return 0
libremessages msg 'Creating a chroot, may take a few minutes' &>/dev/tty
- testsudo librechroot run test -r /repo/repo.db
+ testsudo librechroot -l "$roundup_test_name" run test -r /repo/repo.db
}
it_cleans_the_local_repo_correctly() {
require network sudo || return 0
libremessages msg 'Creating a chroot, may take a few minutes' &>/dev/tty
- testsudo librechroot make
- testsudo librechroot clean-repo
- testsudo librechroot run test -r /repo/repo.db
+ testsudo librechroot -l "$roundup_test_name" make
+ testsudo librechroot -l "$roundup_test_name" clean-repo
+ testsudo librechroot -l "$roundup_test_name" run test -r /repo/repo.db
# TODO: inspect /repo/* more
}
@@ -36,7 +40,7 @@ it_respects_exit_status_if_out_isnt_a_tty() (
set -o pipefail
libremessages msg 'Creating a chroot, may take a few minutes' &>/dev/tty
r=0
- { testsudo librechroot run exit 3 | cat; } || r=$?
+ { testsudo librechroot -l "$roundup_test_name" run exit 3 | cat; } || r=$?
[[ $r == 3 ]]
)
@@ -49,7 +53,7 @@ it_displays_help_as_normal_user() {
}
it_otherwise_fails_as_normal_user() {
- librechroot run true >$tmpdir/stdout 2>$tmpdir/stderr || stat=$?
+ librechroot -l "$roundup_test_name" run true >$tmpdir/stdout 2>$tmpdir/stderr || stat=$?
[[ $stat != 0 ]]
empty $tmpdir/stdout
@@ -57,7 +61,7 @@ it_otherwise_fails_as_normal_user() {
}
it_displays_help_and_fails_with_0_args() {
- LC_ALL=C librechroot >$tmpdir/stdout 2>$tmpdir/stderr || stat=$?
+ LC_ALL=C librechroot -l "$roundup_test_name" >$tmpdir/stdout 2>$tmpdir/stderr || stat=$?
[[ $stat != 0 ]]
empty $tmpdir/stdout