Commit Graph

286 Commits (e4c6772f69bff7bb75d8df0d5010a1091d6e47eb)

Author SHA1 Message Date
David Sterba 5faec98439 btrfs-progs: tests: check there are no unprintable characters in btrfs-image -ss output
Signed-off-by: David Sterba <dsterba@suse.com>
2017-09-25 15:18:46 +02:00
Nicholas D Steeves 5b2fbc6f4e btrfs-progs: tests: Remove misleading BCP 78 boilerplate from SHA implementation
BCP 78 applies to RFC 6234, but sha224-256.c is Simplified BSD.

This causes the following lintian error when building on Debian and
Debian derivatives:

    E: btrfs-progs source: license-problem-non-free-RFC-BCP78
       tests/sha224-256.c

Please consult the following email from debian-legal@lists.debian.org
for more information:

https://lists.debian.org/debian-legal/2017/08/msg00004.html
Signed-off-by: Nicholas D Steeves <nsteeves@gmail.com>
[ I've copied too much from the RFC that's not related to the code,
  covered by the explicit copyright notice in the file ]
Signed-off-by: David Sterba <dsterba@suse.com>
2017-09-25 15:18:15 +02:00
Nicholas D Steeves ac71751828 btrfs-progs: tests: Add required IETF Trust copyright to SHA implementation
Signed-off-by: Nicholas D Steeves <nsteeves@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2017-09-25 15:18:12 +02:00
David Sterba 509af95c92 btrfs-progs: tests: make sure _is_file_or_command does not get confused
The test cli/007-check-force reports something like:

$ type -p '--string that starts with dashes'
bash: type: --: invalid option

Add the option/argument separator.

Signed-off-by: David Sterba <dsterba@suse.com>
2017-09-25 15:18:05 +02:00
David Sterba 01bcf68cf5 btrfs-progs: tests: remove temporary images in mkfs/005 and mkfs/006
Signed-off-by: David Sterba <dsterba@suse.com>
2017-09-25 15:17:31 +02:00
David Sterba 03fb34b6b4 btrfs-progs: tests: remove temporary loopdev files
Remove files for testing loop devices when using the helper.

Signed-off-by: David Sterba <dsterba@suse.com>
2017-09-25 15:17:28 +02:00
Nick Terrell 0766330f85 btrfs-progs: tests: add testing image for zstd for btrfs-restore
Adds tests for the new features based on a prebuilt btrfs image with a
zstd compressed file.

Split from the previous patch.

Signed-off-by: Nick Terrell <terrelln@fb.com>
[ with some cleanups ]
Signed-off-by: David Sterba <dsterba@suse.com>
2017-09-25 15:17:15 +02:00
David Sterba 67b7b4bc40 btrfs-progs: tests: fix run_mustfail in cli-tests/007-check-force
The sanity check in run_mustfail does not work as expected and allowed
the command to continue without the missing parameter

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=196893
Signed-off-by: David Sterba <dsterba@suse.com>
2017-09-25 15:17:06 +02:00
Misono, Tomohiro a351dd8478 btrfs-progs: test: add new test for inspect-internal rootid
This new test checks inspect-internal rootid
 - handle path to subvolume/directory/file as an argument
 - get different id for each subvolume
 - get the expected id for each file/directory (i.e. the same as
	 containing subvolume)

Signed-off-by: Tomohiro Misono <misono.tomohiro@jp.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2017-09-08 16:15:05 +02: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
Misono, Tomohiro cb39164f9d btrfs-progs: test: fix name generation not to contain trailing spaces
First patch causes test-convert fails.  This is because
generate_dataset() creates a name containing trailing spaces for
"slow_symlink" type, and cause getfacl error in convert_test_perm().
(This is not noticed since original run_check_stdout() throws away the
error.)

Fix this by use space for delimiter for cut.

Signed-off-by: Tomohiro Misono <misono.tomohiro@jp.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2017-09-08 16:15:05 +02:00
Misono, Tomohiro 02e9bb9f23 btrfs-progs: test: fix run_check_stdout() call _fail()
run_check_stdout() uses "... | tee ... || _fail".  However, since tee
won't fail, _fail() is not called even if first command fails.

Fix this by checking PIPESTATUS in the end.

Signed-off-by: Tomohiro Misono <misono.tomohiro@jp.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2017-09-08 16:15:05 +02:00
Qu Wenruo dbe96ecd3f btrfs-progs: tests: Add test case for mkfs --rootdir parameter
Add test case which checks if -r|--rootdir mkfs option can handle
symlink/char/block/fifo files.

