Create a _test_xfs_db analogue to _scratch_xfs_db so that we can
encapsulate whatever strange test fs options were fed to us by the test
runner.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
$XFS_DB_PROG "$@" $(_scratch_xfs_db_options)
}
$XFS_DB_PROG "$@" $(_scratch_xfs_db_options)
}
+_test_xfs_db_options()
+{
+ TEST_OPTIONS=""
+ [ "$USE_EXTERNAL" = yes -a ! -z "$TEST_LOGDEV" ] && \
+ TEST_OPTIONS="-l$TEST_LOGDEV"
+ echo $TEST_OPTIONS $* $TEST_DEV
+}
+
+_test_xfs_db()
+{
+ $XFS_DB_PROG "$@" $(_test_xfs_db_options)
+}
+
_scratch_xfs_admin()
{
local options=("$SCRATCH_DEV")
_scratch_xfs_admin()
{
local options=("$SCRATCH_DEV")
# real QA test starts here
echo "=== TEST 1 ==="
# real QA test starts here
echo "=== TEST 1 ==="
-xfs_db -r -c 'pop' -c 'type sb' $TEST_DEV
+_test_xfs_db -r -c 'pop' -c 'type sb'
test_done
echo "=== TEST 2 ==="
test_done
echo "=== TEST 2 ==="
-xfs_db -r -c 'push sb' $TEST_DEV
+_test_xfs_db -r -c 'push sb'
test_done
echo "=== TEST 3 ==="
test_done
echo "=== TEST 3 ==="
-xfs_db -r -c 'pop' -c 'push sb' $TEST_DEV
+_test_xfs_db -r -c 'pop' -c 'push sb'
test_done
echo "=== TEST 4 ==="
test_done
echo "=== TEST 4 ==="
-xfs_db -r -c 'type sb' -c 'print' $TEST_DEV
+_test_xfs_db -r -c 'type sb' -c 'print'
test_done
echo "=== TEST 5 ==="
test_done
echo "=== TEST 5 ==="
-xfs_db -r -c 'inode 128' -c 'push' -c 'type' $TEST_DEV >$tmp.out 2>&1
+_test_xfs_db -r -c 'inode 128' -c 'push' -c 'type' >$tmp.out 2>&1
test_done
if ! grep -q "current type is \"inode\"" $tmp.out; then
cat $tmp.out
fi
echo "=== TEST 6 ==="
test_done
if ! grep -q "current type is \"inode\"" $tmp.out; then
cat $tmp.out
fi
echo "=== TEST 6 ==="
-xfs_db -r -c 'sb' -c 'a' $TEST_DEV >$tmp.out 2>&1 # don't care about output
+_test_xfs_db -r -c 'sb' -c 'a' >$tmp.out 2>&1 # don't care about output
test_done
echo "=== TEST 7 ==="
test_done
echo "=== TEST 7 ==="
-xfs_db -r -c 'ring' $TEST_DEV
+_test_xfs_db -r -c 'ring'
- xfs_db -r $1 -c "sb" -c "print" | $AWK_PROG '
+ _scratch_xfs_db -r -c "sb" -c "print" | $AWK_PROG '
/logstart/ { logstart = $3 }
/logblocks/ { logblocks = $3 }
END {
/logstart/ { logstart = $3 }
/logblocks/ { logblocks = $3 }
END {
f="c6c6c6c6"
echo "*** check for corruption"
echo "expect $f..." >>$seqres.full
f="c6c6c6c6"
echo "*** check for corruption"
echo "expect $f..." >>$seqres.full
- xfs_db -r -c "fsblock $2" -c "print" $1 | head | tee -a $seqres.full | \
+ _scratch_xfs_db -r -c "fsblock $2" -c "print" | head | tee -a $seqres.full | \
grep -q -v "$f $f $f $f $f $f $f $f" && \
_fail "!!! block $2 corrupted!"
}
grep -q -v "$f $f $f $f $f $f $f $f" && \
_fail "!!! block $2 corrupted!"
}
- xfs_db -r $TEST_DEV -c "uuid" | $AWK_PROG '/^UUID/ { print $3 }'
+ _test_xfs_db -r -c "uuid" | $AWK_PROG '/^UUID/ { print $3 }'
}
# real QA test starts here
}
# real QA test starts here