Test case misc/038 uses hard coded backup slot number, this means if we
change how many transactions we commit during mkfs, it will immediately
break the tests.
Such hard coded tests will be a big pain for later btrfs-progs updates.
Update it with runtime backup slot search.
Such search is done by using current filesystem generation as a search
target and grab the slot number.
By this, no matter how many transactions we commit during mkfs, the test
case should be able to handle it.
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
The test misc-tests/038-backup-root-corruption expects a particular
layout of the backup roots but this gets slightly changed due to free
space tree.
$ make TEST=038-backup-root-corruption TEST_ARGS_MKFS='-Rfree-space-tree' TEST_ENABLE_OVERRIDE=true test-misc
Will result in test failure as the expected root is in slot 3 and not 2.
Update the test to try both.
Signed-off-by: David Sterba <dsterba@suse.com>
There are two utilities that are required for the testsuite but not
installed on systems. The path in tests must be INTERNAL_BIN.
Fix this issue for below tests:
* fsck-tests/013-extent-tree-rebuild
* fsck-tests/037-freespacetree-repair
* misc-tests/038-backup-root-corruption
Issue: #198
Signed-off-by: Long An <lan@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Ran misc-tests/038 in /root/btrfs-progs:
make test-misc TEST=038\*
[TEST] misc-tests.sh
[TEST/misc] 038-backup-root-corruption
./test.sh: line 33: [: bytenr=65536,: integer expression expected
Backup slot 2 is not in use
test failed for case 038-backup-root-corruption
make: *** [Makefile:401: test-misc] Error 1
It's caused by the wrong line filtered by
$(dump_super | grep root | head -n1 | awk '{print $2}').
The command $(dump-super | grep root) outputs:
superblock: bytenr=65536, device=/root/btrfs-progs/tests/test.img
root 30605312
chunk_root_generation 5
root_level 0
chunk_root 22036480
chunk_root_level 0
log_root 0
log_root_transid 0
log_root_level 0
root_dir 6
backup_roots[4]:
Here
"superblock: bytenr=65536, device=/root/btrfs-progs/tests/test.img" is
selected but not the line "root 30605312".
Restricting the awk rule can fix it.
Fixes: 78a3831d46 ("btrfs-progs: tests: Test backup root retention logic")
Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: Su Yue <Damenly_Su@gmx.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This tests ensures that the kernel correctly persists backup roots in
case the filesystem has been mounted from a backup root.
Signed-off-by: Nikolay Borisov <nborisov@suse.com>
[ cleanup to use common helpers ]
Signed-off-by: David Sterba <dsterba@suse.com>