Signed-off-by: Qu Wenruo <quwenruo.btrfs@gmx.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2017-09-08 16:15:05 +02:00
David Sterba df4a04484a btrfs-progs: tests: missing device and slack space report
Verify that a missing device will not result in reporting a negative
value interpreted as 16EiB.

Signed-off-by: David Sterba <dsterba@suse.com>
2017-09-08 16:15:05 +02:00
David Sterba f47587d83d btrfs-progs: tests: convert misc/011-delete-missing-device to loopdevs
Signed-off-by: David Sterba <dsterba@suse.com>
2017-09-08 16:15:05 +02:00
David Sterba 83fe48c54b btrfs-progs: tests: convert misc/006-image-on-missing-device to loopdevs
Signed-off-by: David Sterba <dsterba@suse.com>
2017-09-08 16:15:05 +02:00
David Sterba 528a5bf6ad btrfs-progs: tests: move loopdev helpers out of the testcase to common
Signed-off-by: David Sterba <dsterba@suse.com>
2017-09-08 16:15:05 +02:00
David Sterba 3a6895b823 btrfs-progs: tests: cleanup loop device helpers
Make the loop device helpers a bit more generic before moving them to
the common helpers.

Signed-off-by: David Sterba <dsterba@suse.com>
2017-09-08 16:15:05 +02:00
David Sterba 872837ebbf btrfs-progs: tests: add testcase for 'fi du' and empty subvol
Signed-off-by: David Sterba <dsterba@suse.com>
2017-09-08 16:15:05 +02:00
David Sterba a36d92cb8b btrfs-progs: tests: add test for check --force
Basic test of the --force functionality, on an empty filesystem.

Signed-off-by: David Sterba <dsterba@suse.com>
2017-09-08 16:15:05 +02:00
David Sterba 4851de27f1 btrfs-progs: tests: add more sanitizer message patterns to log scanner
Signed-off-by: David Sterba <dsterba@suse.com>
2017-09-08 16:15:05 +02:00
David Sterba c9141313ec btrfs-progs: tests: limit size of log dump from conver tests
The convert tests generate lots of log material, travis CI has limit 4MB
so we don't see anything useful when a late test fails.

Signed-off-by: David Sterba <dsterba@suse.com>
2017-09-08 16:15:05 +02:00
David Sterba eae83c46f7 btrfs-progs: tests: fix TEST_LOG=dump in convert tests
Test failure in convert tests with log dump does not happen because
_fail is called before that and exits. Other test types are ok.

Signed-off-by: David Sterba <dsterba@suse.com>
2017-09-08 16:15:05 +02:00
David Sterba c4dd5fef8a btrfs-progs: tests: update README
Wording, runtime dependencies.

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
David Sterba ee37252115 btrfs-progs: tests: add build checks for sanitization features
Signed-off-by: David Sterba <dsterba@suse.com>
2017-09-08 16:15:05 +02:00
David Sterba 092698b40a btrfs-progs: tests: add more fuzzed images from bugzilla
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
David Sterba fb0d53a937 btrfs-progs: tests: fix _is_file_or_command detection
type -p returns an empty string for nonexistent commands, but the -f
test on an empty string does not behave the same on all shells. To be
safe, use the quoted value.

Signed-off-by: David Sterba <dsterba@suse.com>
2017-08-25 15:58:05 +02:00
David Sterba d7dd9d00e9 btrfs-progs: tests: catch bad usage of run_mustfail
This function has an extra argument and can get forgotten, add a sanity
check so the bad usage can be caught during development.

Signed-off-by: David Sterba <dsterba@suse.com>
2017-08-24 19:08:18 +02:00
David Sterba f0c7703671 btrfs-progs: tests: scan results for commands not found
In case of typos or messed up command execution, we'd like to be able to
catch that.

Signed-off-by: David Sterba <dsterba@suse.com>
2017-08-24 19:08:02 +02:00
Su Yue 515ea7dc2f btrfs-progs: fsck-test: case for corrupted dir item name
In this test case, all name in dir_item, dir_index, inode_ref
are corrupted to another one.
btrfs check should report errors about the corrupted dir_item but
btrfs can't repair the case now.

