mirror of
https://github.com/linux-apfs/apfstests.git
synced 2026-05-01 15:01:44 -07:00
xfs: wrap xfs_db calls to the test device
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>
This commit is contained in:
committed by
Eryu Guan
parent
5f98984ec7
commit
66dd0c19da
+13
@@ -218,6 +218,19 @@ _scratch_xfs_db()
|
||||
$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")
|
||||
|
||||
+7
-7
@@ -38,32 +38,32 @@ test_done()
|
||||
# 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 ==="
|
||||
xfs_db -r -c 'push sb' $TEST_DEV
|
||||
_test_xfs_db -r -c 'push sb'
|
||||
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 ==="
|
||||
xfs_db -r -c 'type sb' -c 'print' $TEST_DEV
|
||||
_test_xfs_db -r -c 'type sb' -c 'print'
|
||||
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 ==="
|
||||
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 ==="
|
||||
xfs_db -r -c 'ring' $TEST_DEV
|
||||
_test_xfs_db -r -c 'ring'
|
||||
test_done
|
||||
|
||||
+2
-2
@@ -149,7 +149,7 @@ _log_sunit()
|
||||
|
||||
_after_log()
|
||||
{
|
||||
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 {
|
||||
@@ -163,7 +163,7 @@ _check_corrupt()
|
||||
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!"
|
||||
}
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
|
||||
|
||||
_get_existing_uuid()
|
||||
{
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user