summaryrefslogtreecommitdiffstats
path: root/tests/posix
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2023-10-22 16:41:41 -0400
committerTavian Barnes <tavianator@tavianator.com>2023-10-22 17:51:36 -0400
commita2af2746c4686201e2e0796fbdfa115d08727b86 (patch)
tree4127a4c813de4f4c91c92b0596b468cceac43a7b /tests/posix
parentdd8ac68070176343a8781e67de4bbd6a071bb89d (diff)
downloadbfs-a2af2746c4686201e2e0796fbdfa115d08727b86.tar.xz
tests: Use test-specific scratch directories
Diffstat (limited to 'tests/posix')
-rw-r--r--tests/posix/L_xdev.out10
-rw-r--r--tests/posix/L_xdev.sh16
-rw-r--r--tests/posix/depth_error.out4
-rw-r--r--tests/posix/depth_error.sh10
-rw-r--r--tests/posix/overlayfs.out10
-rw-r--r--tests/posix/overlayfs.sh14
-rw-r--r--tests/posix/readdir_error.sh18
-rw-r--r--tests/posix/type_bind_mount.out2
-rw-r--r--tests/posix/type_bind_mount.sh10
-rw-r--r--tests/posix/unionfs.out20
-rw-r--r--tests/posix/unionfs.sh13
-rw-r--r--tests/posix/xdev.out8
-rw-r--r--tests/posix/xdev.sh12
13 files changed, 75 insertions, 72 deletions
diff --git a/tests/posix/L_xdev.out b/tests/posix/L_xdev.out
index 2e80082..788579d 100644
--- a/tests/posix/L_xdev.out
+++ b/tests/posix/L_xdev.out
@@ -1,5 +1,5 @@
-scratch
-scratch/foo
-scratch/foo/bar
-scratch/foo/qux
-scratch/mnt
+.
+./foo
+./foo/bar
+./foo/qux
+./mnt
diff --git a/tests/posix/L_xdev.sh b/tests/posix/L_xdev.sh
index d16c211..82d8605 100644
--- a/tests/posix/L_xdev.sh
+++ b/tests/posix/L_xdev.sh
@@ -1,13 +1,13 @@
test "$UNAME" = "Darwin" && skip
-clean_scratch
-mkdir scratch/{foo,mnt}
+cd "$TEST"
+mkdir foo mnt
-bfs_sudo mount -t tmpfs tmpfs scratch/mnt || skip
-defer bfs_sudo umount scratch/mnt
+bfs_sudo mount -t tmpfs tmpfs mnt || skip
+defer bfs_sudo umount mnt
-ln -s ../mnt scratch/foo/bar
-"$XTOUCH" scratch/mnt/baz
-ln -s ../mnt/baz scratch/foo/qux
+ln -s ../mnt foo/bar
+"$XTOUCH" mnt/baz
+ln -s ../mnt/baz foo/qux
-bfs_diff -L scratch -xdev
+bfs_diff -L . -xdev
diff --git a/tests/posix/depth_error.out b/tests/posix/depth_error.out
index ed0e9a1..7ed5f0d 100644
--- a/tests/posix/depth_error.out
+++ b/tests/posix/depth_error.out
@@ -1,2 +1,2 @@
-scratch
-scratch/foo
+.
+./foo
diff --git a/tests/posix/depth_error.sh b/tests/posix/depth_error.sh
index a6429d1..db414ba 100644
--- a/tests/posix/depth_error.sh
+++ b/tests/posix/depth_error.sh
@@ -1,7 +1,7 @@
-clean_scratch
-"$XTOUCH" -p scratch/foo/bar
+cd "$TEST"
+"$XTOUCH" -p foo/bar
-chmod a-r scratch/foo
-defer chmod +r scratch/foo
+chmod a-r foo
+defer chmod +r foo
-! bfs_diff scratch -depth
+! bfs_diff . -depth
diff --git a/tests/posix/overlayfs.out b/tests/posix/overlayfs.out
index 754d01d..b472b56 100644
--- a/tests/posix/overlayfs.out
+++ b/tests/posix/overlayfs.out
@@ -1,5 +1,5 @@
-scratch/merged
-scratch/merged/bar
-scratch/merged/baz
-scratch/merged/baz/qux
-scratch/merged/foo
+merged
+merged/bar
+merged/baz
+merged/baz/qux
+merged/foo
diff --git a/tests/posix/overlayfs.sh b/tests/posix/overlayfs.sh
index 4cccebf..21ef22f 100644
--- a/tests/posix/overlayfs.sh
+++ b/tests/posix/overlayfs.sh
@@ -1,11 +1,11 @@
test "$UNAME" = "Linux" || skip
-clean_scratch
-"$XTOUCH" -p scratch/{lower/{foo,bar,baz},upper/{bar,baz/qux}}
+cd "$TEST"
+"$XTOUCH" -p lower/{foo,bar,baz} upper/{bar,baz/qux}
-mkdir -p scratch/{work,merged}
-bfs_sudo mount -t overlay overlay -olowerdir=scratch/lower,upperdir=scratch/upper,workdir=scratch/work scratch/merged || skip
-defer bfs_sudo rm -rf scratch/work
-defer bfs_sudo umount scratch/merged
+mkdir -p work merged
+bfs_sudo mount -t overlay overlay -olowerdir=lower,upperdir=upper,workdir=work merged || skip
+defer bfs_sudo rm -rf work
+defer bfs_sudo umount merged
-bfs_diff scratch/merged
+bfs_diff merged
diff --git a/tests/posix/readdir_error.sh b/tests/posix/readdir_error.sh
index fc48eb1..82fcd17 100644
--- a/tests/posix/readdir_error.sh
+++ b/tests/posix/readdir_error.sh
@@ -1,27 +1,27 @@
test "$UNAME" = "Linux" || skip
-clean_scratch
-mkfifo scratch/{fever,pid,wait,running}
+cd "$TEST"
+mkfifo hang pid wait running
(
# Create a zombie process
- cat scratch/fever >/dev/null &
- # Write the PID to scratch/pid
- echo $! >scratch/pid
+ cat hang >/dev/null &
+ # Write the PID to pid
+ echo $! >pid
# Don't wait on the zombie process
- exec cat scratch/wait scratch/fever >scratch/running
+ exec cat wait hang >running
) &
# Kill the parent cat on exit
defer kill -9 %1
# Read the child PID
-read -r pid <scratch/pid
+read -r pid <pid
# Make sure the parent cat is running before we kill the child, because bash
# will wait() on its children
-echo >scratch/wait &
-read -r _ <scratch/running
+echo >wait &
+read -r _ <running
# Turn the child into a zombie
kill -9 "$pid"
diff --git a/tests/posix/type_bind_mount.out b/tests/posix/type_bind_mount.out
index 6435159..2f06c47 100644
--- a/tests/posix/type_bind_mount.out
+++ b/tests/posix/type_bind_mount.out
@@ -1 +1 @@
-scratch/null
+./null
diff --git a/tests/posix/type_bind_mount.sh b/tests/posix/type_bind_mount.sh
index 7852167..97b7305 100644
--- a/tests/posix/type_bind_mount.sh
+++ b/tests/posix/type_bind_mount.sh
@@ -1,9 +1,9 @@
test "$UNAME" = "Linux" || skip
-clean_scratch
-"$XTOUCH" scratch/{file,null}
+cd "$TEST"
+"$XTOUCH" file null
-bfs_sudo mount --bind /dev/null scratch/null || skip
-defer bfs_sudo umount scratch/null
+bfs_sudo mount --bind /dev/null null || skip
+defer bfs_sudo umount null
-bfs_diff scratch -type c
+bfs_diff . -type c
diff --git a/tests/posix/unionfs.out b/tests/posix/unionfs.out
index 6d0fa3c..28c4ec1 100644
--- a/tests/posix/unionfs.out
+++ b/tests/posix/unionfs.out
@@ -1,10 +1,10 @@
-scratch
-scratch/lower
-scratch/lower/bar
-scratch/lower/baz
-scratch/lower/foo
-scratch/upper
-scratch/upper/bar
-scratch/upper/baz
-scratch/upper/baz/qux
-scratch/upper/foo
+.
+./lower
+./lower/bar
+./lower/baz
+./lower/foo
+./upper
+./upper/bar
+./upper/baz
+./upper/baz/qux
+./upper/foo
diff --git a/tests/posix/unionfs.sh b/tests/posix/unionfs.sh
index 0f68a43..94d3929 100644
--- a/tests/posix/unionfs.sh
+++ b/tests/posix/unionfs.sh
@@ -1,6 +1,9 @@
[[ "$UNAME" == *BSD* ]] || skip
-clean_scratch
-"$XTOUCH" -p scratch/{lower/{foo,bar,baz},upper/{bar,baz/qux}}
-bfs_sudo mount -t unionfs -o below scratch/{lower,upper} || skip
-defer bfs_sudo umount scratch/upper
-bfs_diff scratch
+
+cd "$TEST"
+"$XTOUCH" -p lower/{foo,bar,baz} upper/{bar,baz/qux}
+
+bfs_sudo mount -t unionfs -o below lower upper || skip
+defer bfs_sudo umount upper
+
+bfs_diff .
diff --git a/tests/posix/xdev.out b/tests/posix/xdev.out
index f7839fb..6253434 100644
--- a/tests/posix/xdev.out
+++ b/tests/posix/xdev.out
@@ -1,4 +1,4 @@
-scratch
-scratch/foo
-scratch/foo/bar
-scratch/mnt
+.
+./foo
+./foo/bar
+./mnt
diff --git a/tests/posix/xdev.sh b/tests/posix/xdev.sh
index 461a1e9..c59c5c8 100644
--- a/tests/posix/xdev.sh
+++ b/tests/posix/xdev.sh
@@ -1,11 +1,11 @@
test "$UNAME" = "Darwin" && skip
-clean_scratch
-mkdir scratch/{foo,mnt}
+cd "$TEST"
+mkdir foo mnt
-bfs_sudo mount -t tmpfs tmpfs scratch/mnt || skip
-defer bfs_sudo umount scratch/mnt
+bfs_sudo mount -t tmpfs tmpfs mnt || skip
+defer bfs_sudo umount mnt
-"$XTOUCH" scratch/foo/bar scratch/mnt/baz
+"$XTOUCH" foo/bar mnt/baz
-bfs_diff scratch -xdev
+bfs_diff . -xdev