Commit Graph

29 Commits (master)

Author SHA1 Message Date
David Sterba a66d9aa2e3 btrfs-progs: tests: drop keyword function
The shell keyword function is not necessary and not used in many tests,
remove it from the few places that use it right now.

Signed-off-by: David Sterba <dsterba@suse.com>
2019-07-04 15:36:01 +02:00
David Sterba a7e56ef21b btrfs-progs: tests: convert/014 use shell builtin for generating content
We can remove dependency on perl and use shell builtin go generate
sequence of bytes.

Signed-off-by: David Sterba <dsterba@suse.com>
2018-03-30 22:15:55 +02:00
Qu Wenruo b79681fe6d btrfs-progs: test/convert: Add test case for invalid large inline data extent
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2018-03-30 22:15:54 +02:00
Gu Jinxiang cebf3b3722 btrfs-progs: introduce TEST_TOP and INTERNAL_BIN for tests
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>
2018-02-13 15:41:32 +01:00
Qu Wenruo 1f36022071 btrfs-progs: tests/convert: ensure btrfs-convert won't rollback the filesystem after balance
Signed-off-by: Qu Wenruo <wqu@suse.com>
[ add shell quotes, rename test ]
Signed-off-by: David Sterba <dsterba@suse.com>
2018-01-03 17:29:19 +01:00
David Sterba a6e5cdef43 btrfs-progs: tests: don't pass size to prepare_test_dev if not necessary
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>
2017-11-14 15:59:00 +01:00
David Sterba 6fb88e2859 btrfs-progs: tests: check for kernel support for reiserfs
Signed-off-by: David Sterba <dsterba@suse.com>
2017-09-08 16:15:05 +02:00
David Sterba 7299e0d294 btrfs-progs: tests: enhance post-rollback fsck tests
The post-rollback helper still assumes just extN, we need an extra
argument that'll get passed to fsck. Change all callsites at once so the
tests do not fail temporarily.

Signed-off-by: David Sterba <dsterba@suse.com>
2017-09-08 16:15:05 +02:00
David Sterba 847ff667ce btrfs-progs: tests: add more checks for tools used in convert tests
Tools that may not be present in common installations should be checked
in the tests.

Signed-off-by: David Sterba <dsterba@suse.com>
2017-09-08 16:15:05 +02:00
Jeff Mahoney e75f466ddd btrfs-progs: tests: add support for converting reiserfs
Many of the test cases for convert apply regardless of what the source
file system is and using ext4 is sufficient.  I've included several
test cases that are reiserfs-specific.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
[ patch split from the previous one, minor cleanups in common.convert ]
Signed-off-by: David Sterba <dsterba@suse.com>
2017-09-08 16:15:05 +02:00
Jeff Mahoney 0cd4485178 btrfs-progs: tests: fix typo in convert-tests/008-readonly-image
The dd in convert-tests/008-readonly-image is expected to fail, so
there being a typo in the file name has gone unnoticed.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2017-08-24 19:07:37 +02:00
David Sterba 18b519e694 btrfs-progs: tests: use separate helper for mounting convert filesystems
We'll enforce the btrfs type for mount everwhere so we must provide a
way to mount converted filesystems. Add a new helper that will try to
mount the given type.

Signed-off-by: David Sterba <dsterba@suse.com>
2017-07-20 19:42:59 +02:00
David Sterba 46809a7287 btrfs-progs: tests: enhance API to request type of the converted filesystem
We'll use mount -t $fstype later on, extend the API so we don't have to
parse the type from other parameters.

Signed-off-by: David Sterba <dsterba@suse.com>
2017-07-20 19:42:42 +02:00
Tsutomu Itoh 8dcc1b6f65 btrfs-progs: tests: remove variable quotation from convert-tests
In btrfs-progs-v4.11-rc1, the following convert-tests failed.

    [TEST/conv]   008-readonly-image
    [TEST/conv]     readonly image test, btrfs defaults
failed: mke2fs -t ext4 -b 4096 -F /Build/btrfs-progs-v4.11-rc1/tests/test.img
test failed for case 008-readonly-image
Makefile:271: recipe for target 'test-convert' failed
make: *** [test-convert] Error 1
    [TEST/conv]   009-common-inode-flags
    [TEST/conv]     common inode flags test, btrfs defaults
failed: mke2fs -t ext4 -b 4096 -F /Build/btrfs-progs-v4.11-rc1/tests/test.img
test failed for case 009-common-inode-flags
Makefile:271: recipe for target 'test-convert' failed
make: *** [test-convert] Error 1

So, remove quotes from $default_mke2fs.

Signed-off-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2017-06-26 17:07:48 +02:00
Lakshmipathi.G ca1be56db5 btrfs-progs: tests: add variable quotation to convert-tests
Signed-off-by: Lakshmipathi.G <Lakshmipathi.G@giis.co.in>
Signed-off-by: David Sterba <dsterba@suse.com>
2017-05-15 16:13:17 +02:00
David Sterba 66b9b36805 btrfs-progs: tests: refactor post-convert check helpers
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>
2016-11-11 16:25:18 +01:00
David Sterba c8d1c4c792 btrfs-progs: tests: switch to dump- commands from inspect
The dump-super and debug-tree commands are replacements for the
standalone tools.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:13:37 +01:00
Qu Wenruo 8c663f9f36 btrfs-progs: convert-test: Add test case for common inode flags
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>
2016-10-24 14:58:15 +02:00
Qu Wenruo 4f3ccdd518 btrfs-progs: convert-test: Check if the ext2_save/image is read only
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>
2016-08-19 13:53:28 +02:00
David Sterba ebbddd7fd4 btrfs-progs: tests: add 007-unsupported-block-sizes
Check if block sizes smaller than 4k expectedly fail to convert.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-07-15 01:25:12 +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
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 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 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
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