summaryrefslogtreecommitdiff
path: root/tests/fsck-tests.sh
Commit message (Collapse)AuthorAge
* btrfs-progs: tests: add fallback to current directory for check_all_imagesDavid Sterba2016-11-23
| | | | | Reported-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: enhance TEST_LOG featuresDavid Sterba2016-11-23
| | | | | | | Add new keyword to dump the log file after any test fails. Can be useful for remote analysis of test failures. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: add quotation around variables in support scriptsDavid Sterba2016-11-11
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: check if kernel has btrfs supportDavid Sterba2016-11-11
| | | | | | | Add some sanity checks, reported among other issues via bugzilla. References: https://bugzilla.kernel.org/show_bug.cgi?id=177141 Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: unify test driversDavid Sterba2016-06-03
| | | | | | Remove unnecessary code, add exports to all common variables. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: typo review of strings and commentsNicholas D Steeves2016-06-01
| | | | | Signed-off-by: Nicholas D Steeves <nsteeves@gmail.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: print test typeDavid Sterba2016-01-12
| | | | | | | | | | | | | | | | | | | | | | | | | Makes it a bit more clear: [TEST/conv] ext4 32k nodesize, btrfs no-holes [TEST/conv] ext2 64k nodesize, btrfs no-holes [TEST/conv] ext3 64k nodesize, btrfs no-holes [TEST/conv] ext4 64k nodesize, btrfs no-holes [TEST] misc-tests.sh [TEST/misc] 001-btrfstune-features [TEST/misc] 002-uuid-rewrite [TEST/misc] 003-zero-log [TEST/misc] 004-shrink-fs [TEST/misc] 005-convert-progress-thread-crash [TEST/misc] 006-image-on-missing-device [TEST/misc] 007-subvolume-sync [TEST/misc] 008-leaf-crossing-stripes [TEST/misc] 009-subvolume-sync-must-wait [TEST/misc] 010-convert-delete-ext2-subvol [TEST/misc] 011-delete-missing-device [TEST] fuzz-tests.sh [TEST/fuzz] 001-simple-unmounted Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: Introduce init_env to initialize common env variantZhao Lei2015-09-01
| | | | | | | | | | | | | | | | | | | | | | | For example, $TEST_DIR is common used in severial tests, and have duplicated code for initialize. These duplicated code not only benifits harddisk vendor, but have inconsistent details, as: convert-tests.sh: lack of mkdir fsck-tests/012-leaf-corruption/test.sh: unnecessary mkdir fsck-tests/013-extent-tree-rebuild/test.sh: unnecessary init misc-tests/XXX ... And severial error message: _fail "unable to create mount point on $TEST_MNT" _fail "failed to create mount point" ... This patch move initizlizaton of $TEST_DIR to common init_env(), to avoid above problem, and init_env() can be used to add more things in future. Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: support testname globDavid Sterba2015-08-31
| | | | | | | | | | | | | | | To run a given test set the variable TEST like $ make test TEST=002-bad-transid $ make test TEST=002-* and only tests matching the value will be run. The pattern is glob and pased to 'find -name'. The convert tests do not follow the fsck and misc layout and are skipped if TEST is set. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: fsck tests: move code to a functionDavid Sterba2015-08-31
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: use readlink -f to resolve pathDavid Sterba2015-05-21
| | | | | | | The utility 'realpath' from coreutils is new enough to be missing on my "old" reference build host. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: tests: log the test name in results fileDavid Sterba2015-05-21
| | | | Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: test-frame: Update variant namesQu Wenruo2015-04-07
| | | | | | | | | | | | Use upper case variant name for the following variants: 1) top -> TOP 2) script_dir -> SCRIPT_DIR And change the following variant name: 1) RESULT -> RESULTS Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: tests, adjust alignment of the pretty command nameDavid Sterba2015-01-14
| | | | Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: Move extent tree rebuild test to its dirQu Wenruo2015-01-14
| | | | | | | Move extent tree rebuild teset to its dir. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: New btrfsck test infrastructureQu Wenruo2015-01-14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change the old btrfsck test infrastructure (btrfs-image dump or xz raw dump) to the new test infrastructure. 1) Test case layout The new infrastructure is dir based, each dir is one test type, and can contain multiple images/scripts for different corner cases. So layout will be the following: btrfs-progs |-tests |-fsck-tests |-001-SOME-CORRUPT-TYPE |-IMAGE-FOR-CASE1 |-IMAGE-FOR-CASE2 2) Test case image types Only 2 types for test case images. a) btrfs-image dump This one is the simplest case, one only needs to add the image to corresponding dir. b) custom script This one is for all the resting cases which can't fit btrfs-image, like csum error or script can generate the image (this reduces the size obviously and good for review) The old binary dump also belongs to this type, so need to add script to extract them. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: tests: build prerequisities, btrfs-image and btrfsDavid Sterba2014-12-12
| | | | | | | Build required utilities from the main Makefile and just check in the test scripts. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: tests: use 'btrfs check' instead of btrfsckDavid Sterba2014-12-12
| | | | Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: run fsck image tests in filename orderDavid Sterba2014-10-17
| | | | Signed-off-by: David Sterba <dsterba@suse.cz>
* Btrfs-progs: check, ability to detect and fix outdated snapshot root itemsFilipe Manana2014-10-17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change adds code to detect and fix the issue introduced in the kernel release 3.17, where creation of read-only snapshots lead to a corrupted filesystem if they were created at a moment when the source subvolume/snapshot had orphan items. The issue was that the on-disk root items became incorrect, referring to the pre orphan cleanup root node instead of the post orphan cleanup root node. A test filesystem can be generated with the test case recently submitted for xfstests/fstests, which is essencially the following (bash script): workout() { ops=$1 procs=$2 num_snapshots=$3 _scratch_mkfs >> $seqres.full 2>&1 _scratch_mount snapshot_cmd="$BTRFS_UTIL_PROG subvolume snapshot -r $SCRATCH_MNT" snapshot_cmd="$snapshot_cmd $SCRATCH_MNT/snap_\`date +'%H_%M_%S_%N'\`" run_check $FSSTRESS_PROG -p $procs \ -x "$snapshot_cmd" -X $num_snapshots -d $SCRATCH_MNT -n $ops } ops=10000 procs=4 snapshots=500 workout $ops $procs $snapshots Example of btrfsck's (btrfs check) behaviour against such filesystem: $ btrfsck /dev/loop0 root item for root 311, current bytenr 44630016, current gen 60, current level 1, new bytenr 44957696, new gen 61, new level 1 root item for root 1480, current bytenr 1003569152, current gen 1271, current level 1, new bytenr 1004175360, new gen 1272, new level 1 root item for root 1509, current bytenr 1037434880, current gen 1300, current level 1, new bytenr 1038467072, new gen 1301, new level 1 root item for root 1562, current bytenr 33636352, current gen 1354, current level 1, new bytenr 34455552, new gen 1355, new level 1 root item for root 3094, current bytenr 1011712000, current gen 2935, current level 1, new bytenr 1008484352, new gen 2936, new level 1 root item for root 3716, current bytenr 80805888, current gen 3578, current level 1, new bytenr 73515008, new gen 3579, new level 1 root item for root 4085, current bytenr 714031104, current gen 3958, current level 1, new bytenr 716816384, new gen 3959, new level 1 Found 7 roots with an outdated root item. Please run a filesystem check with the option --repair to fix them. $ echo $? 1 $ btrfsck --repair /dev/loop0 enabling repair mode fixing root item for root 311, current bytenr 44630016, current gen 60, current level 1, new bytenr 44957696, new gen 61, new level 1 fixing root item for root 1480, current bytenr 1003569152, current gen 1271, current level 1, new bytenr 1004175360, new gen 1272, new level 1 fixing root item for root 1509, current bytenr 1037434880, current gen 1300, current level 1, new bytenr 1038467072, new gen 1301, new level 1 fixing root item for root 1562, current bytenr 33636352, current gen 1354, current level 1, new bytenr 34455552, new gen 1355, new level 1 fixing root item for root 3094, current bytenr 1011712000, current gen 2935, current level 1, new bytenr 1008484352, new gen 2936, new level 1 fixing root item for root 3716, current bytenr 80805888, current gen 3578, current level 1, new bytenr 73515008, new gen 3579, new level 1 fixing root item for root 4085, current bytenr 714031104, current gen 3958, current level 1, new bytenr 716816384, new gen 3959, new level 1 Fixed 7 roots. Checking filesystem on /dev/loop0 UUID: 2186e9b9-c977-4a35-9c7b-69c6609d4620 checking extents checking free space cache cache and super generation don't match, space cache will be invalidated checking fs roots checking csums checking root refs found 618537000 bytes used err is 0 total csum bytes: 130824 total tree bytes: 601620480 total fs tree bytes: 580288512 total extent tree bytes: 18464768 btree space waste bytes: 136939144 file data blocks allocated: 34150318080 referenced 27815415808 Btrfs v3.17-rc3-2-gbbe1dd8 $ echo $? 0 Signed-off-by: Filipe Manana <fdmanana@suse.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: skip extent rebuild test if no testdevJosef Bacik2014-10-10
| | | | | | | | | It is highly obnoxious to have to go put in a testdev when all you really want is to run the quick image tests. Make this part optional so if we don't have a testdev specified we just don't run that particular test. Thanks, Signed-off-by: Josef Bacik <jbacik@fb.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* Btrfs-progs: fsck: add tests for extent tree rebuildingWang Shilong2014-08-22
| | | | | | | | | | | | We need test to verify extent tree rebuilding work, this test create a strange filesystem with some snapshots, destroy extent root node, and run fsck with "--init-extent-tree". Since this tests need btrfs internal tool(btrfs-corrupt-block),so i add this test into btrfs-progs. Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* Btrfs-progs: add a test image for the transid fixer in btrfsckJosef Bacik2013-10-16
| | | | | | | | | | This is a verification test for the transid recow functionality of btrfsck. I've also adjusted the test script to spit out which image it's testing so I can be sure the image was getting tested. Thanks, Signed-off-by: Josef Bacik <jbacik@fusionio.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* Btrfs-progs: add make test frameworkJosef Bacik2013-10-16
We need to start adding some sanity tests to btrfs-progs to make sure we aren't breaking things with our patches. The most important of these tools is btrfsck. This patch gets things started by adding a basic btrfsck test that makes sure we can fix a corruption problem we know we can fix. Thanks, Signed-off-by: Josef Bacik <jbacik@fusionio.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>