summaryrefslogtreecommitdiff
path: root/tests
Commit message (Collapse)AuthorAge
...
* 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>
* btrfs-progs: fsck tests: move code to a functionDavid Sterba2015-08-31
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: inspect: add command min-dev-sizeDavid Sterba2015-08-31
| | | | | | | | | | Previously in 'filesystem resize get_min_size', now 'inspect-internal min-dev-size'. We'd like to avoid cluttering the 'resize' syntax further. The test has been updated to exercise the new option. Signed-off-by: David Sterba <dsterba@suse.com>
* Btrfs-progs: add feature to get mininum size for resizing a fs/deviceFilipe Manana2015-08-31
| | | | | | | | | | | | | | | | | | | Currently there is not way for a user to know what is the minimum size a device of a btrfs filesystem can be resized to. Sometimes the value of total allocated space (sum of all allocated chunks/device extents), which can be parsed from 'btrfs filesystem show' and 'btrfs filesystem usage', works as the minimum size, but sometimes it does not, namely when device extents have to relocated to holes (unallocated space) within the new size of the device (the total allocated space sum). This change adds the ability to reliably compute such minimum value and extents 'btrfs filesystem resize' with the following syntax to get such value: btrfs filesystem resize [devid:]get_min_size Signed-off-by: Filipe Manana <fdmanana@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: Add test case for I_ERR_FILE_WRONG_NBYTES repairQu Wenruo2015-07-03
| | | | | | | | Add a new test case for I_ERR_FILE_WRONG_NBYTES. The new btrfs-image dump image contains a file in 12K size. But nbytes in its inode item is a random number. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
* btrfs-progs: tests: verify btrfstune output during uuid-rewriteDavid Sterba2015-06-18
| | | | | | | The 'Current fsid:' value does not match the real fsid. Reported-by: Mike Fleetwood <mike.fleetwood@googlemail.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: tests: add test for zero-logDavid Sterba2015-06-05
| | | | | | | | Simple test to verify that the log_root is reset after the command, but we yet need to provide a testing image with log_root set to something sensible or crafted images with borked log_root pointer. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: tests: update convert tests to set fs featuresDavid Sterba2015-06-04
| | | | Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: tests: add misc tests for uuid rewriteDavid Sterba2015-06-03
| | | | | | Simple tests of the -u/-U options of btrfstune. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: btrfstune: add option to enable NO_HOLESDavid Sterba2015-06-03
| | | | | | New option -n to enable the NO_HOLES feature. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: tests: add misc test for fs featuresDavid Sterba2015-06-02
| | | | | | | | A sample test for the misc-test category. Verify that btrfstune sets the requested fs features. Now implemented extrefs, skinny-metadata and seeding. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: tests: common: add helper run_check_stdoutDavid Sterba2015-06-02
| | | | | | | Sometimes we need to process the output of the command, but run_check captures all the output into results file. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: tests: add driver script for misc testsDavid Sterba2015-06-02
| | | | Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: tests: add script to clean intermediate imagesDavid Sterba2015-05-25
| | | | Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: test: 015-check-bad-memory-accessDavid Sterba2015-05-25
| | | | | | | | | | | | | Crafted images may trigger out-of-bounds access during check, fixed by "btrfs-progs: Enhance read_tree_block to avoid memory corruption" Now adding image for the first one, the other need enhancements in the testing framework. Reference: https://bugzilla.kernel.org/show_bug.cgi?id=97171 Reference: https://bugzilla.kernel.org/show_bug.cgi?id=97191 Reference: https://bugzilla.kernel.org/show_bug.cgi?id=97271 Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: tests: sort image filesDavid Sterba2015-05-25
| | | | | | | If a test has several images let filenames enforce a particular order of checks if desired. Signed-off-by: David Sterba <dsterba@suse.cz>
* 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: support more formats of test imagesDavid Sterba2015-05-21
| | | | | | | We're using he meta-dump images, now we support compressed meta-dump, raw and compressed raw images. 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: use local btrfs-image in leaf corruption testWorMzy Tykashi2015-04-09
| | | | | | | | | | Currently this test uses the system btrfs-image. If there isn't a btrfs-image on $PATH, the test fails. The test should be using the locally compiled btrfs-image, not the system one. Signed-off-by: WorMzy Tykashi <wormzy.tykashi@gmail.com> Reviewed-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: tests: remove duplicate output for fsck test 013David Sterba2015-04-07
| | | | | | The test name is logged since it lives in it's own directory. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: tests: split make rule for fsck and convert tests, fix ↵David Sterba2015-04-07
| | | | | | | | | | prerequisities We'd like to run each class of tests separately. There were some missing prerequisities that should be/are verified by the tests, makefile rules have been synced. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: convert tests: preserve test image permissionsDavid Sterba2015-04-07
| | | | | | | If the test image is eg. on NFS it's not writable for root, so chmod 0777 fixes that but then we must not delete the file. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: convert-tests: Add check for converted btrfs with regular file ↵Qu Wenruo2015-04-07
| | | | | | | | | | extent. Regression test for previous patch "btrfs-progs: convert: Make ext*_image file obey datacsum setting." Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: convert-tests: Update to use test framework infrastructure.Qu Wenruo2015-04-07
| | | | | | | | Also change the test() to convert_test(), to avoid conflict name with bash test function. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: fsck-tests: Add fallback TEST_DEV for test case 013Qu Wenruo2015-04-07
| | | | | | | | | | Add fallback TEST_DEV for test case 013. Fallback to $TOP/tests/test.img. Now all test cases of btrfs-progs need no extra setting except sudo. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: fsck-tests: Update 013-extent-tree-rebuild to use more test ↵Qu Wenruo2015-04-07
| | | | | | | | | | | | | framework infrastructure. Update 013-extent-tree-rebuild to use more framework infrastructure, including: 1) Use run_check other than open-coded redirect 2) Add root privillege 3) Add dependency on 'btrfs-debug-tree' command Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: fsck-tests: Remove duplicatesd TEST_MNT setup.Qu Wenruo2015-04-07
| | | | | | | | Since we have already had TEST_MNT fallback setup to $TOP/tests/mnt, just remove duplicated setting in 012-leaf-corruption/test.sh Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> 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: convert tests: add remaining supported nodesizesDavid Sterba2015-03-23
| | | | | | That's 8k, 32k and 64k. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: Add nodesize test for btrfs-convertSebastian Thorarensen2015-03-23
| | | | | | | convert-tests now test both 4096 and 16384 nodesizes. Signed-off-by: Sebastian Thorarensen <sebth@naju.se> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: tests, common: fix typo after cleanupDavid Sterba2015-03-10
| | | | | | | The previous value for unknown was -1. Reported-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: tests, clean up scriptsDavid Sterba2015-03-09
| | | | | | | Rename variables, use caps, call true by full path, add quotation to variables and a few wording fixes. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: fsck-test: Add check_sudo to check valid root/sudo privilegeQu Wenruo2015-03-09
| | | | | | | | | | | | | | | | | | | | | | Although fsck-test/012 uses sudo, it uses 'sudo -n', which won't prompt user to input password and will return 1 if no valid credential is found. And this makes test result quite annoying since it fails to mount and still continue, which will always fail. This patch will check 'sudo -v -n' and 'sudo -n true' to determine whether sudo works fine in different version/settings, since in some setting/version, 'sudo -v -n' will fail even the user is set NOPASSWD. Also, remove the 'have_root_helper' variant, since there is a possibility that sudo credential will timeout during the test and 'have_root_helper' won't help to detect such problem. New '_sudo' command will do credential check if needed to avoid such problem. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: deal with no extent infoJosef Bacik2015-02-09
| | | | | | | | | | Previously we used to just set FULL_BACKREF if we couldn't lookup an extent info for an extent. Now we just bail out if we can't lookup the extent info, which is less than good since fsck is supposed to fix these very problems. So instead figure out the flag we are supposed to use and pass that along instead. This patch also provides a test image to test this functionality. Thanks, Signed-off-by: Josef Bacik <jbacik@fb.com>
* btrfs-progs: tests, use non-interactive sudo helperDavid Sterba2015-01-19
| | | | | | | | Sudo may not be configured to run without user prompt, in that case the tests would be stuck. Reported-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: tests, use the root helper in 012David Sterba2015-01-14
| | | | | | We need it to mount/umount, to traverse lost+found and stat the results. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: tests, add support for running commands under rootDavid Sterba2015-01-14
| | | | | | | | Most of the checks run fine without root, but some of them may need to do a mount test or access the data. Add the support to selectively run commands under root, hardcoded to sudo for now. 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: Move leaf-corruption no extent data case and add verification ↵Qu Wenruo2015-01-14
| | | | | | | | | | | | | | | script Move leaf-corruption type no extent data case to its dir, and add verification script in test.sh The verification script is based on manual btrfs-debug-tree check. The image can also be reused to other leaf-corruption type, like corrupted leaf contains regular file extent data case. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>