generic/561: hide assertions when duperemove is killed
authorDarrick J. Wong <djwong@kernel.org>
Tue, 20 Jul 2021 01:08:29 +0000 (18:08 -0700)
committerEryu Guan <guaneryu@gmail.com>
Thu, 22 Jul 2021 15:44:13 +0000 (23:44 +0800)
Use some bash redirection trickery to capture in $seqres.full all of
bash's warnings about duperemove being killed due to assertions
triggering.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Allison Henderson <allison.henderson@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
tests/generic/561

index bfd4443de707d26db2f27dcd7879933d00cdff52..44f078022f965afb31276c1f33721a9a3c8affc1 100755 (executable)
@@ -62,8 +62,13 @@ dupe_run=$TEST_DIR/${seq}-running
 touch $dupe_run
 for ((i = 0; i < $((2 * LOAD_FACTOR)); i++)); do
        while [ -e $dupe_run ]; do
-               $DUPEREMOVE_PROG -dr --dedupe-options=same $testdir \
-                       >>$seqres.full 2>&1
+               # Run cmd in a subshell so that the golden output does not
+               # capture assertions that trigger when killall shoots down
+               # dupremove processes in an arbitrary order, which leaves the
+               # memory in an inconsistent state long enough for the assert
+               # to trip.
+               cmd="$DUPEREMOVE_PROG -dr --dedupe-options=same $testdir"
+               bash -c "$cmd" >> $seqres.full 2>&1
        done 2>&1 | sed -e '/Terminated/d' &
        dedup_pids="$! $dedup_pids"
 done