Commit graph

487 commits

Author SHA1 Message Date
Qu Wenruo 1c557766d2 btrfs-progs: tests: add convert test case for multiply overflow
The new test case will test whether btrfs-convert can handle 64G ext*
fs.

This exercise the cctx->total_bytes calculation where multiplying 4K
(unsigned int) and 16777216 (u32) could lead to bit overflow for
unsigned int and got 0, and screw up later free space calculation.

Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2020-08-31 17:01:02 +02:00
David Sterba 7d2abf432d btrfs-progs: tests: fsck/037-freespacetree-repair workaround for missing kernel fix
Kernel patch ff51bf02d107 ("btrfs: block-group: fix free-space bitmap
threshold") is needed to exercise both branches of the test, this can be
detected by lack of the objectid and offset parsed from the dump.

Issue: #288
Signed-off-by: David Sterba <dsterba@suse.com>
2020-08-28 18:30:55 +02:00
David Sterba cd905192b5 btrfs-progs: tests: add helper to print skipped operations
For workarounds or known missing support add helper to print a
notification about that, when _not_run is not suitable.

Signed-off-by: David Sterba <dsterba@suse.com>
2020-08-28 18:30:36 +02:00
David Sterba 56ab36b14a btrfs-progs: tests: rename mkfs/021-rootdir-size to 022
The test got incorrect number by accident, fix it.

Signed-off-by: David Sterba <dsterba@suse.com>
2020-07-21 15:43:23 +02:00
Qu Wenruo 761add2622 btrfs-progs: tests: check that convert does not create extents beyond device boundary
Add a test case to check if the converted fs has device extent beyond
boundary.

The disk layout of source ext4 fs needs some extents to make them
allocated at the very end of the fs.  The script is from the original
reporter.

Also, since the existing convert tests always uses 512M as device size,
which is not suitable for this test case, make it to grab the existing
device size to co-operate with this test case.

Reported-by: Jiachen YANG <farseerfc@gmail.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2020-06-29 17:45:39 +02:00
Qu Wenruo 5de63ab1c9 btrfs-progs: mkfs-tests: Add test case to verify the --rootdir size limit
Add a test case to ensure we can create a 350M fs with 128M rootdir.

Reviewed-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2020-06-29 17:45:39 +02:00
Qu Wenruo 23bee6a7b5 btrfs-progs: tests: update fsck/035-inline-bad-ram-bytes image
The image used in test case 035 has one problem:

- Bad total_bytes of device item in chunk tree
        item 0 key (DEV_ITEMS DEV_ITEM 1) itemoff 16185 itemsize 98
                devid 1 total_bytes 72564736 bytes_used 92274688
  The total_bytes is even smaller than bytes_used.
  While the dev_item in super block contains the correct value:
    dev_item.total_bytes    134217728
    dev_item.bytes_used     92274688

This patch will update the image, using the correct value in super block
to replace the wrong one in chunk tree.

So that later btrfs-image restore without device/chunk fixup can still
pass fsck-tests.

Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2020-05-29 12:42:49 +02:00
Qu Wenruo 2f8071b6d3 btrfs-progs: tests: update fsck/012-leaf-corruption image
The image used in 012 has several problems:

- Bad dev_item total_bytes in superblock
    dev_item.total_bytes    20918272
    dev_item.bytes_used     67108864

  The fs has 64M chunks allocated, and the original fs is also 64M.
  Thus the total_bytes is completely wrong.

- Bad total_bytes in chunk tree
          item 0 key (DEV_ITEMS DEV_ITEM 1) itemoff 3897 itemsize 98
                devid 1 total_bytes 20918272 bytes_used 67108864
  The same problem as super block.

This problem is covered by btrfs-image, as it will recalculate the
device size.

However if btrfs-image is doing exactly same data replay without any
modification, such bad image would cause test failure, as we're unable
to fix such bad total_bytes.

This patch will update the image to fix such problem.
Also since we're here, there is no need to use custom .tar.gz image, as
we have extra_image() to handle the uncompression.

Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2020-05-29 12:42:49 +02:00
Qu Wenruo 5ba0f70c60 btrfs-progs: tests: add test for quotas and --rootdir
Basic test of mkfs-time enabled quotas and filesystem filled with files.

Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2020-05-29 12:42:48 +02:00
Qu Wenruo 2df82a2da6 btrfs-progs: tests: add test image for overlapping csum item
The image has a csum item overlap with next csum item, make sure btrfs
check can detect it.

Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2020-05-28 19:59:38 +02:00
David Sterba 07e6fa5de9 btrfs-progs: tests: clean loop devices created by tests
Enhance the clean-tests.sh script to detach all loop devices created by
tests, lookup is based on the path prefix. Now 'make test-clean' is
supposed to prepare the environment for next test round.

Signed-off-by: David Sterba <dsterba@suse.com>
2020-05-05 17:08:20 +02:00
David Sterba 3e6c9bed5c btrfs-progs: adjust multiple block group warning format
Use simpler output format for easier parsing and place each block group
type on a separate line.

Example output:

WARNING: Multiple block group profiles detected, see 'man btrfs(5)'.
WARNING:   Data: single, raid1

Signed-off-by: David Sterba <dsterba@suse.com>
2020-05-04 22:05:43 +02:00
David Sterba 33fc7a13ff btrfs-progs: tests: add coverage for multiple profiles warning
Several commands now warn about multiple profiles as it is considered a
potentially problematic filesystem state that might need user attention.

 - device delete
 - device add
 - balance pause
 - balance cancel
 - filesystem usage

WARNING: Multiple profiles detected.  See 'man btrfs(5)'.
WARNING: data -> [raid1, single]

Signed-off-by: David Sterba <dsterba@suse.com>
2020-05-04 20:49:01 +02:00
David Sterba a7c19b1532 btrfs-progs: tests: enhance README
Add more information about variables, fine tuning, wording, test
templates, etc.

Signed-off-by: David Sterba <dsterba@suse.com>
2020-05-04 20:49:01 +02:00
Qu Wenruo e445c1c381 btrfs-progs: tests: introduce expand_command() to inject aruguments more accurately
[PROBLEM]
We want to inject $INSTRUMENT (mostly valgrind) before btrfs command but
after root_helper.

Currently we won't inject $INSTRUMENT at all if we are using
root_helper.
This means the coverage is not good enough.

[FIX]
This patch introduce a new function, expand_command(), to handle all
parameter/argument injection, including existing 'btrfs check' inject.

This function will:
- Detect where to inject $INSTRUMENT
  If we have root_helper and the command is target command
  (btrfs/mkfs.btrfs/btrfs-convert), then we inject $INSTRUMENT after
  root_helper.
  If we don't have root_helper, and the command is target command,
  we inject $INSTRUMENT before the command.
  Or we don't inject $INSTRUMENT (it's not the target command).

