summaryrefslogtreecommitdiff
path: root/tests
Commit message (Collapse)AuthorAge
...
* btrfs-progs: introduce TEST_TOP and INTERNAL_BIN for testsGu Jinxiang2018-02-13
| | | | | | | | | | | | Use TEST_TOP as base for tests to reference any files, this will be used for git and external testsuite. INTERNAL_BIN is needed for referencing binaries that could reside in different paths in git vs external testsuite. Signed-off-by: Gu Jinxiang <gujx@cn.fujitsu.com> [ add quotes around sourced files, update changelog ] Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: rework testsuite exportDavid Sterba2018-02-13
| | | | | | | | | | Move the testsuite to tests/ and make the tarball generation more deterministic. As there could be many random temporary files left in the test directories, we can't just copy them. Use 'git ls-tree' to filter just what we want, this needs a slight extension of the file list specification. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: Add make testsuite command for export testsGu Jinxiang2018-02-13
| | | | | | | | | | | | | | | | | Export the testsuite files to a separate tar. Since fsck tests depend on btrfs-corrupt-block, and misc tests depends on both btrfs-corrupt-block and fssum, so set it as prerequisites for package commad. Because, althougth fssum can be generated by source that are all in tests directory, and has no rely on the btrfs's structure. But btrfs-corrupt-block deeply relys on btrfs's structure. For consistency, at the present stage, generete the two when create test tar. Signed-off-by: Gu Jinxiang <gujx@cn.fujitsu.com> [ applied without changes, the generated tarball will be different from the one after the follow up commits ] Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests common: remove meaningless colon in extract_image()Su Yue2018-02-07
| | | | | | | The colon is meaningless so remove it. Signed-off-by: Su Yue <suy.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: fsck-tests: Cleanup the restored image for 028Qu Wenruo2018-02-06
| | | | | Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: chang tree-reloc-tree test number from 027 to 015Qu Wenruo2018-02-02
| | | | | | | | | | | | There are 2 fsck tests with the same number 027: tree-reloc-tree bad-extent-inline-ref-type And we also have a hole in 015, so just rename tree-reloc-tree to 015, to get rid of the duplicated test number and fill in the hole. Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: fixup mount tests of fsck/028-unaligned-super-dev-sizesDavid Sterba2018-01-31
| | | | | | | This test was broken because it tried to mount a different image than what it had repaired. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: enhance common umount helper to take optional pathsDavid Sterba2018-01-31
| | | | | | | | | | | The run_check_umount_test_dev umounts the TEST_DEV and also optionally uses the arguments but this would not work as expected if the TEST_DEV is not a vald path for umount (eg. a restored image). Update the helper so it tries to umount all paths, or fallback to TEST_DEV to keep the current behaviour. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: disable some mkfs/010 testcases inside travisDavid Sterba2018-01-31
| | | | | | | | | Node sizes larger than 16k will fail due to enospc in the mount test. This is likely caused by the kernel. Keep the condition only local to travis so any other testing environment could see the failure eventually. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: treewide: Replace strerror(errno) with %m.Rosen Penev2018-01-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As btrfs is specific to Linux, %m can be used instead of strerror(errno) in format strings. This has some size reduction benefits for embedded systems. glibc, musl, and uclibc-ng all support %m as a modifier to printf. A quick glance at the BIONIC libc source indicates that it has support for %m as well. BSDs and Windows do not but I do believe them to be beyond the scope of btrfs-progs. Compiled sizes on Ubuntu 16.04: Before: 3916512 btrfs 233688 libbtrfs.so.0.1 4899 bcp 2367672 btrfs-convert 2208488 btrfs-corrupt-block 13302 btrfs-debugfs 2152160 btrfs-debug-tree 2136024 btrfs-find-root 2287592 btrfs-image 2144600 btrfs-map-logical 2130760 btrfs-select-super 2152608 btrfstune 2131760 btrfs-zero-log 2277752 mkfs.btrfs 9166 show-blocks After: 3908744 btrfs 233256 libbtrfs.so.0.1 4899 bcp 2366560 btrfs-convert 2207432 btrfs-corrupt-block 13302 btrfs-debugfs 2151104 btrfs-debug-tree 2134968 btrfs-find-root 2281864 btrfs-image 2143536 btrfs-map-logical 2129704 btrfs-select-super 2151552 btrfstune 2130696 btrfs-zero-log 2276272 mkfs.btrfs 9166 show-blocks Total savings: 23928 (24 kilo)bytes Signed-off-by: Rosen Penev <rosenp@gmail.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: truncate test image to 0 firstDavid Sterba2018-01-31
| | | | | | | | We use the prepare_test_dev helper to make sure the image has at least this size. The "at least" part is not desired by some tests as the device might be larger than the test expects. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: add more coverage to mkfs-tests/013-reserved-1M-for-singleDavid Sterba2018-01-31
| | | | | | | Though the newly added mkfs profiles should not be affected, let's add the remaining valid single device profiles for better coverage. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: mkfs: don't overwrite first 1M for singleQu Wenruo2018-01-31
| | | | | | | | | Add test case to check if the first device extent is occupying reserved 0~1M range. Signed-off-by: Qu Wenruo <wqu@suse.com> Reviewed-by: Nikolay Borisov <nborisov@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests:mkfs/010: Output minimal device sizeQu Wenruo2018-01-31
| | | | | | | To make debugging a little easier. Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: 029-super-recovery: cleanup the testDavid Sterba2018-01-31
| | | | | | | Transform the test to the common helpers and don't manage the loop devices here. The test category changes from check to misc. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: Add test for super block recoveryNikolay Borisov2018-01-31
| | | | | | | | | This functionality regressed some time ago and it was never caught. Seems no one complained of that, but to be sure add a regression test to prevent future regressions. Signed-off-by: Nikolay Borisov <nborisov@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: Explictly state test.sh must be executableNikolay Borisov2018-01-31
| | | | | | Signed-off-by: Nikolay Borisov <nborisov@suse.com> Reviewed-by: <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: fix typo in error messageDavid Sterba2018-01-08
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests/mkfs: verify that mkfs.btrfs rootdir+shrink behaves correctlyQu Wenruo2018-01-08
| | | | | Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests/mkfs: Introduce test case to check if mkfs rootdir can ↵Qu Wenruo2018-01-08
| | | | | | | | | | | create a new file To test regression 460e93f25754 ("btrfs-progs: mkfs: check the status of file at mkfs"). Signed-off-by: Qu Wenruo <wqu@suse.com> [ update test to create a out of /tmp ] Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: test/mkfs: Test if the minimal device size is validQu Wenruo2018-01-08
| | | | | | | | | New test case to test if the minimal device size given by "mkfs.btrfs" failure case is valid. Signed-off-by: Qu Wenruo <wqu@suse.com> [ renamed script ] Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests/convert: ensure btrfs-convert won't rollback the ↵Qu Wenruo2018-01-03
| | | | | | | | filesystem after balance Signed-off-by: Qu Wenruo <wqu@suse.com> [ add shell quotes, rename test ] Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: test/common: Enhance prepare_test_dev to reset device sizeQu Wenruo2018-01-03
| | | | | | | | | So prepare_test_dev() can be called several times in one test case, to test different device sizes. Signed-off-by: Qu Wenruo <wqu@suse.com> [ switch to [ ] ] Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: test/common: Introduce run_mustfail_stdoutQu Wenruo2018-01-03
| | | | | | | For later test case which needs info from stderr. Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: fix typos in test namesDavid Sterba2018-01-03
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: mkfs/008 mkfs with forceDavid Sterba2018-01-03
| | | | | | | With extended tests in the following patch a file based filesystem image also needs -f, otherwise it will fail. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: test/fsck/021: Cleanup custom check by overriding check_imageQu Wenruo2018-01-03
| | | | | | Signed-off-by: Qu Wenruo <wqu@suse.com> [ update comment ] Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: test/fsck/020: Cleanup custom check function by overriding ↵Qu Wenruo2018-01-03
| | | | | | | check_image function Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: test/fsck: Introduce test images containing tree reloc treeQu Wenruo2018-01-03
| | | | | | | | | | | | | Reloc tree is a special tree with very short life span. It acts as a special snapshot for any tree, with related nodes/leaves or EXTENT_DATA modified to point to new position. Considering the short life span and its special purpose, it should be quite reasonable to keep them as both corner case for fsck and educational dump for anyone interested in relocation. Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: fsck-tests: Introduce test case with keyed data backref with ↵Qu Wenruo2018-01-03
| | | | | | | | | | | | | | | | | | | | | | | | | | | shared tree blocks For snapshot shared tree blocks with source subvolume, the keyed backref counter only counts the exclusive owned references. In the following case, 258 is a snapshot of 257, which inherits all the reference to this data extent. ------ item 4 key (12582912 EXTENT_ITEM 524288) itemoff 3741 itemsize 140 refs 179 gen 9 flags DATA extent data backref root 257 objectid 258 offset 0 count 49 extent data backref root 257 objectid 257 offset 0 count 1 extent data backref root 256 objectid 258 offset 0 count 128 extent data backref root 256 objectid 257 offset 0 count 1 ------ However lowmem mode used to iterate the whole inode to find all references, and doesn't care if a reference is already counted by the shared tree block. Add the test case to check it. Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: fsck-test: Add new image with shared block ref only metadata ↵Qu Wenruo2018-01-03
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | backref The image is dumped by modifying kernel to sleep long enough before merging relocation trees, so we can just copy the whole image to other place before kernel begins to merge reloc trees. And the base image is created by the following script to bump metadata size: ------ dev=~/test.img mnt=/mnt/btrfs umount $mnt &> /dev/null fallocate -l 128M $dev mkfs.btrfs -f -n 4k -m single -d single $dev mount $dev $mnt -o nospace_cache,max_inline=2048 btrfs subvolume create $mnt/src for i in $(seq -w 0 128); do xfs_io -f -c "pwrite 0 2k" $mnt/src/file_$i > /dev/null done for i in $(seq -w 0 64); do btrfs subvolume snapshot $mnt/src/ $mnt/snapshot_$i touch $mnt/snapshot_$i/new done sync ------ The image triggers several corner cases that the old lowmem mode didn't consider. Like metadata backref with FULL_BACKREF flag and only SHARED_BLOCK_REF backrefs for metadata. And several tree reloc trees with shared leaves/nodes to confuse old lowmem mode. Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: fsck-test: Introduce test case for false data extent backref lostQu Wenruo2018-01-03
| | | | | | | | | | | Introduce a new test image, which has an extent item with no inlined extent data ref, but all keyed extent data ref. Only in this case we can trigger fase data extent backref lost bug in lowmem mode. Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: test: Add test image for lowmem mode referencer count mismatch ↵Lu Fengqi2017-11-14
| | | | | | | | | | | false alert Add a image which can reproduce the extent item referencer count mismatch false alert for lowmem mode. Reported-by: Marc MERLIN <marc@merlins.org> Signed-off-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: test: Add test image for lowmem mode file extent interruptLu Fengqi2017-11-14
| | | | | | | | Add a image that the inlined extent coexist with the regular extent. Reported-by: Marc MERLIN <marc@merlins.org> Signed-off-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: extend fsck/028 to test fix-device-size and mountDavid Sterba2017-11-14
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests/fsck: Add test case image for 'rescue fix-dev-size'Qu Wenruo2017-11-14
| | | | | | | | | | | | | | | | The image has 2 problems mixed: 1) Too small super total_bytes This super total_bytes is manually modified to create such problem. 2) Unaligned dev item total_bytes This is created by v4.12 kernel, with 128M + 2K device added, and original device removed. Then we can create such image with unaligned dev item total_bytes. Signed-off-by: Qu Wenruo <quwenruo.btrfs@gmx.com> Reviewed-by: Nikolay Borisov <nborisov@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests/common: Display warning only after searching for btrfs ↵Lakshmipathi.G2017-11-14
| | | | | | | kernel module Signed-off-by: Lakshmipathi.G <lakshmipathi.g@giis.co.in> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: don't pass size to prepare_test_dev if not necessaryDavid Sterba2017-11-14
| | | | | | | Most tests don't need a specific size of the test device, the default 2GiB should be fine. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: test: add new cli-test for subvol get/set-defaultMisono, Tomohiro2017-11-14
| | | | | | | | Add new test to check functionality of subvol get/set-default. Signed-off-by: Tomohiro Misono <misono.tomohiro@jp.fujitsu.com> [ fix style issues, add missing SUDO_HELPER ] Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: fsck-tests: 027/bad_extent_inline_ref_typeSu Yue2017-11-14
| | | | | | | | This case is for avoiding crash in lowmem check mode. Field type of extent_inline_ref in an extent is corrupted. Signed-off-by: Su Yue <suy.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: Allow check test to repair in lowmem mode for certain errorsQu Wenruo2017-10-16
| | | | | | | | | | | | | | Since lowmem mode can repair certain corruptions (mostly in fs tree), insert a beacon into each fsck test cases to allow some of them be tested in lowmem mode. With this patch, fsck option override will check the beacon file ".lowmem_repairable" in the same directory of the test image, and if the beacon exists, then it will also run lowmem mode repair to repair the image. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: add more configure option coverageDavid Sterba2017-10-13
| | | | | | | * test convert spec string * explicitly ask for zstd, as it is now autodetected Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: fsck/007 fix so check --force worksDavid Sterba2017-10-13
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: arg override in command lineSu Yue2017-10-06
| | | | | | | | | | | | | | | | | Lowmem mode only repairs few cases which has a beacon file ".lowmem_repairable" in the case' directory. However, defining TEST_ENABLE_OVERRIDE=true in command line does work in above strategy. Because _skip_spec() in tests/common.local isn't interpreted by shell in that case. Solve it by making _skip_spec() always be defined in common.local. Reported-by: David Sterba <dsterba@suse.cz> Signed-off-by: Su Yue <suy.fnst@cn.fujitsu.com> [ keep the _skip_spec check ] Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: don't list toplevel subvolme in 'subvol list'David Sterba2017-10-06
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: misc-test: use raid1 for data to enable mount with -o degradedMisono, Tomohiro2017-10-06
| | | | | | | | | | | | | | | | | kernel 4.14 introduces new function for checking if all chunks is ok for mount with -o degraded option. commit 21634a19f646 ("btrfs: Introduce a function to check if all chunks a OK for degraded rw mount") As a result, raid0 profile cannot be mounted with -o degraded on 4.14. This causes failure of the misc-test 011 "delete missing device". Fix this by using raid1 profile for both data and metadata. This also should work for kernel before 4.13. Signed-off-by: Tomohiro Misono <misono.tomohiro@jp.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: check there are no unprintable characters in btrfs-image ↵David Sterba2017-09-25
| | | | | | -ss output Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: Remove misleading BCP 78 boilerplate from SHA implementationNicholas D Steeves2017-09-25
| | | | | | | | | | | | | | | | | | | BCP 78 applies to RFC 6234, but sha224-256.c is Simplified BSD. This causes the following lintian error when building on Debian and Debian derivatives: E: btrfs-progs source: license-problem-non-free-RFC-BCP78 tests/sha224-256.c Please consult the following email from debian-legal@lists.debian.org for more information: https://lists.debian.org/debian-legal/2017/08/msg00004.html Signed-off-by: Nicholas D Steeves <nsteeves@gmail.com> [ I've copied too much from the RFC that's not related to the code, covered by the explicit copyright notice in the file ] Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: Add required IETF Trust copyright to SHA implementationNicholas D Steeves2017-09-25
| | | | | Signed-off-by: Nicholas D Steeves <nsteeves@gmail.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: make sure _is_file_or_command does not get confusedDavid Sterba2017-09-25
| | | | | | | | | | | The test cli/007-check-force reports something like: $ type -p '--string that starts with dashes' bash: type: --: invalid option Add the option/argument separator. Signed-off-by: David Sterba <dsterba@suse.com>