xfstests: add log attribute replay test
v4 cover xfstests: add log attribute replay test
Hi all,
This patch aims to provide better test coverage for Allison’s delayed attribute set. These tests aim to cover cases where attributes are added, removed, and overwritten in each format (shortform, leaf, node). Error inject is used to replay these operations from the log.
The following cases are covered in this test:
- empty, add/remove inline attr (64 bytes)
- empty, add/remove internal attr (1kB)
- empty, add/remove remote attr (64kB)
- inline, add/remove inline attr (64 bytes)
- inline, add/remove internal attr (1kB)
- inline, add/remove remote attr (64kB)
- extent, add/remove internal attr (1kB)
- extent, add multiple internal attr (inject error on split operation)
- extent, add multiple internal attr (inject error on transition to node)
- extent, add/remove remote attr (64kB)
- btree, add/remove multiple internal (1kB)
- btree, add/remove remote attr (64kB)
- overwrite shortform attr
- overwrite leaf attr
- overwrite node attr
Running these tests require the corresponding kernel and xfsprogs changes that add the new error tags larp_leaf_split and larp_leaf_to_node.
v4 changes:
- Removed leading underscore on functions
- Filtered $SCRATCH_MNT on md5sum check
- Removed unnecessary unmount code
- Replaced _scratch_mkfs_xfs with _scratch_mkfs
Suggestions and feedback are appreciated!
Catherine
Allison Henderson (1):
xfstests: Add Log Attribute Replay test
tests/xfs/542 | 171 ++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/542.out | 149 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 320 insertions(+) create mode 100755 tests/xfs/542 create mode 100755 tests/xfs/542.out
Signature · 1 line
2.25.1
PATCH v4 1/1 xfstests: Add Log Attribute Replay test
From: Allison Henderson <[email protected]>
This patch adds tests to exercise the log attribute error inject and log replay. These tests aim to cover cases where attributes are added, removed, and overwritten in each format (shortform, leaf, node). Error inject is used to replay these operations from the log.
--- tests/xfs/542 | 171 ++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/542.out | 149 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 320 insertions(+) create mode 100755 tests/xfs/542 create mode 100755 tests/xfs/542.out
tests/xfs/542 new file +171 -0
@@ -0,0 +1,171 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2021, Oracle and/or its affiliates. All Rights Reserved. +# +# FS QA Test 542 +# +# Log attribute replay test +# +. ./common/preamble +_begin_fstest auto quick attr + +# get standard environment, filters and checks +. ./common/filter +. ./common/attr +. ./common/inject + +_cleanup() +{ + rm -f $tmp.* + echo 0 > /sys/fs/xfs/debug/larp +} + +test_attr_replay() +{ + testfile=$SCRATCH_MNT/$1 + attr_name=$2 + attr_value=$3 + flag=$4 + error_tag=$5 + + # Inject error + _scratch_inject_error $error_tag + + # Set attribute + echo "$attr_value" | ${ATTR_PROG} -$flag "$attr_name" $testfile 2>&1 | \ + _filter_scratch + + # FS should be shut down, touch will fail + touch $testfile 2>&1 | _filter_scratch + + # Remount to replay log + _scratch_remount_dump_log >> $seqres.full + + # FS should be online, touch should succeed + touch $testfile + + # Verify attr recovery + { $ATTR_PROG -g $attr_name $testfile | md5sum; } 2>&1 | _filter_scratch + + echo "" +} + +create_test_file() +{ + filename=$SCRATCH_MNT/$1 + count=$2 + attr_value=$3 + + touch $filename + + for i in `seq $count` + do + $ATTR_PROG -s "attr_name$i" -V $attr_value $filename >> \ + $seqres.full + done +} + +# real QA test starts here +_supported_fs xfs + +_require_scratch +_require_attrs +_require_xfs_io_error_injection "larp" +_require_xfs_io_error_injection "larp_leaf_split" +_require_xfs_io_error_injection "larp_leaf_to_node" +_require_xfs_sysfs debug/larp + +# turn on log attributes +echo 1 > /sys/fs/xfs/debug/larp + +attr16="0123456789ABCDEF" +attr64="$attr16$attr16$attr16$attr16" +attr256="$attr64$attr64$attr64$attr64" +attr1k="$attr256$attr256$attr256$attr256" +attr4k="$attr1k$attr1k$attr1k$attr1k" +attr8k="$attr4k$attr4k" +attr16k="$attr8k$attr8k" +attr32k="$attr16k$attr16k" +attr64k="$attr32k$attr32k" + +echo "*** mkfs" +_scratch_mkfs >/dev/null + +echo "*** mount FS" +_scratch_mount + +# empty, inline +create_test_file empty_file1 0 +test_attr_replay empty_file1 "attr_name" $attr64 "s" "larp" +test_attr_replay empty_file1 "attr_name" $attr64 "r" "larp" + +# empty, internal +create_test_file empty_file2 0 +test_attr_replay empty_file2 "attr_name" $attr1k "s" "larp" +test_attr_replay empty_file2 "attr_name" $attr1k "r" "larp" + +# empty, remote +create_test_file empty_file3 0 +test_attr_replay empty_file3 "attr_name" $attr64k "s" "larp" +test_attr_replay empty_file3 "attr_name" $attr64k "r" "larp" + +# inline, inline +create_test_file inline_file1 1 $attr16 +test_attr_replay inline_file1 "attr_name2" $attr64 "s" "larp" +test_attr_replay inline_file1 "attr_name2" $attr64 "r" "larp" + +# inline, internal +create_test_file inline_file2 1 $attr16 +test_attr_replay inline_file2 "attr_name2" $attr1k "s" "larp" +test_attr_replay inline_file2 "attr_name2" $attr1k "r" "larp" + +# inline, remote +create_test_file inline_file3 1 $attr16 +test_attr_replay inline_file3 "attr_name2" $attr64k "s" "larp" +test_attr_replay inline_file3 "attr_name2" $attr64k "r" "larp" + +# extent, internal +create_test_file extent_file1 1 $attr1k +test_attr_replay extent_file1 "attr_name2" $attr1k "s" "larp" +test_attr_replay extent_file1 "attr_name2" $attr1k "r" "larp" + +# extent, inject error on split +create_test_file extent_file2 3 $attr1k +test_attr_replay extent_file2 "attr_name4" $attr1k "s" "larp_leaf_split" + +# extent, inject error on fork transition +create_test_file extent_file3 3 $attr1k +test_attr_replay extent_file3 "attr_name4" $attr1k "s" "larp_leaf_to_node" + +# extent, remote +create_test_file extent_file4 1 $attr1k +test_attr_replay extent_file4 "attr_name2" $attr64k "s" "larp" +test_attr_replay extent_file4 "attr_name2" $attr64k "r" "larp" + +# remote, internal +create_test_file remote_file1 1 $attr64k +test_attr_replay remote_file1 "attr_name2" $attr1k "s" "larp" +test_attr_replay remote_file1 "attr_name2" $attr1k "r" "larp" + +# remote, remote +create_test_file remote_file2 1 $attr64k +test_attr_replay remote_file2 "attr_name2" $attr64k "s" "larp" +test_attr_replay remote_file2 "attr_name2" $attr64k "r" "larp" + +# replace shortform +create_test_file sf_file 2 $attr64 +test_attr_replay sf_file "attr_name2" $attr64 "s" "larp" + +# replace leaf +create_test_file leaf_file 2 $attr1k +test_attr_replay leaf_file "attr_name2" $attr1k "s" "larp" + +# replace node +create_test_file node_file 1 $attr64k +$ATTR_PROG -s "attr_name2" -V $attr1k $SCRATCH_MNT/node_file \ + >> $seqres.full +test_attr_replay node_file "attr_name2" $attr1k "s" "larp" + +echo "*** done" +status=0 +exit
tests/xfs/542.out new file +149 -0
149 lines not on this page · raw message
Signature · 1 line
2.25.1