- Use existing spec facility to inject extra arguments

- Use an array to restore to result
  To avoid bash interpret the IFS inside path/commands.

Now we can make sure no matter if we use root_helper, $INSTRUMENT is
always injected corrected.

Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2020-05-04 20:48:48 +02:00
Qu Wenruo 8c759d5a06 btrfs-progs: tests: filter output for run_check_stdout
Since run_check_stdout() can insert INSTRUMENT for all btrfs related
programs, which could easily pollute the stdout, any caller of
run_check_stdout() should do proper filter.

The following callers are affected:
- misc/004
  Filter the output of "btrfs ins min-dev-size"

- misc/009
- misc/013
- misc/024
  They are all calling "btrfs ins rootid", so introduce get_subvolid()
  function to grab the subvolid properly.

- misc/031
  Loose the filter for "btrfs qgroup show". No need for "tail -n 1".

So we still have the same coverage, but now these tests won't cause
false alert if we insert INSTRUMENT for all btrfs commands.

Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2020-05-04 20:48:42 +02:00
Anand Jain c360199c6c btrfs-progs: tests: drop trailing slash from TEST_TOP path
As the TEST_TOP is often only a base path, the slash gets doubled. This
is not a problem as the slashes are in the middle of the path and cannot
be confused with the initial "//" that gets interpreted as a network
path. Update all the test drivers.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
[ update changelog ]
Signed-off-by: David Sterba <dsterba@suse.com>
2020-05-04 20:48:35 +02:00
Marcos Paulo de Souza 2f8aac5375 btrfs-progs: tests: mkfs/018, fix check for truncate command failure
Commit 31f477ee ("btrfs-progs: mkfs-tests: skip test if truncate fails
with EFBIG") tried to detect a failure in truncate command by checking
the $? expecting it to be an errno, when it actually returns 0 or 1.

To fix this test just check if the command failed (returned 1) and look
for the output, skipping the test if the OS cannot create a 6E file.

Fixes: #241
Tested-by: Erhard Furtner <erhard_f@mailbox.org>
Signed-off-by: Marcos Paulo de Souza <mpdesouza@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2020-05-04 20:48:35 +02:00
Adam Borowski 3d379b1341 btrfs-progs: lots of typo fixes (codespell)
Signed-off-by: Adam Borowski <kilobyte@angband.pl>
Signed-off-by: David Sterba <dsterba@suse.com>
2020-03-31 18:37:38 +02:00
Qu Wenruo e711c843df btrfs-progs: tests/common: Don't call INSTRUMENT on mount command
[BUG]
With INSTRUMENT=valgrind set, some fsck tests will fail, e.g. fsck/013:
  ====== RUN CHECK mount -t btrfs -o loop /home/adam/btrfs/btrfs-progs/tests//test.img /home/adam/btrfs/btrfs-progs/tests//mnt
  ==114106==
  ==114106== Warning: Can't execute setuid/setgid/setcap executable: /usr/bin/mount
  ==114106== Possible workaround: remove --trace-children=yes, if in effect
  ==114106==
  valgrind: /usr/bin/mount: Permission denied
  failed: mount -t btrfs -o loop /home/adam/btrfs/btrfs-progs/tests//test.img /home/adam/btrfs/btrfs-progs/tests//mnt
  test failed for case 013-extent-tree-rebuild

[CAUSE]
Just as stated by valgrind itself, it can't handle program with
setuid/setgid/setcap.

Thankfully in our case it's mount and we don't really care about it at
all.

[FIX]
Although we could use complex skip pattern to skip mount in valgrind, we
don't really want to run valgrind on mount or sudo command anyway.

So here we do extra check if we're running mount command. And if that's
the case, just skip $INSTRUMENT command.

Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2020-03-31 18:37:37 +02:00
David Sterba 1311f1b83a btrfs-progs: misc-tests/039: cleanup test
Cleanups done separately:

* use the default test image, loop devices not needed for the test
* trim TEST_MNT from all paths
* send output is created inside the test filesystem

Signed-off-by: David Sterba <dsterba@suse.com>
2020-03-31 18:37:36 +02:00
Omar Sandoval 25e3e5cb12 btrfs-progs: tests: add test for receiving clone from duplicate subvolume
This test case is the reproducer for the previous fix.

Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Omar Sandoval <osandov@fb.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2020-03-31 18:37:36 +02:00
David Sterba f541f59e9a btrfs-progs: tests: check if subvolume delete by id is supported
Skip the test 013-subvolume-delete-by-id if the first valid attempt to
use the ioctl fails with 'Inappropriate ioctl for device'.

Signed-off-by: David Sterba <dsterba@suse.com>
2020-03-31 18:37:36 +02:00
David Sterba a3b12468c0 btrfs-progs: tests: add run_mayfail_stdout helper
Add a variant of mayfail helper that will duplicate the output to
results log and also provides it to the caller for processing. Can be
used for catching unsupported functionality or other special cases.

Signed-off-by: David Sterba <dsterba@suse.com>
2020-03-31 18:37:36 +02:00
David Sterba 49fe198218 btrfs-progs: move ioctl-test.c to tests/
Move it out of the top-level directory.

Signed-off-by: David Sterba <dsterba@suse.com>
2020-03-31 18:37:34 +02:00
David Sterba b147ef8764 btrfs-progs: move library-test.c to tests/
Move it out of the top-level directory.

Signed-off-by: David Sterba <dsterba@suse.com>
2020-03-31 18:37:34 +02:00
Marcos Paulo de Souza 656e7a839f btrfs-progs: tests: skip tests if dmsetup is not available
Move the check of dmsetup to check_dm_target_support, and adapt the only
two places checking if dmsetup is present in the system. Now we skip the
tests if dmsetup isn't available, instead of marking the test as failed.

Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Marcos Paulo de Souza <mpdesouza@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2020-03-31 18:37:34 +02:00
Marcos Paulo de Souza 47c1630898 btrfs-progs: tests: mkfs/005: check for dm-linear
This way we ensure the linear target is available and skip the test.

Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Marcos Paulo de Souza <mpdesouza@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2020-03-31 18:37:24 +02:00
Marcos Paulo de Souza 1636a6cb36 btrfs-progs: tests: mkfs/017: check dm target support
If dm-thin or dm-linear are not supported, let's skip the test
altogether instead of throwing an error.

Issue: #192
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Marcos Paulo de Souza <mpdesouza@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2020-03-20 22:05:28 +01:00
Marcos Paulo de Souza 4e02678c29 btrfs-progs: tests: Add check for dm targets
This function will be used later to test if dm-thin is supported.

Suggested-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Marcos Paulo de Souza <mpdesouza@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2020-03-20 22:05:28 +01:00
Su Yue 831b6fb5bd btrfs-progs: misc-tests/034: reload btrfs module before running failure_recovery
One reload_btrfs is lost, add it.

Fixes: 0de2e22ad2 ("btrfs-progs: tests: Add tests for changing fsid feature")
Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: Su Yue <Damenly_Su@gmx.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2020-03-20 22:05:25 +01:00
Marcos Paulo de Souza 640510df83 btrfs-progs: tests: add subvolume delete by id
Signed-off-by: David Sterba <dsterba@suse.com>
2020-03-04 19:21:09 +01:00
Marcos Paulo de Souza 31f477ee20 btrfs-progs: mkfs-tests: skip test if truncate fails with EFBIG
The truncate command can fail in some platforms like PPC32 because it
can't create files up to 6EiB in size. Skip the test if this was the
problem why truncate failed.

Issue: #192
Signed-off-by: Marcos Paulo de Souza <mpdesouza@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2020-03-03 19:58:55 +01:00
Marcos Paulo de Souza 6ec6c11ba1 btrfs-progs: tests: misc: find-root and select-super are internal commands
Enhance the prerequisite check for internal tools, up to now missing
btrfs-find-root and btrfs-select-super. The correct path in the checks
is INTERNAL_BIN.

The testsuite is now self-contained.

Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Marcos Paulo de Souza <mpdesouza@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2020-03-03 19:58:55 +01:00
Marcos Paulo de Souza 225d66e99b btrfs-progs: Include btrfs-find-root and btrfs-select-super in testsuite
These two binaries are not usually shipped with the package, but they
are used by the testsuite, they need to be included in the exported tar.

Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Marcos Paulo de Souza <mpdesouza@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2020-03-03 19:58:54 +01:00
Marcos Paulo de Souza b20f94e984 btrfs-progs: misc-test: 034: Call "udevmadm settle" before mount
As seem in issue #192, this test can fail from time to time. The
issue happens when a mount is issued before the new device is processed
by systemd-udevd, as we can see by the og bellow:

  [ 2346.028809] BTRFS: device fsid 593e23af-a7e6-4360-b16a-229f415de697 devid 1 transid 6 /dev/loop10 scanned by systemd-udevd (3418)
  [ 2346.265401] BTRFS info (device loop10): found metadata UUID change in progress flag, clearing
  [ 2346.272474] BTRFS info (device loop10): disk space caching is enabled
  [ 2346.277472] BTRFS info (device loop10): has skinny extents
  [ 2346.281840] BTRFS info (device loop10): flagging fs with big metadata feature
  [ 2346.308428] BTRFS error (device loop10): devid 2 uuid cde07de6-db7e-4b34-909e-d3db6e7c0b06 is missing
  [ 2346.315363] BTRFS error (device loop10): failed to read the system array: -2
  [ 2346.329887] BTRFS error (device loop10): open_ctree failed

  failed: mount /dev/loop10 /home/marcos/git/suse/btrfs-progs/tests//mnt
  test failed for case 034-metadata-uuid
  make: *** [Makefile:401: test-misc] Error 1

  [ 2346.666865] BTRFS: device fsid 593e23af-a7e6-4360-b16a-229f415de697 devid 2 transid 5 /dev/loop11 scanned by systemd-udevd (3422)
  [ 2346.853233] BTRFS: device fsid 1c2debeb-e829-4d6b-84df-aa7c5d246fd5 devid 1 transid 7 /dev/loop6 scanned by systemd-udevd (3418)

A few moments after the test failed systemd-udevd processed the new
device (registered the new device under btrfs). This can be tested by
executing a mount after the test failed, resulting in a successful
mount:

  $ mount /dev/loop10 /mnt
  [ 2398.955254] BTRFS info (device loop10): found metadata UUID change in progress flag, clearing
  [ 2398.959416] BTRFS info (device loop10): disk space caching is enabled
  [ 2398.962483] BTRFS info (device loop10): has skinny extents
  [ 2398.965070] BTRFS info (device loop10): flagging fs with big metadata feature
  [ 2399.012617] BTRFS info (device loop10): enabling ssd optimizations
  [ 2399.022375] BTRFS info (device loop10): checking UUID tree

This problem can be avoided is we execute "udevadm settle" before the
mount is executed.

Issue: #192
Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: Su Yue <Damenly_Su@gmx.com>
Signed-off-by: Marcos Paulo de Souza <mpdesouza@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2020-03-03 19:58:54 +01:00
Marcos Paulo de Souza da04a62697 btrfs-progs: mkfs-tests: only check supported checksums
Don't hardcode the supported checksums and use the list provided by the
kernel module. The status check of support is moved to the top of the
script so it's more visible.

Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Marcos Paulo de Souza <mpdesouza@suse.com>
[ move checks ]
Signed-off-by: David Sterba <dsterba@suse.com>
2020-03-03 19:58:54 +01:00
Long An bb64c02b90 btrfs-progs: tests: fix path of btrfs-corrupt-block
There are two utilities that are required for the testsuite but not
installed on systems. The path in tests must be INTERNAL_BIN.

Fix this issue for below tests:
 * fsck-tests/013-extent-tree-rebuild
 * fsck-tests/037-freespacetree-repair
 * misc-tests/038-backup-root-corruption

Issue: #198
Signed-off-by: Long An <lan@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2020-03-03 19:58:53 +01:00
Nikolay Borisov 82ec6dbd4d btrfs-progs: tests: Extend metadata uuid testcase
This adds cooked images to exercise the case when a filesystem with
metadata uuid incompat flag is switched back to having fsid/metadata
uuid being equal.

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2020-03-03 19:58:53 +01:00
Qu Wenruo d3f7315b3c btrfs-progs: tests: check: detect bad extent item generation
The new image has a bad data extent item generation:

        item 0 key (13631488 EXTENT_ITEM 4096) itemoff 16230 itemsize 53
                refs 1 gen 16384 flags DATA
                extent data backref root FS_TREE objectid 257 offset 0 count 1

Just like what older `btrfs check --init-extent-tree` could cause.

Reviewed-by: Su Yue <Damenly_Su@gmx.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2020-01-09 14:27:10 +01:00
Su Yue f0c607a137 btrfs-progs: misc-tests/038: fix wrong field filtered under root directory
Ran misc-tests/038 in /root/btrfs-progs:

  make test-misc TEST=038\*
      [TEST]   misc-tests.sh
      [TEST/misc]   038-backup-root-corruption
  ./test.sh: line 33: [: bytenr=65536,: integer expression expected
  Backup slot 2 is not in use
  test failed for case 038-backup-root-corruption
  make: *** [Makefile:401: test-misc] Error 1

It's caused by the wrong line filtered by
$(dump_super | grep root | head -n1 | awk '{print $2}').

The command $(dump-super | grep root) outputs:

  superblock: bytenr=65536, device=/root/btrfs-progs/tests/test.img
  root                    30605312
  chunk_root_generation   5
  root_level              0
  chunk_root              22036480
  chunk_root_level        0
  log_root                0
  log_root_transid        0
  log_root_level          0
  root_dir                6
  backup_roots[4]:

Here
"superblock: bytenr=65536, device=/root/btrfs-progs/tests/test.img" is
selected but not the line "root                    30605312".

Restricting the awk rule can fix it.

Fixes: 78a3831d46 ("btrfs-progs: tests: Test backup root retention logic")
Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: Su Yue <Damenly_Su@gmx.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2020-01-09 14:27:10 +01:00
Qu Wenruo 121b9a2e4c btrfs-progs: tests: Add --force for repair command
Since commit e388bf38 ("btrfs-progs: check: warn users about the
possible dangers of --repair") `btrfs check --repair` will wait 10
seconds before really repair the fs.

This hugely slow down the fsck tests. Add --force for check_image()

Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2020-01-09 14:27:09 +01:00
David Sterba 012e51ae6e btrfs-progs: tests: fsck/013: use correct path for btrfs-corrupt-block
All utilities should be found in the $TOP directory, INTERNAL_BIN was
there by accident.

Signed-off-by: David Sterba <dsterba@suse.com>
2020-01-09 14:27:09 +01:00
Long An bbb3d8f6f0 btrfs-progs: tests: mkfs/011: Fix path for rootdir
Documentation folder path is wrong on exported testsutie. Fix this by
replace TOP with INTERNAL_BIN.

Signed-off-by: An Long <lan@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2020-01-09 14:27:09 +01:00
Marcos Paulo de Souza 4be1b09293 btrfs-progs: tests: mkfs/020: use correct device for mount
It seems to be a typo, since $dev1 was not set, and we are dealing with
TEST_DEV and not with loop devices. As this is now equivalent to the
common mount/umount helpers, use them.

Signed-off-by: Marcos Paulo de Souza <mpdesouza@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2020-01-09 14:27:09 +01:00
Marcos Paulo de Souza 8f382bc75e btrfs-progs: tests: mkfs/020: properly set checksum from parameter
The value of checksum was not set making mkfs fail.

Signed-off-by: Marcos Paulo de Souza <mpdesouza@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2020-01-09 14:27:09 +01:00
David Sterba 95117cbd4a btrfs-progs: tests: add tests for checksums
Add separate tests for basic coverage of new checksum algorithms. It
comes in two parts to do a full mkfs test and also a condition mount
test.

Signed-off-by: David Sterba <dsterba@suse.com>
2019-11-22 19:09:51 +01:00
David Sterba b475a46f4d btrfs-progs: tests: add raid1c34 to basic mkfs tests
Signed-off-by: David Sterba <dsterba@suse.com>
2019-11-22 19:09:50 +01:00
Johannes Thumshirn e388bf386b btrfs-progs: check: warn users about the possible dangers of --repair
The manual page of btrfsck clearly states 'btrfs check --repair' is a
dangerous operation.

Although this warning is in place users do not read the manual page
and/or are used to the behaviour of fsck utilities which repair the
filesystem, and thus potentially cause harm.

Similar to 'btrfs balance' without any filters, add a warning and a
countdown, so users can bail out before eventual corrupting the
filesystem more than it already is.

To override the timeout, let --force skip it and continue.

Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: David Sterba <dsterba@suse.com>
2019-11-22 19:07:20 +01:00
David Sterba b9000ce339 btrfs-progs: tests: remove unused variables in common
All the run_* helpers have unused variable cmd, probably a leftover from
debugging the option injection magic.

Signed-off-by: David Sterba <dsterba@suse.com>
2019-11-22 19:07:16 +01:00