Populate fs after convert so we can trigger data chunk allocation.
This can expose too restrict old rollback condition
Reported-by: Chandan Rajendra <chandan@linux.vnet.ibm.com>
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
The travis CI does not have losetup with --partscan, skip the check in
that case so we can still run the mkfs testsuite.
Signed-off-by: David Sterba <dsterba@suse.com>
Add convenient support for extending command arguments, now implemented
for 'btrfs check' to cover the low-memory mode. If defined, arguments
are inserted to any 'btrfs check' command in tests. Exceptions could be
defined in common.local.
Signed-off-by: David Sterba <dsterba@suse.com>
The list of rwx permissions is now hardcoded but used to begenerated and
the invalid numbers filtered out. Not necessary anymore.
Signed-off-by: David Sterba <dsterba@suse.com>
In my test environment, following error was occurred because the size
of /lib/modules/`uname -r`/* is larger than 1GB.
# make test-fsck
[TEST] fsck-tests.sh
[TEST/fsck] 013-extent-tree-rebuild
failed: cp -aR /lib/modules/4.9.0-rc5/ /test/btrfs-progs/tests/mnt
test failed for case 013-extent-tree-rebuild
Makefile:272: recipe for target 'test-fsck' failed
make: *** [test-fsck] Error 1
#
In this test case, 'generate_dataset small' is enough for making the
test files, so I will use 'generate_dataset' instead of 'cp'.
For this, move 'generate_dataset()' from 'common.convert' to 'common'.
Signed-off-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
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>
The option --list might not be available on older versions, the
equvalent is --all. Discovered via failed travis build.
Signed-off-by: David Sterba <dsterba@suse.com>
The current user might not be able to peek into the loop files directly,
use the helper. Discovered by running tests in travis.
Signed-off-by: David Sterba <dsterba@suse.com>
Fixing the problems by one does not scale now. Add more images despite
the fuzz tests will fail. They have been for some time already.
Reported-by: Lukas Lueg <lukas.lueg@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Separate checksum test from convert_test_post_check and use it to fix
the broken test 005 as reported.
References: https://bugzilla.kernel.org/show_bug.cgi?id=177141
Signed-off-by: David Sterba <dsterba@suse.com>
Sending stream size of clone-src(-c) option is checked.
Fixed by "btrfs-progs: send: fix handling of -c option".
Signed-off-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Add test case to check the basic function of --clear-space-cache.
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
For image with tree reloc tree, if its height is over level 2, the root
node's backref will point to itself. It's valid for kernel, but quota
verify code can't handle it and cause a infinite call, overflowing the
stack.
Add minimal image to reproduce the bug, as regression test.
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
[ minor cleanups in test.sh ]
Signed-off-by: David Sterba <dsterba@suse.com>
Fixed by commit 7c646c538e btrfs-progs: qgroup: Fix regression leads
to corrupted qgroup status.
Add minimal test image for that fix.
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
[ minor cleanups in test.sh ]
Signed-off-by: David Sterba <dsterba@suse.com>
Add a new test case to check if btrfs-convert copies common inode flags
like append(a), immutable(i).
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
[ minor fixes ]
Signed-off-by: David Sterba <dsterba@suse.com>
Some fuzzed images cause various tools to crash but the mayfail helper
would not recognize that. We don't mind if the utility failes but it
must not crash.
Signed-off-by: David Sterba <dsterba@suse.com>
Add test case image for unaligned tree block ptr.
It should lead to BUG_ON in free_extent_buffer().
Reported-by: Lukas Lueg <lukas.lueg@gmail.com>
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
[ added bko-NNN- prefix to the files ]
Signed-off-by: David Sterba <dsterba@suse.com>
Reported by Lukas and the same image from him.
DATA_RELOC tree's key type is modifed to CHUNK_ITEM, causing btrfsck
interpret it as CHUNK_ITEM and cause 0 num_stripes.
Add the image to fuzz-test.
Reported-by: Lukas Lueg <lukas.lueg@gmail.com>
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
[ added bko-NNN- prefix to the files ]
Signed-off-by: David Sterba <dsterba@suse.com>
Old convert codes uses both 0400 permission and INODE_READONLY flag to
make the converted ext2 image readonly.
While new convert treat the inode just as normal inode, with no special
inode flag and uses 0600 permission.
This makes user able to modify converted image unintentionally and make
rollback fails.
This test case will test the regression.
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
If btrfs isn't in the path, this test will fail with:
[TEST/misc] 006-image-on-missing-device
failed: btrfs fi show /dev/loop0
test failed for case 006-image-on-missing-device
Makefile:226: recipe for target 'test-misc' failed
make: *** [test-misc] Error 1
Fix the test script by adding $TOP to the path.
Signed-off-by: Luis Henriques <henrix@camandro.org>
[ updated to full command names ]
Signed-off-by: David Sterba <dsterba@suse.com>
For ext* fs containing a large hole(larger than 128M), btrfs-convert
will only insert one 128M hole extent and skip the remaining.
This leads to discontinuous file extents.
Add test case for it, and since it's a pinpoint regression test case, no
combination of convert options nor checksum verification.
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
The usage of 'source' is a bashism, and '.' should be used instead. This
is causing fuzz-tests/001-simple-unmounted to fail in systems where
/bin/sh isn't bash:
[TEST/fuzz] 001-simple-unmounted
./test.sh: 5: ./test.sh: source: not found
./test.sh: 7: ./test.sh: setup_root_helper: not found
./test.sh: 8: ./test.sh: check_prereq: not found
./test.sh: 18: ./test.sh: check_all_images: not found
Since most (all?) tests actually use /bin/bash, change this test to use
bash too.
Signed-off-by: Luis Henriques <henrix@camandro.org>
Signed-off-by: David Sterba <dsterba@suse.com>
The extN filesystem type was lost when the separate tests were created
and we've been testing only ext2. The tests pass for ext3 and ext4
though.
Signed-off-by: David Sterba <dsterba@suse.com>
Add a wrapper that sets up environment the same way a test would use it.
Use it for quick prototyping or testing, the commands and output is
logged.
Signed-off-by: David Sterba <dsterba@suse.com>
Split the big function to several helpers so we can use them separately.
Add comments and do minor tweaks.
Signed-off-by: David Sterba <dsterba@suse.com>
We really use root only for mount/umount and access to the ext2_saved
image (that has 0600). Also switch to common variable so we can use
helpers.
Signed-off-by: David Sterba <dsterba@suse.com>
New convert introduced simpler chunk/extent allocation algorithm, at the
cost of complex backup superblock migration codes.
Use specially built ext2 images to test if btrfs-convert can convert and
rollback images without problem.
All these special ext2 image have blocks/holes across 2nd btrfs backup
superblock.
The naming of test image is like the following:
|<------superblock migration range----->|
64M 64M + 64K
|-Data--|-Data--|/Hole//|-Data--|/Hole//|-Data--|--Data--| = drdhdhdrd
These test cases should check all typical layouts and make sure new
convert works.
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Add support for custom convert test scripts, just like fsck tests.
Instead of generic convert tests, we need more specifically created images
for new convert tests.
This patch provide the needed infrastructure for later convert test
cases.
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
New convert framework uses new and simpler chunk layout, while the cost
is the more complex superblock range migration logical, compared to old
convert.
Enhance the convert test script to create file which will takes up 2nd
backup superblock space, to ensure the superblock migration is working
as expected.
Suggested-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Some of the files might not end up in the checksum list because of
permissions. This is reported by md5sum as incorrectly formatted lines.
Signed-off-by: David Sterba <dsterba@suse.com>
In order to confirm that btrfsck supports to check a variety of
refs, add the
following cases:
* keyed_block_ref
* keyed_data_ref
* shared_block_ref
* shared_data_ref
* no_inline_ref (a extent item without inline ref)
* no_skinny_ref
Signed-off-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This adds 4 fuzz testing images, btrfsck either doesn't detect errors
in them or crashes immediately.
Reported-by: Vegard Nossum <vegard.nossum@oracle.com>
Reported-by: Quentin Casasnovas <quentin.casasnovas@oracle.com>
Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>