Commit Graph

148 Commits (72e2a08a5c6d5f12be273e286e3355496e4a2f08)

Author SHA1 Message Date
David Sterba 52fda816e8 btrfs-progs: tests: use /bin/bash for scripts
Since we use 'source' in scripts, let's use bash everywhere.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-07-04 13:45:15 +02:00
Qu Wenruo 2e58edbdf4 btrfs-progs: convert-test: Add test case for discontinuous hole extent
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>
2016-07-04 13:44:58 +02:00
Luis Henriques 82aaf603e0 btrfs-progs: tests: 001-simple-unmounted: fix test failure due to bashism
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>
2016-07-04 13:37:24 +02:00
David Sterba cd9b35c37a btrfs-progs: tests: fix filesytem type creation for convert tests
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>
2016-06-22 15:52:17 +02:00
David Sterba 670b73fe0a btrfs-progs: tests: add 005-delete-all-rollback
Test if a rollback works after deleing all files from btrfs.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-06-22 15:50:17 +02:00
David Sterba 1280c2bbbd btrfs-progs: tests: update README
Signed-off-by: David Sterba <dsterba@suse.com>
2016-06-22 14:28:23 +02:00
David Sterba ac1e484a0a btrfs-progs: tests: add test console
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>
2016-06-22 14:07:46 +02:00
David Sterba 329ff544a4 btrfs-progs: tests: print shorter test name in the output
The full path is printed, we're interested in the last path component
only.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-06-22 11:30:24 +02:00
David Sterba f20f227877 btrfs-progs: tests: split convert_test
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>
2016-06-22 11:25:33 +02:00
David Sterba 81b427afcf btrfs-progs: tests: add 003-fi-resize-args
Check various resize option combinations.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-06-17 17:02:12 +02:00
David Sterba 75bf151ba3 btrfs-progs: tests: 004-ext2-backup-superblock-ranges, use common helpers for image loop
Signed-off-by: David Sterba <dsterba@suse.com>
2016-06-03 17:08:43 +02:00
David Sterba 933de7e034 btrfs-progs: tests: 004-ext2-backup-superblock-ranges, drop unnecessary root privs
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>
2016-06-03 17:01:36 +02:00
David Sterba e5f8099464 btrfs-progs: tests: unify test drivers
Remove unnecessary code, add exports to all common variables.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-06-03 16:53:27 +02:00
David Sterba b5ab8d42b7 btrfs-progs: tests: convert: set common variables
Signed-off-by: David Sterba <dsterba@suse.com>
2016-06-03 16:53:27 +02:00
David Sterba b06f44e50b btrfs-progs: tests: clean up the test driver of convert tests
Everything is now in separate tests, and TEST=mask now works.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-06-03 16:53:27 +02:00
David Sterba bea73f33b9 btrfs-progs: tests: convert: separate ext4 tests
Signed-off-by: David Sterba <dsterba@suse.com>
2016-06-03 16:53:27 +02:00
David Sterba cf8cc8ea45 btrfs-progs: tests: convert: separate ext3 tests
Signed-off-by: David Sterba <dsterba@suse.com>
2016-06-03 16:53:27 +02:00
David Sterba 79b0946f03 btrfs-progs: tests: convert: separate ext2 tests
Signed-off-by: David Sterba <dsterba@suse.com>
2016-06-03 16:53:27 +02:00
David Sterba a8e6d4fdfb btrfs-progs: tests: move convert helpers to a separate file
Signed-off-by: David Sterba <dsterba@suse.com>
2016-06-03 16:53:27 +02:00
Qu Wenruo dc4bbc37a1 btrfs-progs: convert-tests: Add test case for backup superblock migration
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>
2016-06-03 16:53:25 +02:00
Qu Wenruo fde5ae2e49 btrfs-progs: convert-tests: Add support for custom test scripts
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>
2016-06-03 15:22:18 +02:00
Qu Wenruo bb3c2ea224 btrfs-progs: convert-tests: Add test for backup superblock migration
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>
2016-06-01 15:37:23 +02:00
David Sterba 205bd5edbe btrfs-progs: tests: document cli-tests in readme
Signed-off-by: David Sterba <dsterba@suse.com>
2016-06-01 14:56:56 +02:00
David Sterba bff6828778 btrfs-progs: tests: convert: dump all superblocks after conversion
We want to see all of them, even if they're not valid.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-06-01 14:56:56 +02:00
David Sterba 0993ae5a73 btrfs-progs: tests: run rollback after conversion
Signed-off-by: David Sterba <dsterba@suse.com>
2016-06-01 14:56:56 +02:00
David Sterba 3f063f6bdc btrfs-progs: tests: convert, run md5sum with sudo helper
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>
2016-06-01 14:56:56 +02:00
Lu Fengqi 9071a10210 btrfs-progs: tests: add 020-extent-ref-cases
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>
2016-06-01 14:56:56 +02:00
Nicholas D Steeves bd2cc320af btrfs-progs: typo review of strings and comments
Signed-off-by: Nicholas D Steeves <nsteeves@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2016-06-01 14:56:56 +02:00
Liu Bo f2873c47d7 btrfs-progs: add fuzzed testing images, superblock and chunks
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>
2016-05-11 16:37:48 +02:00
David Sterba 0121270a79 btrfs-progs: tests: add 002-balance-full-no-filters
Coverage of new balance option --full-balance.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-05-02 14:59:48 +02:00
David Sterba d75f0c12d2 btrfs-progs: tests: add support for command line coverage tests
Signed-off-by: David Sterba <dsterba@suse.com>
2016-05-02 14:39:46 +02:00
David Sterba 39992e60a3 btrfs-progs: tests: update 001-basic-profiles, dup on multidev fs
Testcase for "btrfs-progs: mkfs: fix an error when using DUP on multidev
fs"

Signed-off-by: David Sterba <dsterba@suse.com>
2016-03-30 16:26:49 +02:00
David Sterba d7477bcd0b btrfs-progs: tests: add misc 014-filesystem-label
Test various label lengths on a mounted filesystem.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-03-30 16:26:09 +02:00
David Sterba 10d308d5ea btrfs-progs: tests: introduce mustfail helper
Invalid syntax, expected failure on corrupted data etc. Failure is
success.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-03-30 16:25:59 +02:00
David Sterba 92e922bafe btrfs-progs: tests: enumerate RWX in convert tests
Generating all valid combinations takes too much time.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-03-18 17:11:25 +01:00
Lakshmipathi.G 971d8e7476 btrfs-progs: tests: populate fs with small dataset for convert tests
Signed-off-by: Lakshmipathi.G <Lakshmipathi.G@giis.co.in>
[ minor tweaks ]
Signed-off-by: David Sterba <dsterba@suse.com>
2016-03-18 17:03:58 +01:00
David Sterba 974d2ed564 btrfs-progs: tests: add 013-subvolume-sync-crash
Test for "btrfs-progs: subvol sync: fix memory corruption, undersized
array", a lot of deleted subvolumes in the 'subvol sync' will not fit
into the array, should result in a glibc report.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-03-17 14:22:43 +01:00
David Sterba 9f76654de8 btrfs-progs: tests: add image for bko#96971 (bad checksum type)
Signed-off-by: David Sterba <dsterba@suse.com>
2016-03-14 13:42:47 +01:00
David Sterba 49fef369ff btrfs-progs: tests: fix misc/005-long-device-name-for-ssd
We use a device mapper device on top of a loop device, the change in
rotational status does not always propagate if change it at the loop
device sysfs node.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-03-14 13:42:47 +01:00
Qu Wenruo 154d28dd99 btrfs-progs: misc-test: Add regression test for find-root gives empty result
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>
2016-02-26 17:27:58 +01:00
David Sterba 476d17fe38 btrfs-progs: tests: use common variables and helpers
Use TEST_DEV and the associated helpers to manage the tested image.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-02-23 19:02:23 +01:00
David Sterba 0ad5efde1a btrfs-progs: tests: store checksums in /tmp
We don't want to store the checksum on filesystem that we're converting.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-02-23 19:02:23 +01:00
Lakshmipathi.G cc57faac2e btrfs-progs: tests: do checksum verification with convert-tests
Signed-off-by: Lakshmipathi.G <Lakshmipathi.G@giis.co.in>
Signed-off-by: David Sterba <dsterba@suse.com>
2016-02-23 19:02:23 +01:00
David Sterba ac45d64c04 btrfs-progs: tests: add missing prerequisites
Signed-off-by: David Sterba <dsterba@suse.com>
2016-01-12 15:16:11 +01:00
Naohiro Aota ebb66f20ae btrfs-progs: tests: test multiple-linked file corruption
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>
2016-01-12 15:01:03 +01:00
David Sterba 05d4159946 btrfs-progs: tests: print test type
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>
2016-01-12 15:01:02 +01:00
David Sterba 5f03d1fc23 btrfs-progs: tests: add sys-array-num-stripes-0.raw.xz
Signed-off-by: David Sterba <dsterba@suse.com>
2016-01-04 11:28:24 +01:00
Qu Wenruo 16e240eca7 btrfs-progs: tests: mkfs, check sectorsize and nodesize combinations
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>
2016-01-04 11:28:24 +01:00
David Sterba 1d37645dc3 btrfs-progs: tests: enhance 001-basic-profiles with --data DUP
Add the remaining valid combinations.

Signed-off-by: David Sterba <dsterba@suse.com>
2015-11-26 16:22:16 +01:00
David Sterba 3504df7f02 btrfs-progs: tests: add 019-non-skinny-false-alert
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>
2015-11-26 15:20:35 +01:00