diff options
Diffstat (limited to 'test/lib/common.bash')
-rw-r--r-- | test/lib/common.bash | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/lib/common.bash b/test/lib/common.bash index 88aff4e..c55ebc5 100644 --- a/test/lib/common.bash +++ b/test/lib/common.bash @@ -65,6 +65,20 @@ common_teardown() { else rm -rf -- "$tmpdir" fi + # Clean up non-root chroots. On btrfs it wouldn't be terrible + # to wait until the end because CoW means that they don't take + # up much space, but on other filesystems, we don't want to + # require such a large disk. + local dir + for dir in "$chrootdir"/*/*/; do + if [[ -d $dir && $dir != */root/ ]]; then + if [[ "$(stat -f -c %T "$dir")" == btrfs ]]; then + sudo find "$dir" -depth -inum 256 -exec \ + btrfs subvolume delete {} \; &>/dev/null + fi + sudo rm -rf -- "$dir" + fi + done } setup() { |