aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAndreas Dilger <adilger@dilger.ca>2012-09-10 09:04:47 +0000
committerTheodore Ts'o <tytso@mit.edu>2012-09-16 22:05:21 -0400
commit12f48b0caa366e7a02ac8ad57af4ecf0b8bb3778 (patch)
tree678e66471c72b6f054be9e5b538d87845797ab9f /tests
parenta3e87bcc32a21b1420a15385e0183d58dcaf19b1 (diff)
downloade2fsprogs-12f48b0caa366e7a02ac8ad57af4ecf0b8bb3778.tar.gz
e2fsprogs-12f48b0caa366e7a02ac8ad57af4ecf0b8bb3778.tar.xz
e2fsprogs-12f48b0caa366e7a02ac8ad57af4ecf0b8bb3778.zip
tests: kill debugfs on interrupted MMP test
If the f_mmp test is interrupted during its test run, then it can leave debugfs busy-looping in the background. Since f_mmp is a relatively long-running test, and is likely to be running during a parallel test run, this can happen fairly often. Set a signal trap for the f_mmp test script being killed, so that the background debugfs command will always be killed by the test. Signed-off-by: Andreas Dilger <adilger@dilger.ca> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'tests')
-rw-r--r--tests/f_mmp/script10
1 files changed, 9 insertions, 1 deletions
diff --git a/tests/f_mmp/script b/tests/f_mmp/script
index 1b0ff793..d921672e 100644
--- a/tests/f_mmp/script
+++ b/tests/f_mmp/script
@@ -19,10 +19,18 @@ if [ "$status" != 0 ] ; then
return $status
fi
+kill_debugfs() {
+ trap 0
+ PID=$(ps -o pid,command | grep -v awk |
+ awk "/debugfs -w $TMPFILE/ { print \$1 }")
+ [ "x$PID" != "x" ] && kill -9 $PID
+}
+
# this will cause debugfs to create the $test_name.mark file once it has
# passed the MMP startup, then continue reading input until it is killed
MARKFILE=$test_name.new
rm -f $MARKFILE
+trap kill_debugfs EXIT
echo "set mmp sequence to EXT2_MMP_SEQ_FSCK..." >> $test_name.log
( { echo dump_mmp; echo "dump_inode <2> $MARKFILE"; cat /dev/zero; } |
$DEBUGFS -w $TMPFILE >> $test_name.log 2>&1 & ) > /dev/null 2>&1 &
@@ -32,7 +40,7 @@ while [ ! -e $MARKFILE ]; do
done
rm -f $MARKFILE
echo "kill debugfs abruptly (simulates e2fsck failure) ..." >> $test_name.log
-killall -9 debugfs >> $test_name.log
+kill_debugfs
echo "e2fsck (should fail mmp_seq = EXT2_MMP_SEQ_FSCK) ..." >> $test_name.log