Commit graph

703 commits

Author SHA1 Message Date
David Sterba 0f89b1d098 btrfs-progs: tests: verify filesystem show on a raw device mapper path
Signed-off-by: David Sterba <dsterba@suse.com>
2024-01-31 11:07:57 +01:00
David Sterba 74e57d25dc btrfs-progs: tests: renumber 060-subvol-delete-qgroup
There are now two tests with 060, we'd like to be that a unique number,
rename the one that was added more recently.

Signed-off-by: David Sterba <dsterba@suse.com>
2024-01-31 10:16:16 +01:00
David Sterba 346a381923 btrfs-progs: convert: add raid-stripe-tree to allowed features
The raid-stripe-tree can be enabled for convert, though it's still
considered incomplete and slightly experimental. Due to that the tests
need to be adjusted to check for support and skip mount eventually.

Possible remaining options to add: quota, squota

Issue: #694
Signed-off-by: David Sterba <dsterba@suse.com>
2024-01-31 09:49:43 +01:00
David Sterba 54b2e4b6e7 btrfs-progs: tests: enable ntfs2btrfs conversion
Enhance the conversion macro to recognize the filesystem type in case
the ntfs-specific converter utility has to be used. Its current feature
set does not match btrfs-convert.

Signed-off-by: David Sterba <dsterba@suse.com>
2024-01-17 17:42:50 +01:00
David Sterba bbf5a3f72c btrfs-progs: tests: fix 022-reiserfs-parent-ref setup
The test does not pass in environments where /bin/sh is not bash (like
github CI). Unify the initial setup like the other tests do: source,
compatibility, prerequisities, the rest.

Signed-off-by: David Sterba <dsterba@suse.com>
2024-01-17 03:21:19 +01:00
Qu Wenruo 04f3efaa0d btrfs-progs: tests: enable strict chunk alignment check
The strict check is enabled for both check_image() and
convert_test_do_convert() to detect chunk alignment related problems.

Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2024-01-16 19:15:15 +01:00
Qu Wenruo dbd175734a btrfs-progs: cli-tests: add test case for return value of "btrfs subvlume create"
The test case would check if "btrfs subvolume create":

- Report error on an existing path
- Still report error if mulitple paths are given and one of them already
  exists
- For above case, still created a subvolume for the good parameter

Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2024-01-10 16:31:39 +01:00
David Sterba eaa54973b6 btrfs-progs: scrub limit: add option to apply the limit to all devices
Signed-off-by: David Sterba <dsterba@suse.com>
2023-12-09 01:57:29 +01:00
David Sterba 30d1a2d390 btrfs-progs: scrub limit: allow to set the limit
Add new options to set the per-device limit (requires root privileges as
it writes to the sysfs files).

Signed-off-by: David Sterba <dsterba@suse.com>
2023-12-09 01:57:27 +01:00
David Sterba 6e96df640b btrfs-progs: tests: add case for scrub limit
Signed-off-by: David Sterba <dsterba@suse.com>
2023-12-09 01:17:22 +01:00
Qu Wenruo eae4109054 btrfs-progs: check: remove inode cache clearing functionality
Since we're already directing the end user to use "btrfs rescue
clear-ino-cache" command, there is not much need to support it in
btrfs-check.

Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2023-12-05 17:57:04 +01:00
David Sterba 71042e8bb0 btrfs-progs: tests: add test for subvolume delete and qgroups
Signed-off-by: David Sterba <dsterba@suse.com>
2023-12-05 12:36:44 +01:00
David Sterba c0592c5591 btrfs-progs: tests: warning and timeout when removing multiple devices
Signed-off-by: David Sterba <dsterba@suse.com>
2023-12-01 03:04:58 +01:00
David Sterba 22495fc8fd btrfs-progs: tests: add coverage for size options of 'fi du'
Signed-off-by: David Sterba <dsterba@suse.com>
2023-12-01 01:46:05 +01:00
David Sterba 960e7b3800 btrfs-progs: tests: test log levels
The log levels have been added in 6.2, add the basic coverage.

Signed-off-by: David Sterba <dsterba@suse.com>
2023-12-01 01:32:40 +01:00
David Sterba 32880fa518 btrfs-progs: crypto: add openssl as crypto provider
https://www.openssl.org/ Is a well known cryptography library and since
freshly released version 3.2 it also supports variable digest size of
blake2b, so we can now add it among the crypto providers.

Configure with --with-crypto=openssl.

