summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/librechroot-test.sh22
-rw-r--r--test/test-common.sh3
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