From c78e5ddfc8aa0a6373b063dd787f416e9de8002e Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Thu, 19 Oct 2023 09:31:33 -0400 Subject: tests: New defer function --- tests/gnu/fstype_stacked.sh | 4 ++-- tests/gnu/fstype_umount.sh | 2 +- tests/gnu/inum_automount.sh | 2 +- tests/gnu/printf_Y_error.sh | 2 +- tests/gnu/xtype_bind_mount.sh | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) (limited to 'tests/gnu') diff --git a/tests/gnu/fstype_stacked.sh b/tests/gnu/fstype_stacked.sh index 16f428f..a4b067a 100644 --- a/tests/gnu/fstype_stacked.sh +++ b/tests/gnu/fstype_stacked.sh @@ -4,9 +4,9 @@ clean_scratch mkdir scratch/mnt bfs_sudo mount -t tmpfs tmpfs scratch/mnt || skip -trap "bfs_sudo umount scratch/mnt" EXIT +defer bfs_sudo umount scratch/mnt bfs_sudo mount -t ramfs ramfs scratch/mnt || skip -trap "bfs_sudo umount scratch/mnt; bfs_sudo umount scratch/mnt" EXIT +defer bfs_sudo umount scratch/mnt bfs_diff scratch/mnt -fstype ramfs -print -o -printf '%p: %F\n' diff --git a/tests/gnu/fstype_umount.sh b/tests/gnu/fstype_umount.sh index e817831..b6da7a3 100644 --- a/tests/gnu/fstype_umount.sh +++ b/tests/gnu/fstype_umount.sh @@ -4,7 +4,7 @@ clean_scratch mkdir scratch/tmp bfs_sudo mount -t tmpfs tmpfs scratch/tmp || skip -trap "bfs_sudo umount -R scratch/tmp" EXIT +defer bfs_sudo umount -R scratch/tmp mkdir scratch/tmp/ram bfs_sudo mount -t ramfs ramfs scratch/tmp/ram || skip diff --git a/tests/gnu/inum_automount.sh b/tests/gnu/inum_automount.sh index c4450ef..261a4be 100644 --- a/tests/gnu/inum_automount.sh +++ b/tests/gnu/inum_automount.sh @@ -6,7 +6,7 @@ clean_scratch mkdir scratch/{foo,automnt} bfs_sudo systemd-mount -A -o bind basic scratch/automnt || skip -trap "bfs_sudo systemd-umount scratch/automnt" EXIT +defer bfs_sudo systemd-umount scratch/automnt before=$(inum scratch/automnt) bfs_diff scratch -inum "$before" -prune diff --git a/tests/gnu/printf_Y_error.sh b/tests/gnu/printf_Y_error.sh index 3aa816e..13d52e3 100644 --- a/tests/gnu/printf_Y_error.sh +++ b/tests/gnu/printf_Y_error.sh @@ -3,6 +3,6 @@ mkdir scratch/foo ln -s foo/bar scratch/bar chmod -x scratch/foo -trap "chmod +x scratch/foo" EXIT +defer chmod +x scratch/foo ! bfs_diff scratch -printf '(%p) (%l) %y %Y\n' diff --git a/tests/gnu/xtype_bind_mount.sh b/tests/gnu/xtype_bind_mount.sh index 99a11ab..1cc20ec 100644 --- a/tests/gnu/xtype_bind_mount.sh +++ b/tests/gnu/xtype_bind_mount.sh @@ -5,6 +5,6 @@ clean_scratch ln -s /dev/null scratch/link bfs_sudo mount --bind /dev/null scratch/null || skip -trap "bfs_sudo umount scratch/null" EXIT +defer bfs_sudo umount scratch/null bfs_diff -L scratch -type c -- cgit v1.2.3