From e8f1b2c68d45a8ffd655cd57835f7391e5253760 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 10 Apr 2017 22:31:59 -0400 Subject: test/test-common.sh: Improve btrfs-aware rm-rf cleanup --- test/test-common.sh | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/test/test-common.sh b/test/test-common.sh index f81738a..ed3bdd0 100644 --- a/test/test-common.sh +++ b/test/test-common.sh @@ -53,12 +53,9 @@ _cleanup_chrootdir() ( chrootdir=$1 shopt -s nullglob if [[ $SUDO ]]; then - local chroottype=$(stat -f -c %T "$chrootdir") - if [[ "$chroottype" == btrfs ]]; then - sudo find "$chrootdir" -type d -print0 | - LC_ALL=C sort -rz | - xargs -r0 sudo -n \ - btrfs subvolume delete &>/dev/null || true + if [[ "$(stat -f -c %T "$chrootdir")" == btrfs ]]; then + sudo find "$chrootdir" -depth -inum 256 -exec \ + btrfs subvolume delete {} \; &>/dev/null fi sudo rm -rf -- "$chrootdir" else -- cgit v1.2.3-54-g00ecf