summaryrefslogtreecommitdiff
path: root/tests
Commit message (Collapse)AuthorAge
* btrfs-progs: misc-test: Add regression test for find-root gives empty resultQu Wenruo2016-02-26
| | | | | | | | | Add regression test for btrfs-find-root gives empty result even the fs is OK. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> [ enhanced test ] Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: use common variables and helpersDavid Sterba2016-02-23
| | | | | | Use TEST_DEV and the associated helpers to manage the tested image. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: store checksums in /tmpDavid Sterba2016-02-23
| | | | | | We don't want to store the checksum on filesystem that we're converting. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: do checksum verification with convert-testsLakshmipathi.G2016-02-23
| | | | | Signed-off-by: Lakshmipathi.G <Lakshmipathi.G@giis.co.in> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: add missing prerequisitesDavid Sterba2016-01-12
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: test multiple-linked file corruptionNaohiro Aota2016-01-12
| | | | | | | | | This commit extends the leaf corruption test to try to repair a file linked from multiple directory. It stresses a case that some links to a file is broken but others kept valid. Signed-off-by: Naohiro Aota <naota@elisp.net> 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: add sys-array-num-stripes-0.raw.xzDavid Sterba2016-01-04
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: mkfs, check sectorsize and nodesize combinationsQu Wenruo2016-01-04
| | | | | | | | | Add mkfs selftest for invalid and valid sectorsize/nodesize combinations. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> [ switched to TEST_DEV ] Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: enhance 001-basic-profiles with --data DUPDavid Sterba2015-11-26
| | | | | | Add the remaining valid combinations. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: add 019-non-skinny-false-alertDavid Sterba2015-11-26
| | | | | | | Catch a buggy condition fixed by "btrfs-progs: fsck: Fix a false alert where extent record has wrong metadata flag" Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: add 007-mix-nodesize-sectorsizeDavid Sterba2015-11-19
| | | | | | Test combinations of sectorsize and nodesize on a single device. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: add 006-partitioned-loopdevDavid Sterba2015-11-16
| | | | | | | Create filesystem on a partitioned loop device, test for "btrfs-progs: Fix partitioned loop devices resolving". Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: add 005-long-device-name-for-ssdDavid Sterba2015-11-16
| | | | | | | | A test for "btrfs-progs: mkfs: increase buffer size in is_ssd". Create a device with a long name through loop device wrapped to a device mapper linear device, switch it to the "ssd" mode status. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: add 011-delete-missing-deviceDavid Sterba2015-11-16
| | | | | | | Test for "btrfs-progs: allow device deletion using 'missing' keyword again". Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: mkfs: do not truncate the image when --rootdir is setDavid Sterba2015-11-05
| | | | | | | | | | | | | | With the rootdir option we try to guess the final size of the image and fill it with zeros, preceded by truncation. After patch "Btrfs-progs: Do not force mixed block group creation unless '-M' option is specified" the misc test 002 will fail, because of the non-mixed mode. I think we should not touch the image size (no change for block devices) and try to fit into whatever is provided by user. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: add initial tests/READMEDavid Sterba2015-11-02
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: add 003-mixed-with-wrong-nodesizeDavid Sterba2015-11-02
| | | | | | | | | Mixed mode needs equal sectorsize and nodesize. This was fixed by "Btrfs-progs: Prevent creation of filesystem with 'mixed bgs' and having differing sectorsize and nodesize" Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: do not log output of run_mayfail to terminalDavid Sterba2015-11-02
| | | | | | | No need to log expected failures to the terminal, the results file is fine; pass the return value of the command. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: add support for command instrumentationDavid Sterba2015-11-02
| | | | | | | | | | | | | | | | | | Add a way to wrap commands executed by the tests. This means the common wrappers: run_check, run_check_stdout and run_mayfail , with the exception of the use root_helper. The contents of the shell variable INSTRUMENT are prepended to the command, without quotes. Use with care. Example: this has been tested with valgrind, the output goes to the RESULTS file. $ INSTRUMENT=valgrind make test-misc Any use of root_helper/SUDO_HELPER will skip the instrumentation. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: 001-simple-unmounted: iterate over fuzzed images and run ↵David Sterba2015-11-02
| | | | | | check Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: add test driver for fuzzed imagesDavid Sterba2015-11-02
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: do not run sudo helper tests if not necessaryDavid Sterba2015-11-02
| | | | | | | | We use setup_root_helper in some helpers to make sure that the sudo helper is set up, and adding that to each test. Make the real test run only once. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: set default test image size to 2GDavid Sterba2015-11-02
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: add 010-convert-delete-ext2-subvolDavid Sterba2015-11-02
| | | | | | | | Testcase for "Btrfs-progs: fix btrfs-convert rollback to check ROOT_BACKREF", make sure we don't try a rollback if the ext2_subvol is half-deleted. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: add 002-no-force-mixed-on-small-volumeDavid Sterba2015-11-02
| | | | | | Verify that we do not force mixed block groups on small volumes anymore. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: add 001-basic-profiles mkfs testsDavid Sterba2015-11-02
| | | | | | Basic test to cover block group profile combinations. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: add mkfs testsDavid Sterba2015-11-02
| | | | | | Mkfs deserves it's own. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: print commands on terminal if requestedDavid Sterba2015-10-21
| | | | | | | | | Set the variable TEST_LOG=tty (in the enviroment or as parameter to make) to print commands executed by 'run_check' helpers to terminal (ie. /dev/tty). This might be useful to see the test progress beside watching the results file. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: misc tests: add 009-subvolume-sync-must-waitDavid Sterba2015-10-21
| | | | | | | Test to verify that subovolume sync waits until the subvolume is cleaned. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: Avoid printing useless warning in fsck testsZhao Lei2015-10-19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 002-bad-transid outout 'transid verify failed' message in screen which is just a warning in btrfs-image in normal condition of this test. This patch move above warning into $RESULTS, to: 1: Avoid trouble screen output 2: Let user known detail if other error happened in btrfs-image Before patch: # ./fsck-tests.sh [TEST] 001-bad-file-extent-bytenr [TEST] 002-bad-transid parent transid verify failed on 29360128 wanted 9 found 755944791 parent transid verify failed on 29360128 wanted 9 found 755944791 Ignoring transid failure [TEST] 003-shift-offsets [TEST] 004-no-dir-index ... After patch: # ./fsck-tests.sh [TEST] 001-bad-file-extent-bytenr [TEST] 002-bad-transid [TEST] 003-shift-offsets [TEST] 004-no-dir-index ... Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: Introduce misc-tests/008-leaf-crossing-stripesZhao Lei2015-10-19
| | | | | | | | | | | | | | | | | | | | | To check is btrfs-convert create bad filesystem with leaf across stripes. It is happened in progs version <=v4.1.2, and fixed by patch titled: btrfs: convert: Avoid allocating metadata extent crossing stripe boundary which was merged in v4.2. Notice thar this testcase can not report error in old version of btrfs-progs, because "btrfs check" can't check this type of error in those version, but we have another testcase in fsck-tests, to check is "btrfs check" support this check. So, the above 2 testcase together can check leaf-crossing-stripes bug in all versions. Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com> [renamed and other minor changes] Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: Introduce fsck-tests/018-leaf-crossing-stripesZhao Lei2015-10-19
| | | | | | | | | | | To test if fsck can check detec "leaf crossing stripes". This function was introduced from patch titled: btrfs-progs: fsck: Check if a metadata tree block crossing stripe boundary Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com> [renamed and other minor changes] Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: Move extract_image out of check_all_images for common useZhao Lei2015-10-19
| | | | | | | | | | Move code for extract image file to a function from check_all_images() for common use, so caller can use this function to extrace single image file. Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com> [minor reformatting and updates] Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: Add '-o loop' to mount command line in convert-tests.shZhao Lei2015-09-20
| | | | | | | | | | | | | | | To fix following bug: # ./convert-tests.sh [TEST] ext2 4k nodesize, btrfs defaults failed: mount /root/btrfsprogs/tests/test.img /root/btrfsprogs/tests/mnt # tail convert-tests-results.txt ... ############### mount /root/btrfsprogs/tests/test.img /root/btrfsprogs/tests/mnt mount: /root/btrfsprogs/tests/test.img is not a block device (maybe try `-o loop'?) failed: mount /root/btrfsprogs/tests/test.img /root/btrfsprogs/tests/mnt Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: add crafted and fuzzed imagesDavid Sterba2015-09-09
| | | | | | | | | A collection of several images that were produced in a non-standard way and cause various errors in check or image tools. They do not fit into the fsck tests as we're not able to repair any of them, but the tools should not crash or do out-of-bounds access. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: Use mount_test_dev for misc-tests/007-subvolume-syncZhao Lei2015-09-01
| | | | | | | So this test can support both block device and loop device simply. Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: Fix mount fail of 013-extent-tree-rebuildZhao Lei2015-09-01
| | | | | | | | | | | | | | | | | | | mount command in old system can not add "-o loop" option automatically for loop device, and make following test failed: # ./fsck-tests.sh ... [TEST] 013-extent-tree-rebuild failed: mount /data/btrfsprogs/tests/test.img /data/btrfsprogs/tests/mnt test failed for case 013-extent-tree-rebuild Considering that $TEST_DEV can be block or loop device, we need determine our mount option in a condition for both case. This patch create a wrapper function for above request, to solve current problem in 013-extent-tree-rebuild, and support similar request in future. Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: introduce test dev mount helpersZhao Lei2015-09-01
| | | | | | | | | | | | | mount command in old system can not add "-o loop" option automatically for a loop device, and make following test 013-extent-tree-rebuild fail. Considering that $TEST_DEV can be block or loop device, we need to determine our mount option in a condition for both case. Introduce a wrapper that will add the loop options if needed. Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: Use --no-same-owner option for tarZhao Lei2015-09-01
| | | | | | | | | | | | | | | | | | | | | | Some test failed in my nfs dir: ... [TEST] 006-bad-root-items tar: test.img: Cannot change ownership to uid 1000, gid 1000: Invalid argument tar: Exiting with failure status due to previous errors failed to extract default_case.tar.xz test failed for case 006-bad-root-items It is because the image file's owner is: # tar tvf default_case.tar.xz -rw-r--r-- fdmanana/fdmanana 2147483648 2014-10-17 17:59 test.img And make tar failed in chown in nfs. It is not a big issue because we don't use nfs commonly, but extract the image file with ownership of current user will be a better choice. Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: umount TEST_MNT in clean-tests.shZhao Lei2015-09-01
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If a testcase failed, we can't run it(or other tests needs mount) again, # ./misc-tests.sh 007 [TEST] 007-subvolume-sync failed: fail test failed for case 007-subvolume-sync # ./misc-tests.sh 007 [TEST] 007-subvolume-sync failed: mount /root/btrfs-progs/tests/test.img /root/btrfs-progs/tests/mnt test failed for case 007-subvolume-sync This patch add "umount $TEST_MNT" to clean-tests.sh, to let user clean mountpoint easily. After patch: # ./misc-tests.sh 007 [TEST] 007-subvolume-sync failed: fail test failed for case 007-subvolume-sync # # clean-tests.sh # # ./misc-tests.sh 007 [TEST] 007-subvolume-sync failed: fail test failed for case 007-subvolume-sync Suggested-by: David Sterba <dsterba@suse.cz> Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com> [added sudo helper to umount] 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: Introduce subvolume sync testZhao Lei2015-08-31
| | | | | | | | | | | | Current code have following bug for subvolume sync: 1: If there are more than 1 subvolume to sync, the program will infinitely loop. 2: return !0 in exit This patch add misc-tests/007-subvolume-sync for above case. Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests, verify that btrfs-image works on a missing deviceDavid Sterba2015-08-31
| | | | | | | | Create a 2 device raid1 filesystem, fill with some data, delete one device (the device node must not exist) and try to dump a filesystem image. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests, add more common helpersDavid Sterba2015-08-31
| | | | | | Add support for failures of commands, log the output. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: fsck-tests: add case for inode losing all its extentsQu Wenruo2015-08-31
| | | | | | | | Add test case for inode with no file extents, but still non-zero size. To test whether fsck will infinite loop. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: Introduce a misc test for thread conflict in btrfs-convertZhao Lei2015-08-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Current code of btrfs-convert have a bug of thread conflict, which caused invalid memory accessing between threads, and make program panic. This patch add a test item for above bug, as: # ./misc-tests.sh [TEST] 001-btrfstune-features [TEST] 002-uuid-rewrite [TEST] 003-zero-log [TEST] 004-convert-thread-conflict failed: btrfs-convert /root/btrfsprogs/tests/test.img test failed for case 004-convert-thread-conflict # # cat misc-tests-results.txt ... ############### btrfs-convert /root/btrfsprogs/tests/test.img trans 7 running 5 ctree.c:363: btrfs_cow_block: Assertion `1` failed. btrfs-convert(btrfs_cow_block+0x92)[0x40acaf] btrfs-convert(btrfs_search_slot+0x1cb)[0x40c50f] btrfs-convert(btrfs_csum_file_block+0x20f)[0x41d83a] btrfs-convert[0x43422d] btrfs-convert[0x4342cd] btrfs-convert[0x4345ca] btrfs-convert[0x434767] btrfs-convert[0x435770] btrfs-convert[0x439748] btrfs-convert(main+0x13f8)[0x43b09d] /lib64/libc.so.6(__libc_start_main+0xfd)[0x335e01ecdd] btrfs-convert[0x407649] create btrfs filesystem: blocksize: 4096 nodesize: 16384 features: extref, skinny-metadata (default) creating btrfs metadata. creating ext2fs image file. failed: btrfs-convert /root/btrfsprogs/tests/test.img test failed for case 004-convert-thread-conflict # Note that this bug is not happened every time, especilly in slow device as loop(slow cpu with fast block device is likely to trigger). I set loop count to 20 to make bug happened in 90% tests. Suggested-by: David Sterba <dsterba@suse.com> Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: Move code to create loop device to commonZhao Lei2015-08-31
| | | | | | | | This code block is used several tests, move it to ./common and add a helper. Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: Add -o loop to fsck-tests/012-leaf-corruptionZhao Lei2015-08-31
| | | | | | | | | To avoid following mount error in test: mount: /root/btrfs/progs/tests/fsck-tests/012-leaf-corruption/test.img is not a block device (maybe try `-o loop'?) 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>