diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2017-02-14 15:26:13 -0500 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2017-02-14 16:04:24 -0500 |
commit | 3b76f7dbfcec18ad22663663acf0355a61f4eb60 (patch) | |
tree | 01a9a31c6ea9116bd933a39dd530491ddf791356 /test | |
parent | 05fc5ece05f10b593c378c0b5f1170107dcfe1b6 (diff) |
Add librechroot delete tests.
Diffstat (limited to 'test')
-rw-r--r-- | test/librechroot-test.sh | 22 | ||||
-rw-r--r-- | test/test-common.sh | 3 |
2 files changed, 25 insertions, 0 deletions
diff --git a/test/librechroot-test.sh b/test/librechroot-test.sh index 667246c..51a43bd 100644 --- a/test/librechroot-test.sh +++ b/test/librechroot-test.sh @@ -127,3 +127,25 @@ it_fails_when_syncing_a_copy_with_itself() { true;; esac } + +it_deletes_copies() { + require network sudo || return 0 + libremessages msg 'Creating a chroot, may take a few minutes' &>/dev/tty + testsudo librechroot -l "$roundup_test_name" make + test -d "$chrootdir/default/$roundup_test_name" + testsudo librechroot -l "$roundup_test_name" delete + not test -e "$chrootdir/default/$roundup_test_name" +} + +it_deletes_subvolumes_recursively() { + require network sudo btrfs || return 0 + libremessages msg 'Creating a chroot, may take a few minutes' &>/dev/tty + testsudo librechroot -l "$roundup_test_name" make + testsudo librechroot -l "$roundup_test_name" install-name btrfs-progs + test -d "$chrootdir/default/$roundup_test_name" + not test -e "$chrootdir/default/$roundup_test_name/var/subvolume" + testsudo librechroot -l "$roundup_test_name" run btrfs subvolume create /var/subvolume + test -d "$chrootdir/default/$roundup_test_name/var/subvolume" + testsudo librechroot -l "$roundup_test_name" delete + not test -e "$chrootdir/default/$roundup_test_name" +} diff --git a/test/test-common.sh b/test/test-common.sh index 2a8fc37..40e1377 100644 --- a/test/test-common.sh +++ b/test/test-common.sh @@ -59,6 +59,9 @@ require() ( 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 libremessages warning "Next test requires %s; Skipping (passing)..." "$(echo "${missing[*]}"|sed 's/ /, /g')" &>/dev/tty return 1 |