Signed-off-by: Su Yue <suy.fnst@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2017-08-24 19:07:58 +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
Adam Buchbinder 5c2cf48a4c btrfs-progs: tests: Use '-t btrfs' mount option in tests
Without it, mount (at least from util-linux 2.20.1) tries (and fails) to
mount some filesystems as NTFS.

Signed-off-by: Adam Buchbinder <abuchbinder@google.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2017-07-20 19:46:11 +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
Adam Buchbinder 50d037b459 btrfs-progs: tests: Fix missing internal deps in check and misc tests
Doing a straight 'make test' would fail because some misc and fsck
tests require particular tools to already be built. Add dependencies
at the Makefile and shell-script level.

Signed-off-by: Adam Buchbinder <abuchbinder@google.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2017-07-20 17:43:43 +02:00
Qu Wenruo bb305ae832 btrfs-progs: tests: Add test case to check file hole extents with NO_HOLES flag
Add test case which we have NO_HOLES incompat flag while still have
hole file extent.

This can be created by enabling NO_HOLES feature on an existing
filesystem, which lowmem mode would cause false alert for it.

Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
[ minor adjustments ]
Signed-off-by: David Sterba <dsterba@suse.com>
2017-06-26 17:10:02 +02:00
Filipe Manana c1c9875034 btrfs-progs: test for restoring multiple devices fs into a single device
Test that we are able to create an image from a multiple devices fs, that
we are able to restore that image into a single device and finally that we
are able to mount it.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Liu Bo <bo.li.liu@oracle.com>
[ added shell quotation and chmod a+w so testsuite on NFS works ]
Signed-off-by: David Sterba <dsterba@suse.com>
2017-06-26 17:07:54 +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
David Sterba 68d303bdbb btrfs-progs: tests: fix misc/019-receive-clones-on-munted-subvol
Patches "btrfs-progs: tests: correctly receive clones to mounted subvol"
(8eaf63bc9a) and followup are missing last
unmount which leads to failure of misc/020.

Signed-off-by: David Sterba <dsterba@suse.com>
2017-05-15 16:36:11 +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 b75c0720a4 btrfs-progs: fssum: fix warning, include correct header for major()
tests/fssum.c:599:13: warning: In the GNU C Library, "major" is defined
 by <sys/sysmacros.h>. For historical compatibility, it is
 currently defined by <sys/types.h> as well, but we plan to
 remove this soon. To use "major", include <sys/sysmacros.h>
 directly. If you did not intend to use a system-defined macro
 "major", you should undefine it after including <sys/types.h>.
    sum_add_u64(&cs, major(st.st_rdev));

Signed-off-by: David Sterba <dsterba@suse.com>
2017-05-02 16:23:54 +02:00
Lu Fengqi fd4526fe68 btrfs-progs: tests: fssum, fix memory leak
Free the alloced memory and close dir before exit.

Signed-off-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2017-05-02 16:17:52 +02:00
Lakshmipathi.G 467b49ccbb btrfs-progs: tests: add variable quotation to fsck-tests
Signed-off-by: Lakshmipathi.G <Lakshmipathi.G@giis.co.in>
Signed-off-by: David Sterba <dsterba@suse.com>
2017-05-02 16:13:29 +02:00
Lakshmipathi.G 57909d702c btrfs-progs: misc-tests: Superblock corruption and recovery using backup
Signed-off-by: Lakshmipathi.G <Lakshmipathi.G@giis.co.in>
Signed-off-by: David Sterba <dsterba@suse.com>
2017-04-19 19:06:26 +02:00
Christian Brauner 27c5e540be btrfs-progs: tests: misc/018-receive use receive -e to terminate on end marker
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
[ enhance tests to take extra options and use for -e ]
Signed-off-by: David Sterba <dsterba@suse.com>
2017-04-19 18:06:57 +02:00
Qu Wenruo 583cab2e2c btrfs-progs: tests: Add SHARED_DATA_REF test image for check lowmem mode
Introduce a new image, which contains external SHARED_DATA_REF items to
trigger a lowmem mode false alert.

The image only contains external SHARED_DATA_REF and no inlined data
backref.

Before the image, we only have inlined shared data ref, which is not
enough to trigger lowmem mode false alert.

Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2017-03-31 14:17:48 +02:00
David Sterba 02947f4105 btrfs-progs: tests: misc/019, use fssum
The fssum utility is now ready to use, test still passes.

Signed-off-by: David Sterba <dsterba@suse.com>
2017-03-16 17:02:44 +01:00