From: Dave Chinner <david@fromorbit.com>
To: fstests@vger.kernel.org
Subject: [PATCH 24/40] fstests: stop using /tmp directly
Date: Wed, 27 Nov 2024 15:51:54 +1100 [thread overview]
Message-ID: <20241127045403.3665299-25-david@fromorbit.com> (raw)
In-Reply-To: <20241127045403.3665299-1-david@fromorbit.com>
From: Dave Chinner <dchinner@redhat.com>
Tests should be using $tmp, not /tmp. this causes problems when
multiple tests all use /tmp/foo as a temporary test state file
and then step on each other.
Note that there are some tests that use /tmp to store "test stop"
files for background processes. Those that have proven to be
unreliable at stopping tests when interrupted by ctrl-c are also
updated to track and kill background processes in the cleanup
function.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
---
tests/generic/162 | 4 ++--
tests/generic/163 | 4 ++--
tests/generic/164 | 4 ++--
tests/generic/165 | 4 ++--
tests/generic/166 | 6 +++---
tests/generic/167 | 4 ++--
tests/generic/168 | 7 +++++--
tests/generic/170 | 7 +++++--
tests/generic/333 | 6 +++---
tests/generic/334 | 6 +++---
tests/generic/373 | 2 +-
tests/generic/374 | 2 +-
tests/generic/670 | 2 +-
tests/generic/671 | 2 +-
tests/generic/672 | 2 +-
tests/generic/722 | 15 ++++-----------
tests/xfs/601 | 2 +-
17 files changed, 39 insertions(+), 40 deletions(-)
diff --git a/tests/generic/162 b/tests/generic/162
index e23014f03..25d2da7e0 100755
--- a/tests/generic/162
+++ b/tests/generic/162
@@ -15,7 +15,7 @@ _register_cleanup "_cleanup" BUS
_cleanup()
{
cd /
- rm -rf $tmp.* $finished_file
+ rm -rf $tmp.*
wait
}
@@ -30,7 +30,7 @@ _scratch_mkfs > $seqres.full 2>&1
_scratch_mount >> $seqres.full 2>&1
testdir=$SCRATCH_MNT/test-$seq
-finished_file=/tmp/finished
+finished_file=$tmp.finished
rm -rf $finished_file
mkdir $testdir
diff --git a/tests/generic/163 b/tests/generic/163
index 51a00e4b7..f80d699ac 100755
--- a/tests/generic/163
+++ b/tests/generic/163
@@ -15,7 +15,7 @@ _register_cleanup "_cleanup" BUS
_cleanup()
{
cd /
- rm -rf $tmp.* $finished_file
+ rm -rf $tmp.*
wait
}
@@ -30,7 +30,7 @@ _scratch_mkfs > $seqres.full 2>&1
_scratch_mount >> $seqres.full 2>&1
testdir=$SCRATCH_MNT/test-$seq
-finished_file=/tmp/finished
+finished_file=$tmp.finished
rm -rf $finished_file
mkdir $testdir
diff --git a/tests/generic/164 b/tests/generic/164
index e5c8acd02..f38e39868 100755
--- a/tests/generic/164
+++ b/tests/generic/164
@@ -16,7 +16,7 @@ _register_cleanup "_cleanup" BUS
_cleanup()
{
cd /
- rm -rf $tmp.* $finished_file
+ rm -rf $tmp.*
wait
}
@@ -32,7 +32,7 @@ _scratch_mkfs > $seqres.full 2>&1
_scratch_mount >> $seqres.full 2>&1
testdir=$SCRATCH_MNT/test-$seq
-finished_file=/tmp/finished
+finished_file=$tmp.finished
rm -rf $finished_file
mkdir $testdir
diff --git a/tests/generic/165 b/tests/generic/165
index 0e565eb1d..128afbeaa 100755
--- a/tests/generic/165
+++ b/tests/generic/165
@@ -16,7 +16,7 @@ _register_cleanup "_cleanup" BUS
_cleanup()
{
cd /
- rm -rf $tmp.* $finished_file
+ rm -rf $tmp.*
wait
}
@@ -33,7 +33,7 @@ _scratch_mkfs > $seqres.full 2>&1
_scratch_mount >> $seqres.full 2>&1
testdir=$SCRATCH_MNT/test-$seq
-finished_file=/tmp/finished
+finished_file=$tmp.finished
rm -rf $finished_file
mkdir $testdir
diff --git a/tests/generic/166 b/tests/generic/166
index 16157571f..4e0b19170 100755
--- a/tests/generic/166
+++ b/tests/generic/166
@@ -16,7 +16,7 @@ _register_cleanup "_cleanup" BUS
_cleanup()
{
cd /
- rm -rf $tmp.* $finished_file
+ rm -rf $tmp.*
wait
}
@@ -33,8 +33,8 @@ _scratch_mkfs > $seqres.full 2>&1
_scratch_mount >> $seqres.full 2>&1
testdir=$SCRATCH_MNT/test-$seq
-finished_file=/tmp/finished
-do_snapshot=/tmp/snapshot
+finished_file=$tmp.finished
+do_snapshot=$tmp.snapshot
rm -rf $finished_file
mkdir $testdir
diff --git a/tests/generic/167 b/tests/generic/167
index 0c3e20fe2..ceb53963f 100755
--- a/tests/generic/167
+++ b/tests/generic/167
@@ -16,7 +16,7 @@ _register_cleanup "_cleanup" BUS
_cleanup()
{
cd /
- rm -rf $tmp.* $finished_file
+ rm -rf $tmp.*
wait
}
@@ -32,7 +32,7 @@ _scratch_mkfs > $seqres.full 2>&1
_scratch_mount >> $seqres.full 2>&1
testdir=$SCRATCH_MNT/test-$seq
-finished_file=/tmp/finished
+finished_file=$tmp.finished
rm -rf $finished_file
mkdir $testdir
diff --git a/tests/generic/168 b/tests/generic/168
index bd9859f73..d4b63cec8 100755
--- a/tests/generic/168
+++ b/tests/generic/168
@@ -16,7 +16,8 @@ _register_cleanup "_cleanup" BUS
_cleanup()
{
cd /
- rm -rf $tmp.* $finished_file
+ rm -rf $tmp.*
+ [ -n "$write_pid" ] && kill -9 $write_pid > /dev/null 2>&1
wait
}
@@ -31,7 +32,7 @@ _scratch_mkfs > $seqres.full 2>&1
_scratch_mount >> $seqres.full 2>&1
testdir=$SCRATCH_MNT/test-$seq
-finished_file=/tmp/finished
+finished_file=$tmp.finished
rm -rf $finished_file
mkdir $testdir
@@ -57,6 +58,7 @@ overwrite() {
echo "Reflink and write the target"
overwrite &
+write_pid=$!
seq 1 10 | while read j; do
seq 0 $nr_loops | while read i; do
_reflink_range $testdir/file1 $((i * blksz)) \
@@ -66,6 +68,7 @@ seq 1 10 | while read j; do
done
touch $finished_file
wait
+unset write_pid
# success, all done
status=0
diff --git a/tests/generic/170 b/tests/generic/170
index 35b278b9f..be9cf7a18 100755
--- a/tests/generic/170
+++ b/tests/generic/170
@@ -16,7 +16,8 @@ _register_cleanup "_cleanup" BUS
_cleanup()
{
cd /
- rm -rf $tmp.* $finished_file
+ rm -rf $tmp.*
+ [ -n "$write_pid" ] && kill -9 $write_pid > /dev/null 2>&1
wait
}
@@ -32,7 +33,7 @@ _scratch_mkfs > $seqres.full 2>&1
_scratch_mount >> $seqres.full 2>&1
testdir=$SCRATCH_MNT/test-$seq
-finished_file=/tmp/finished
+finished_file=$tmp.finished
rm -rf $finished_file
mkdir $testdir
@@ -58,6 +59,7 @@ overwrite() {
echo "Reflink and dio write the target"
overwrite &
+write_pid=$!
seq 1 10 | while read j; do
seq 0 $nr_loops | while read i; do
_reflink_range $testdir/file1 $((i * blksz)) \
@@ -67,6 +69,7 @@ seq 1 10 | while read j; do
done
touch $finished_file
wait
+unset write_pid
# success, all done
status=0
diff --git a/tests/generic/333 b/tests/generic/333
index 03a7bcd0e..220614147 100755
--- a/tests/generic/333
+++ b/tests/generic/333
@@ -16,7 +16,7 @@ _register_cleanup "_cleanup" BUS
_cleanup()
{
cd /
- rm -rf $tmp.* $finished_file $abort_file
+ rm -rf $tmp.*
wait
}
@@ -33,9 +33,9 @@ _scratch_mkfs_sized $((400 * 1048576)) > $seqres.full 2>&1
_scratch_mount >> $seqres.full 2>&1
testdir=$SCRATCH_MNT/test-$seq
-finished_file=/tmp/finished
+finished_file=$tmp.finished
rm -rf $finished_file
-abort_file=/tmp/abort
+abort_file=$tmp.abort
rm -rf $abort_file
mkdir $testdir
diff --git a/tests/generic/334 b/tests/generic/334
index 3f9718476..0faa5d696 100755
--- a/tests/generic/334
+++ b/tests/generic/334
@@ -16,7 +16,7 @@ _register_cleanup "_cleanup" BUS
_cleanup()
{
cd /
- rm -rf $tmp.* $finished_file $abort_file
+ rm -rf $tmp.*
wait
}
@@ -32,9 +32,9 @@ _scratch_mkfs_sized $((400 * 1048576)) > $seqres.full 2>&1
_scratch_mount >> $seqres.full 2>&1
testdir=$SCRATCH_MNT/test-$seq
-finished_file=/tmp/finished
+finished_file=$tmp.finished
rm -rf $finished_file
-abort_file=/tmp/abort
+abort_file=$tmp.abort
rm -rf $abort_file
mkdir $testdir
diff --git a/tests/generic/373 b/tests/generic/373
index e6334398f..04ec64251 100755
--- a/tests/generic/373
+++ b/tests/generic/373
@@ -32,7 +32,7 @@ _scratch_mount >> $seqres.full 2>&1
testdir=$SCRATCH_MNT/test-$seq
mkdir $testdir
-otherdir=/tmp/m.$seq
+otherdir=$tmp.m.$seq
othertestdir=$otherdir/test-$seq
rm -rf $otherdir
mkdir $otherdir
diff --git a/tests/generic/374 b/tests/generic/374
index e56521aa0..9a85091e2 100755
--- a/tests/generic/374
+++ b/tests/generic/374
@@ -31,7 +31,7 @@ _scratch_mount >> $seqres.full 2>&1
testdir=$SCRATCH_MNT/test-$seq
mkdir $testdir
-otherdir=/tmp/m.$seq
+otherdir=$tmp.m.$seq
othertestdir=$otherdir/test-$seq
rm -rf $otherdir
mkdir $otherdir
diff --git a/tests/generic/670 b/tests/generic/670
index 67a8f6fe2..f32199e70 100755
--- a/tests/generic/670
+++ b/tests/generic/670
@@ -23,7 +23,7 @@ _scratch_mkfs > $seqres.full 2>&1
_scratch_mount >> $seqres.full 2>&1
testdir=$SCRATCH_MNT/test-$seq
-finished_file=/tmp/finished
+finished_file=$tmp.finished
rm -rf $finished_file
mkdir $testdir
diff --git a/tests/generic/671 b/tests/generic/671
index f20069113..3abe12274 100755
--- a/tests/generic/671
+++ b/tests/generic/671
@@ -23,7 +23,7 @@ _scratch_mkfs > $seqres.full 2>&1
_scratch_mount >> $seqres.full 2>&1
testdir=$SCRATCH_MNT/test-$seq
-finished_file=/tmp/finished
+finished_file=$tmp.finished
rm -rf $finished_file
mkdir $testdir
diff --git a/tests/generic/672 b/tests/generic/672
index 832907de3..a5e65042e 100755
--- a/tests/generic/672
+++ b/tests/generic/672
@@ -22,7 +22,7 @@ _scratch_mkfs > $seqres.full 2>&1
_scratch_mount >> $seqres.full 2>&1
testdir=$SCRATCH_MNT/test-$seq
-finished_file=/tmp/finished
+finished_file=$tmp.finished
rm -rf $finished_file
mkdir $testdir
diff --git a/tests/generic/722 b/tests/generic/722
index 5542c045f..b9c608713 100755
--- a/tests/generic/722
+++ b/tests/generic/722
@@ -10,13 +10,6 @@
. ./common/preamble
_begin_fstest auto quick fiexchange
-# Override the default cleanup function.
-_cleanup()
-{
- cd /
- rm -r -f $tmp.* $dir
-}
-
# Import common functions.
. ./common/filter
. ./common/reflink
@@ -38,8 +31,8 @@ old_a=$(md5sum $SCRATCH_MNT/a | awk '{print $1}')
old_b=$(md5sum $SCRATCH_MNT/b | awk '{print $1}')
echo "md5 a: $old_a md5 b: $old_b" >> $seqres.full
-od -tx1 -Ad -c $SCRATCH_MNT/a > /tmp/a0
-od -tx1 -Ad -c $SCRATCH_MNT/b > /tmp/b0
+od -tx1 -Ad -c $SCRATCH_MNT/a > $tmp.a0
+od -tx1 -Ad -c $SCRATCH_MNT/b > $tmp.b0
echo swap >> $seqres.full
$XFS_IO_PROG -c "exchangerange -f $SCRATCH_MNT/a" $SCRATCH_MNT/b
@@ -53,8 +46,8 @@ echo "md5 a: $new_a md5 b: $new_b" >> $seqres.full
test $old_a = $new_b || echo "scratch file B doesn't match old file A"
test $old_b = $new_a || echo "scratch file A doesn't match old file B"
-od -tx1 -Ad -c $SCRATCH_MNT/a > /tmp/a1
-od -tx1 -Ad -c $SCRATCH_MNT/b > /tmp/b1
+od -tx1 -Ad -c $SCRATCH_MNT/a > $tmp.a1
+od -tx1 -Ad -c $SCRATCH_MNT/b > $tmp.b1
# success, all done
echo Silence is golden
diff --git a/tests/xfs/601 b/tests/xfs/601
index bc8fa719b..df382402b 100755
--- a/tests/xfs/601
+++ b/tests/xfs/601
@@ -15,7 +15,7 @@ _register_cleanup "_cleanup" BUS
_cleanup()
{
cd /
- rm -rf $tmp.* $testdir
+ rm -rf $tmp.*
}
# Import common functions.
--
2.45.2
next prev parent reply other threads:[~2024-11-27 5:00 UTC|newest]
Thread overview: 65+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-27 4:51 [RFC PATCH 00/40] fstests: concurrent test execution Dave Chinner
2024-11-27 4:51 ` [PATCH 01/40] xfs/448: get rid of assert-on-failure Dave Chinner
2024-11-27 4:51 ` [PATCH 02/40] fstests: cleanup fsstress process management Dave Chinner
2024-11-29 4:03 ` Zorro Lang
2024-12-04 17:57 ` Zorro Lang
2024-12-05 4:42 ` Dave Chinner
2024-12-05 9:57 ` Zorro Lang
2024-12-04 18:04 ` Zorro Lang
2024-12-05 4:55 ` Dave Chinner
2024-12-05 10:05 ` Zorro Lang
2024-11-27 4:51 ` [PATCH 03/40] fuzzy: don't use killall Dave Chinner
2024-11-27 4:51 ` [PATCH 04/40] fstests: per-test dmflakey instances Dave Chinner
2024-11-27 4:51 ` [PATCH 05/40] fstests: per-test dmerror instances Dave Chinner
2024-11-27 4:51 ` [PATCH 06/40] fstests: per-test dmhuge instances Dave Chinner
2024-11-27 4:51 ` [PATCH 07/40] fstests: per-test dmthin instances Dave Chinner
2024-11-27 4:51 ` [PATCH 08/40] fstests: per-test dmdust instances Dave Chinner
2024-11-27 4:51 ` [PATCH 09/40] fstests: per-test dmdelay instances Dave Chinner
2024-11-27 4:51 ` [PATCH 10/40] fstests: fix DM device creation/removal vs udev races Dave Chinner
2024-11-27 4:51 ` [PATCH 11/40] fstests: use syncfs rather than sync Dave Chinner
2024-11-27 4:51 ` [PATCH 12/40] fstests: clean up mount and unmount operations Dave Chinner
2024-11-27 4:51 ` [PATCH 13/40] fstests: clean up loop device instantiation Dave Chinner
2024-12-01 12:31 ` Zorro Lang
2024-12-01 12:50 ` Zorro Lang
2024-12-07 12:44 ` Zorro Lang
2024-12-07 18:59 ` Zorro Lang
2024-12-07 19:51 ` Zorro Lang
2024-11-27 4:51 ` [PATCH 14/40] fstests: xfs/227 is really slow Dave Chinner
2024-11-27 4:51 ` [PATCH 15/40] fstests: mark tests that are unreliable when run in parallel Dave Chinner
2024-11-27 4:51 ` [PATCH 16/40] fstests: use udevadm wait in preference to settle Dave Chinner
2024-11-29 17:10 ` Darrick J. Wong
2024-11-29 22:33 ` Dave Chinner
2024-11-30 2:34 ` Zorro Lang
2024-11-27 4:51 ` [PATCH 17/40] xfs/442: rescale load so it's not exponential Dave Chinner
2024-11-27 4:51 ` [PATCH 18/40] xfs/176: fix broken setup code Dave Chinner
2024-11-27 4:51 ` [PATCH 19/40] xfs/177: remove unused slab object count location checks Dave Chinner
2024-11-27 4:51 ` [PATCH 20/40] fstests: remove uses of killall where possible Dave Chinner
2024-11-27 4:51 ` [PATCH 21/40] generic/127: reduce runtime Dave Chinner
2024-11-27 4:51 ` [PATCH 22/40] quota: system project quota files need to be shared Dave Chinner
2024-11-27 4:51 ` [PATCH 23/40] dmesg: reduce noise from other tests Dave Chinner
2024-11-27 4:51 ` Dave Chinner [this message]
2024-11-27 4:51 ` [PATCH 25/40] fstests: scale some tests for high CPU count sanity Dave Chinner
2024-11-29 3:34 ` Zorro Lang
2024-11-27 4:51 ` [PATCH 26/40] generic/310: cleanup killing background processes Dave Chinner
2024-11-27 4:51 ` [PATCH 27/40] filter: handle mount errors from CONFIG_BLK_DEV_WRITE_MOUNTED=y Dave Chinner
2024-11-27 4:51 ` [PATCH 28/40] filters: add a filter that accepts EIO instead of other errors Dave Chinner
2024-11-27 4:51 ` [PATCH 29/40] generic/085: general cleanup for reliability and debugging Dave Chinner
2024-11-27 4:52 ` [PATCH 30/40] fstests: don't use directory stacks Dave Chinner
2024-12-01 12:10 ` Zorro Lang
2024-12-01 21:37 ` Dave Chinner
2024-11-27 4:52 ` [PATCH 31/40] fstests: clean up a couple of dm-flakey tests Dave Chinner
2024-11-27 4:52 ` [PATCH 32/40] fstests: clean up termination of various tests Dave Chinner
2024-11-27 4:52 ` [PATCH 33/40] vfstests: some tests require the testdir to be shared Dave Chinner
2024-11-27 4:52 ` [PATCH 34/40] xfs/629: single extent files should be within tolerance Dave Chinner
2024-11-27 4:52 ` [PATCH 35/40] xfs/076: fix broken mkfs filtering Dave Chinner
2024-11-27 4:52 ` [PATCH 36/40] fstests: capture some failures to seqres.full Dave Chinner
2024-11-27 4:52 ` [PATCH 37/40] fstests: always use fail-at-unmount semantics for XFS Dave Chinner
2024-11-27 4:52 ` [PATCH 38/40] generic/062: don't leave debug files in $here on failure Dave Chinner
2024-11-27 4:52 ` [PATCH 39/40] fstests: quota grace periods unreliable under load Dave Chinner
2024-11-27 4:52 ` [PATCH 40/40] fstests: check-parallel Dave Chinner
2024-11-29 4:22 ` [RFC PATCH 00/40] fstests: concurrent test execution Zorro Lang
2024-12-07 0:09 ` Darrick J. Wong
2024-12-07 9:38 ` Zorro Lang
2024-12-08 0:02 ` Dave Chinner
2024-12-08 6:15 ` Zorro Lang
2024-12-10 0:55 ` Dave Chinner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241127045403.3665299-25-david@fromorbit.com \
--to=david@fromorbit.com \
--cc=fstests@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox