Commit Graph

121 Commits (bd2cc320aff5789fe4034736fa6da8b4ebae475f)

Author SHA1 Message Date
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
David Sterba b7a69afe69 btrfs-progs: tests: add 007-mix-nodesize-sectorsize
Test combinations of sectorsize and nodesize on a single device.

Signed-off-by: David Sterba <dsterba@suse.com>
2015-11-19 16:37:15 +01:00
David Sterba a343805d58 btrfs-progs: tests: add 006-partitioned-loopdev
Create filesystem on a partitioned loop device, test for "btrfs-progs:
Fix partitioned loop devices resolving".

Signed-off-by: David Sterba <dsterba@suse.com>
2015-11-16 14:23:46 +01:00
David Sterba 1b9876f761 btrfs-progs: tests: add 005-long-device-name-for-ssd
A test for "btrfs-progs: mkfs: increase buffer size in is_ssd". Create a
device with a long name through loop device wrapped to a device mapper
linear device, switch it to the "ssd" mode status.

Signed-off-by: David Sterba <dsterba@suse.com>
2015-11-16 14:23:45 +01:00
David Sterba 87ab14013a btrfs-progs: tests: add 011-delete-missing-device
Test for "btrfs-progs: allow device deletion using 'missing' keyword
again".

Signed-off-by: David Sterba <dsterba@suse.com>
2015-11-16 14:23:44 +01:00
David Sterba f2c844f65f btrfs-progs: mkfs: do not truncate the image when --rootdir is set
With the rootdir option we try to guess the final size of the image and
fill it with zeros, preceded by truncation. After patch

"Btrfs-progs: Do not force mixed block group creation unless '-M' option
 is specified"

the misc test 002 will fail, because of the non-mixed mode. I think we
should not touch the image size (no change for block devices) and try to
fit into whatever is provided by user.

Signed-off-by: David Sterba <dsterba@suse.com>
2015-11-05 14:49:02 +01:00
David Sterba 835821f36a btrfs-progs: add initial tests/README
Signed-off-by: David Sterba <dsterba@suse.com>
2015-11-02 15:10:14 +01:00
David Sterba cb10f56cb6 btrfs-progs: tests: add 003-mixed-with-wrong-nodesize
Mixed mode needs equal sectorsize and nodesize. This was fixed by

 "Btrfs-progs: Prevent creation of filesystem with 'mixed bgs' and
  having differing sectorsize and nodesize"

Signed-off-by: David Sterba <dsterba@suse.com>
2015-11-02 09:35:08 +01:00
David Sterba 425274ed8f btrfs-progs: tests: do not log output of run_mayfail to terminal
No need to log expected failures to the terminal, the results file is
fine; pass the return value of the command.

Signed-off-by: David Sterba <dsterba@suse.com>
2015-11-02 09:35:08 +01:00
David Sterba 1c4aefc2b8 btrfs-progs: tests: add support for command instrumentation
Add a way to wrap commands executed by the tests. This means the
common wrappers: run_check, run_check_stdout and run_mayfail , with the
exception of the use root_helper.

The contents of the shell variable INSTRUMENT are prepended to the
command, without quotes. Use with care.

Example: this has been tested with valgrind, the output goes to the
RESULTS file.

 $ INSTRUMENT=valgrind make test-misc

Any use of root_helper/SUDO_HELPER will skip the instrumentation.

Signed-off-by: David Sterba <dsterba@suse.com>
2015-11-02 09:35:07 +01:00
David Sterba dfed5799db btrfs-progs: tests: 001-simple-unmounted: iterate over fuzzed images and run check
Signed-off-by: David Sterba <dsterba@suse.com>
2015-11-02 09:35:07 +01:00
David Sterba b85c7b7694 btrfs-progs: tests: add test driver for fuzzed images
Signed-off-by: David Sterba <dsterba@suse.com>
2015-11-02 09:35:07 +01:00
David Sterba 1fcb190793 btrfs-progs: tests: do not run sudo helper tests if not necessary
We use setup_root_helper in some helpers to make sure that the sudo
helper is set up, and adding that to each test. Make the real test run
only once.

Signed-off-by: David Sterba <dsterba@suse.com>
2015-11-02 09:35:06 +01:00
David Sterba 6105df64a1 btrfs-progs: tests: set default test image size to 2G
Signed-off-by: David Sterba <dsterba@suse.com>
2015-11-02 09:35:06 +01:00
David Sterba 11f7a8c8de btrfs-progs: tests: add 010-convert-delete-ext2-subvol
Testcase for "Btrfs-progs: fix btrfs-convert rollback to check
ROOT_BACKREF", make sure we don't try a rollback if the ext2_subvol is
half-deleted.

Signed-off-by: David Sterba <dsterba@suse.com>
2015-11-02 09:35:06 +01:00
David Sterba 1e92cd0d9b btrfs-progs: tests: add 002-no-force-mixed-on-small-volume
Verify that we do not force mixed block groups on small volumes anymore.

Signed-off-by: David Sterba <dsterba@suse.com>
2015-11-02 09:35:05 +01:00
David Sterba ed54f0eee3 btrfs-progs: tests: add 001-basic-profiles mkfs tests
Basic test to cover block group profile combinations.

Signed-off-by: David Sterba <dsterba@suse.com>
2015-11-02 09:35:05 +01:00
David Sterba a141d51696 btrfs-progs: tests: add mkfs tests
Mkfs deserves it's own.

Signed-off-by: David Sterba <dsterba@suse.com>
2015-11-02 09:35:05 +01:00
David Sterba c2e85337f6 btrfs-progs: tests: print commands on terminal if requested
Set the variable TEST_LOG=tty (in the enviroment or as parameter to
make) to print commands executed by 'run_check' helpers to terminal (ie.
/dev/tty). This might be useful to see the test progress beside watching
the results file.

Signed-off-by: David Sterba <dsterba@suse.com>
2015-10-21 14:29:26 +02:00
David Sterba 982950b74b btrfs-progs: misc tests: add 009-subvolume-sync-must-wait
Test to verify that subovolume sync waits until the subvolume is
cleaned.

Signed-off-by: David Sterba <dsterba@suse.com>
2015-10-21 14:29:26 +02:00
Zhao Lei 9c3ce57e6b btrfs-progs: tests: Avoid printing useless warning in fsck tests
002-bad-transid outout 'transid verify failed' message in screen
which is just a warning in btrfs-image in normal condition of this
test.

This patch move above warning into $RESULTS, to:
1: Avoid trouble screen output
2: Let user known detail if other error happened in btrfs-image

Before patch:
  # ./fsck-tests.sh
    [TEST]   001-bad-file-extent-bytenr
    [TEST]   002-bad-transid
  parent transid verify failed on 29360128 wanted 9 found 755944791
  parent transid verify failed on 29360128 wanted 9 found 755944791
  Ignoring transid failure
    [TEST]   003-shift-offsets
    [TEST]   004-no-dir-index
  ...

After patch:
  # ./fsck-tests.sh
  [TEST]   001-bad-file-extent-bytenr
  [TEST]   002-bad-transid
  [TEST]   003-shift-offsets
  [TEST]   004-no-dir-index
  ...

Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2015-10-19 11:48:24 +02:00
Zhao Lei 9e0c8e148d btrfs-progs: tests: Introduce misc-tests/008-leaf-crossing-stripes
To check is btrfs-convert create bad filesystem with
leaf across stripes.

It is happened in progs version <=v4.1.2, and fixed by patch titled:
btrfs: convert: Avoid allocating metadata extent crossing stripe boundary
which was merged in v4.2.

Notice thar this testcase can not report error in old version of
btrfs-progs, because "btrfs check" can't check this type of error
in those version, but we have another testcase in fsck-tests, to
check is "btrfs check" support this check.

So, the above 2 testcase together can check leaf-crossing-stripes
bug in all versions.

Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
[renamed and other minor changes]
Signed-off-by: David Sterba <dsterba@suse.com>
2015-10-19 11:48:24 +02:00
Zhao Lei 5f77daa6a1 btrfs-progs: tests: Introduce fsck-tests/018-leaf-crossing-stripes
To test if fsck can check detec "leaf crossing stripes".

This function was introduced from patch titled:
btrfs-progs: fsck: Check if a metadata tree block crossing stripe boundary

Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
[renamed and other minor changes]
Signed-off-by: David Sterba <dsterba@suse.com>
2015-10-19 11:48:24 +02:00
Zhao Lei 5627eee02b btrfs-progs: tests: Move extract_image out of check_all_images for common use
Move code for extract image file to a function from check_all_images()
for common use, so caller can use this function to extrace single
image file.

Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
[minor reformatting and updates]
Signed-off-by: David Sterba <dsterba@suse.com>
2015-10-19 11:48:24 +02:00
Zhao Lei ebd6d2e683 btrfs-progs: tests: Add '-o loop' to mount command line in convert-tests.sh
To fix following bug:
 # ./convert-tests.sh
     [TEST]   ext2 4k nodesize, btrfs defaults
 failed: mount /root/btrfsprogs/tests/test.img /root/btrfsprogs/tests/mnt
 # tail convert-tests-results.txt
 ...
 ############### mount /root/btrfsprogs/tests/test.img /root/btrfsprogs/tests/mnt
 mount: /root/btrfsprogs/tests/test.img is not a block device (maybe try `-o loop'?)
 failed: mount /root/btrfsprogs/tests/test.img /root/btrfsprogs/tests/mnt

Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2015-09-20 14:31:02 +02:00
David Sterba a365b84a32 btrfs-progs: tests: add crafted and fuzzed images
A collection of several images that were produced in a non-standard way
and cause various errors in check or image tools. They do not fit into
the fsck tests as we're not able to repair any of them, but the tools
should not crash or do out-of-bounds access.

Signed-off-by: David Sterba <dsterba@suse.com>
2015-09-09 17:09:01 +02:00
Zhao Lei 34fa747ec8 btrfs-progs: tests: Use mount_test_dev for misc-tests/007-subvolume-sync
So this test can support both block device and loop device simply.

Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2015-09-01 14:53:16 +02:00
Zhao Lei d4c4443c2d btrfs-progs: tests: Fix mount fail of 013-extent-tree-rebuild
mount command in old system can not add "-o loop" option automatically
for loop device, and make following test failed:
  # ./fsck-tests.sh
  ...
    [TEST]   013-extent-tree-rebuild
  failed: mount /data/btrfsprogs/tests/test.img /data/btrfsprogs/tests/mnt
  test failed for case 013-extent-tree-rebuild

Considering that $TEST_DEV can be block or loop device, we need determine
our mount option in a condition for both case.

This patch create a wrapper function for above request, to solve current
problem in 013-extent-tree-rebuild, and support similar request in future.

Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2015-09-01 14:53:16 +02:00