]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
common/rc: hoist pkill to a helper function
authorDarrick J. Wong <djwong@kernel.org>
Mon, 3 Feb 2025 22:00:27 +0000 (14:00 -0800)
committerZorro Lang <zlang@kernel.org>
Tue, 18 Feb 2025 04:42:39 +0000 (12:42 +0800)
Create a helper function to wrap pkill in preparation for the next
patch.

Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
common/fuzzy
common/rc
tests/generic/310
tests/generic/561

index 4dea96b9aa3cce5eb777f7f6ace79eb0c83f2a90..34f56c00351cd57e1ba02db3128ba415bfd8123c 100644 (file)
@@ -1175,9 +1175,9 @@ _scratch_xfs_stress_scrub_cleanup() {
 
        echo "Killing stressor processes at $(date)" >> $seqres.full
        _kill_fsstress
-       pkill -PIPE --parent $$ xfs_io >> $seqres.full 2>&1
-       pkill -PIPE --parent $$ fsx >> $seqres.full 2>&1
-       pkill -PIPE --parent $$ xfs_scrub >> $seqres.full 2>&1
+       _pkill -PIPE --parent $$ xfs_io >> $seqres.full 2>&1
+       _pkill -PIPE --parent $$ fsx >> $seqres.full 2>&1
+       _pkill -PIPE --parent $$ xfs_scrub >> $seqres.full 2>&1
 
        # Tests are not allowed to exit with the scratch fs frozen.  If we
        # started a fs freeze/thaw background loop, wait for that loop to exit
index 1f1d75e94fbd69d918d66068d9adf55821aa0bf5..9e82e5efe793d05b5da501245e81d1b27f170c4a 100644 (file)
--- a/common/rc
+++ b/common/rc
@@ -30,6 +30,12 @@ _test_sync()
        _sync_fs $TEST_DIR
 }
 
+# Kill only the processes started by this test.
+_pkill()
+{
+       pkill "$@"
+}
+
 # Common execution handling for fsstress invocation.
 #
 # We need per-test fsstress binaries because of the way fsstress forks and
@@ -69,7 +75,7 @@ _kill_fsstress()
        if [ -n "$_FSSTRESS_PID" ]; then
                # use SIGPIPE to avoid "Killed" messages from bash
                echo "killing $_FSSTRESS_BIN" >> $seqres.full
-               pkill -PIPE $_FSSTRESS_BIN >> $seqres.full 2>&1
+               _pkill -PIPE $_FSSTRESS_BIN >> $seqres.full 2>&1
                _wait_for_fsstress
                return $?
        fi
index 52babfdc803a2199467c23eb83f96451d352099f..570cc5f38595480a6822d0930875d3fb7855b9e0 100755 (executable)
@@ -29,7 +29,7 @@ _begin_fstest auto
 # Override the default cleanup function.
 _cleanup()
 {
-       pkill -9 $seq.t_readdir > /dev/null 2>&1
+       _pkill -9 $seq.t_readdir > /dev/null 2>&1
        wait
        rm -rf $TEST_DIR/tmp
        rm -f $tmp.*
@@ -83,7 +83,7 @@ _test_read()
 {
         $TEST_DIR/$seq.t_readdir_1 $SEQ_DIR > /dev/null 2>&1 &
        sleep $RUN_TIME
-       pkill -PIPE $seq.t_readdir_1
+       _pkill -PIPE $seq.t_readdir_1
        wait
 
        check_kernel_bug
@@ -97,7 +97,7 @@ _test_lseek()
        $TEST_DIR/$seq.t_readdir_2 $SEQ_DIR > /dev/null 2>&1 &
        readdir_pid=$!
        sleep $RUN_TIME
-       pkill -PIPE $seq.t_readdir_2
+       _pkill -PIPE $seq.t_readdir_2
        wait
 
        check_kernel_bug
index afe727ac56cbd980d21d94a3127ba5189f81cec2..b260aaf16c9256fc524cccedb5cf4a8e58ba9bb7 100755 (executable)
@@ -40,7 +40,7 @@ function end_test()
        # stop duperemove running
        if [ -e $dupe_run ]; then
                rm -f $dupe_run
-               pkill $dedup_bin >/dev/null 2>&1
+               _pkill $dedup_bin >/dev/null 2>&1
                wait $dedup_pids
                rm -f $dedup_prog
        fi