Signed-off-by: David Sterba <dsterba@suse.com>
2023-11-30 22:04:45 +01:00
David Sterba 5221aedc00 btrfs-progs: crypto: add Botan as crypto provider
https://botan.randombit.net/ Botan is a cryptography library with C
bindings and provides what we need (sha256 and blake2b), among many
others. Add it to the list of crypto backends if somebody wants to use
it.

Currently the version 2.19 is the latest one. Botan3 3.2.0 exists but
does not seem to be widely available in distros yet.

Configure with --with-crypto=botan.

Signed-off-by: David Sterba <dsterba@suse.com>
2023-11-30 22:04:45 +01:00
Qu Wenruo d79eb4b726 btrfs-progs: tests: add test case for subvolume create multiple arguments
The test case would verify the following behaviors:

- Partial failure
  Should return 1, but the remaining valid destinations would still be
  created.

- All success
  That's as usual.

Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2023-11-23 20:21:58 +01:00
Anand Jain 6049b56971 btrfs-progs: tests: use new sysfs interface to check prereq ACL
With the kernel commit 070bb0011ccf ("btrfs: sysfs: show if ACL
support has been compiled in") we can now check if ACL is compiled
without requiring a btrfs device. Retain older method for older
kernels.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2023-11-09 15:26:44 +01:00
David Sterba e39c04ef44 btrfs-progs: tests: fix parsing zone size in nullb
The zone size may not be parsed correctly in 'nullb create' due to
copy&paste error from the 'size'. This is already fixed upstream.

Signed-off-by: David Sterba <dsterba@suse.com>
2023-11-03 18:04:37 +01:00
David Sterba 1faaa874a1 btrfs-progs: ci: wait for loop devices before mount
Since a few days the CI started to fail randomly when there were loop
devices used in the tests. The mount fails because some device is
reported to be missing:

  $ losetup --show --find
  /dev/loop3
  ...

  $ mkfs ...
  ERROR: device scan failed on '/dev/loop3': No such file or directory
  ...

  $ mount
  mount: /home/runner/work/btrfs-progs/btrfs-progs/tests/mnt: wrong fs
  type, bad option, bad superblock on /dev/loop3, missing codepage or
  helper program, or other error.

  $ dmesg
  ...
  BTRFS error (device loop0): devid 3 uuid 11d9c345-9527-433e-a024-7102659fa0ee is missing
  BTRFS error (device loop0): failed to read the system array: -2
  BTRFS error (device loop0): open_ctree failed

This was reproducible in the "cli" tests, but also happened on a local
machine.

To fix that wait for all loop devices before mount, the command
'btrfs device ready' should block until that. The convenience helper
does that, for any standalone 'mount' used with loop devices this must
be done manually.

Signed-off-by: David Sterba <dsterba@suse.com>
2023-11-03 18:04:37 +01:00
David Sterba 5fce099396 btrfs-progs: tests: rename cli/012-defrag-recursion, it's about 'fi du'
The test names 011 and 012 are the same but 012 is actually testing
recursion of the 'btrfs fi du' command.

Signed-off-by: David Sterba <dsterba@suse.com>
2023-11-03 18:04:37 +01:00
David Sterba f7fb93f1ac btrfs-progs: remove old syntax of 'balance /path'
There was a support for a short syntax of 'btrfs balance' that accepted
a path where normally would be the mandatory subcommand. This was a
heuristic and nowadays everybody should be using the
'btrfs balance action' syntax. The warning was in place for a year, it's
time to remove the short syntax completely.

Issue: #517
Signed-off-by: David Sterba <dsterba@suse.com>
2023-11-03 18:04:37 +01:00
David Sterba c9d04fae03 btrfs-progs: tests: test --dry-run for subvolume delete
Signed-off-by: David Sterba <dsterba@suse.com>
2023-11-03 18:04:37 +01:00
David Sterba 2c747dd83f btrfs-progs: tests: drop 8k and 32k sector sizes from convert tests
The most common sector sizes are 4k, 16k and 64k, we don't really need
to test that with convert, this takes a long time for little benefit as
the node size is only for metadata, while the rest remains the same.

Signed-off-by: David Sterba <dsterba@suse.com>
2023-11-03 18:04:37 +01:00
David Sterba f195461b0e btrfs-progs: tests: add basic test for ntrfs conversion
The ntfs2btrfs tool recently found a bug in 'check', add the conversion
test support to our testsuite. It's optional and depends on kernel
support of the 'ntfs3' driver and the availability of mkntfs and
ntfs2btrfs, which might not be available everywhere.

Signed-off-by: David Sterba <dsterba@suse.com>
2023-11-03 18:04:37 +01:00
David Sterba 4126a425df btrfs-progs: tests: update btree-test
Minor refactoring, check arguments and print parameters. This can be
used to stress btree allocation by changing run_size.

Signed-off-by: David Sterba <dsterba@suse.com>
2023-11-03 18:04:37 +01:00
David Sterba 836e7ca8ff btrfs-progs: tests: fix quick-test compilation and rename it
There's an old test for btree code that could be used in the testsuite.
Still needs some polishing and review what tests make sense.

Signed-off-by: David Sterba <dsterba@suse.com>
2023-11-03 18:04:37 +01:00
David Sterba 54439594a6 btrfs-progs: tests: add back removed functionality
Previously the XFS-specific code was commented out so we don't need the
headers for building fsstress, this changes how the utility behaves
compared to the one in fstests, e.g. randomness or additional open/close
operations. Add enough code from xfsprogs to make it compile and enable
the #if0-ed code.

Signed-off-by: David Sterba <dsterba@suse.com>
2023-11-03 18:04:37 +01:00
David Sterba 9dcb5afa15 btrfs-progs: tests: fix -Wshadow warnings in fssum and fsstress
Signed-off-by: David Sterba <dsterba@suse.com>
2023-11-03 18:04:37 +01:00
Qu Wenruo 208073c373 btrfs-progs: tests: add test image of out-of-order inline backref items
Issue #622 reported a case where ntfs2btrfs can generate out-of-order
inline backref items, which can lead to kernel transaction abort, but
not detected by btrfs-check.

This patch would add such image, whose extent tree looks like this for
the only data extent:

        item 0 key (13631488 EXTENT_ITEM 4096) itemoff 16172 itemsize 111
                refs 3 gen 7 flags DATA
                (178 0xdfb591fa80d95ea) extent data backref root FS_TREE objectid 257 offset 0 count 1
                (178 0xdfb591fbbf5f519) extent data backref root FS_TREE objectid 258 offset 0 count 1
                (178 0xdfb591f49f9f8e7) extent data backref root FS_TREE objectid 259 offset 0 count 1

While the original good base image has the following backrefs for the
same data extent:

        item 0 key (13631488 EXTENT_ITEM 4096) itemoff 16172 itemsize 111
                refs 3 gen 7 flags DATA
                (178 0xdfb591fbbf5f519) extent data backref root FS_TREE objectid 258 offset 0 count 1
                (178 0xdfb591fa80d95ea) extent data backref root FS_TREE objectid 257 offset 0 count 1
                (178 0xdfb591f49f9f8e7) extent data backref root FS_TREE objectid 259 offset 0 count 1

Notice the sequence (the 2nd number in the round brackets) should be
descending.  (Meanwhile type should be ascending, but it's way harder to
create.)

For now we don't have a way to fix it, but at least we should detect it.

Issue: #622
Reviewed-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2023-11-03 18:04:37 +01:00
David Sterba 1357983f69 btrfs-progs: tests: add case for subvolume create -p
Signed-off-by: David Sterba <dsterba@suse.com>
2023-10-21 15:51:07 +02:00
Qu Wenruo 83ae2d58c9 btrfs-progs: tests: make sure rootdir inode gets its attributes copied
The new test case would:

- Prepare two loopback devices
  One is for storing the source directory (on a btrfs).
  This is to ensure we can set xattr for the directory, as filesystems
  like tmpfs (mostly utilized by mktemp) is not supporting xattr.

  The other one is the real target fs where we call
  "mkfs.btrfs --rootdir" on.

- Create the source directory with the following contents:
  * rootdir inode attributs:
    # mode (750)
    # uid (1000)
    # gid (1000)
    # xattr (user.rootdir)
  * one regular file, with attributes:
    # xattr (user.foorbar)

- Execute "mkfs.btrfs --rootdir" and mount the new fs

- Verify the above attributes
  The target fs should have the same attributes, especially for the
  rootdir inode.

Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2023-10-21 15:51:07 +02:00
David Sterba 4f2c9e8ade btrfs-progs: tests: do not run test-convert under test target
The convert tests take a long time and are not necessary for quick test
rounds under the convenience target 'make test'. We still run the tests
in CI.

Signed-off-by: David Sterba <dsterba@suse.com>
2023-10-17 19:34:00 +02:00
David Sterba 05d338d4ab btrfs-progs: tests: add basic mkfs tests for zoned + rst
Test all combinations of data x metadata for the supported profiles.

Signed-off-by: David Sterba <dsterba@suse.com>
2023-10-17 19:33:59 +02:00
David Sterba 863fedd1cb btrfs-progs: tests: add basic mkfs test for raid-stripe-tree
Signed-off-by: David Sterba <dsterba@suse.com>
2023-10-17 19:33:59 +02:00
David Sterba 63e4532f3b btrfs-progs: tests: fix description of mkfs/024-fst-bitmaps
Signed-off-by: David Sterba <dsterba@suse.com>
2023-10-17 19:33:59 +02:00
David Sterba 00628edb26 btrfs-progs: tests: add basic mkfs test for block-group-tree
Signed-off-by: David Sterba <dsterba@suse.com>
2023-10-17 19:33:59 +02:00
David Sterba 8c9243160b btrfs-progs: tests: add array API test template
Signed-off-by: David Sterba <dsterba@suse.com>
2023-10-17 19:33:58 +02:00
David Sterba 777b1d8c27 btrfs-progs: tests: check that qgroup show does not crash on stale qgroups
Create subvolumes and delete every N-th to generate output where we can
also see how the stale qgroups are placed (at the end).

Issue: #687
Signed-off-by: David Sterba <dsterba@suse.com>
2023-10-13 18:13:12 +02:00
Qu Wenruo 4c6f41f2b8 btrfs-progs: enable -Wshadow for default build
With all the known one fixed, we can enable -Wshadow now.

Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2023-10-10 19:23:10 +02:00
David Sterba f96e5fe3ba btrfs-progs: tests: disable log scanning after tests
This partially reverts commit 2726a83952,
the part where the test runner scripts call the log scanning. There are
still unfixed extent buffer leak reported by fuzz tests. Disable it
temporarily so CI can pass and do other pre-release checks. Scanning
will be enabled after release again.

Signed-off-by: David Sterba <dsterba@suse.com>
2023-10-03 18:49:50 +02:00
Anand Jain 86b1e47c80 btrfs-progs: test: misc/034 remove kernel support
The kernel patch, ("btrfs: reject device with CHANGING_FSID_V2 flag"),
removes kernel support for the CHANGING_FSID_V2 flag. So, drop its
related testcase.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2023-10-03 01:11:55 +02:00
Anand Jain 9290442c46 btrfs-progs: tests: update misc/034 for btrfstune -m|M ability to fix previous failures
The misc-test/034-metadata_uuid test case, has four sets of disk images
to simulate failed writes during btrfstune -m|M operations. As of now,
this tests kernel only. Update the test case to verify btrfstune -m|M's
functionality to recover from the same scenarios.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2023-10-03 01:11:55 +02:00
David Sterba 2726a83952 btrfs-progs: tests: scan test results
Some errors may be reported in the logs only, scan the file each time
there are fresh results. The scanning script will return error that is
supposed to be caught by the testsuite environment.

Signed-off-by: David Sterba <dsterba@suse.com>
2023-09-12 23:18:35 +02:00
David Sterba 7a7df06f98 btrfs-progs: tests: extend scan-results.sh to scan only a given file
Scanning all results is meant for the whole testsuite, we'd like to make
it more fine grained to verify them once a test is run via the test
running wrappers.

Signed-off-by: David Sterba <dsterba@suse.com>
2023-09-12 23:18:35 +02:00
David Sterba e0263f2b31 btrfs-progs: tests: fix test case name detection scan-results.sh
The test markers have changed in 4.17 so the result scanner does not
print the test names (but still detects the errors).

Signed-off-by: David Sterba <dsterba@suse.com>
2023-09-12 23:18:34 +02:00
David Sterba 634e9a4792 btrfs-progs: tests: fix build -Wmissing-prototypes warnings
Signed-off-by: David Sterba <dsterba@suse.com>
2023-09-12 23:18:34 +02:00
Anand Jain e8e5537d8c btrfs-progs: tests: add prefixes to error messages in misc-test/034
Add appropriate prefix to the error messages to make it easier to track
down which case failed.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2023-09-01 13:58:46 +02:00
David Sterba 5c7f36b141 btrfs-progs: tests: fix typo in README
The correct helper name is check_global_prereq, this was once
seen accidentally used in a test.

Signed-off-by: David Sterba <dsterba@suse.com>
2023-08-28 17:24:25 +02:00