]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commit
btrfs/179: fix test failure when there are no snapshots to delete
authorFilipe Manana <fdmanana@suse.com>
Fri, 24 Sep 2021 14:06:32 +0000 (15:06 +0100)
committerEryu Guan <guaneryu@gmail.com>
Sun, 26 Sep 2021 12:49:05 +0000 (20:49 +0800)
commit02b9a880aed76a165e07beeaf8574edd4a4af310
tree2db04c8d2eac14bb91d9148cd92e1b02addc4a2d
parent91b2c035346baa961b9c576036ed5800599cbac3
btrfs/179: fix test failure when there are no snapshots to delete

It's very rare, but we can end up in a situation where there are no
snapshots to delete, in which case the $victim variable of the function
delete_workload() ends up being assigned with an empty string. When
that happens we end up running the command:

   btrfs subvolume delete "$SCRATCH_MNT/snapshots/"

Which fails since the argument is not a subvolume or a snapshot.
This causes the test to fail due to an unexpected error message from
the subvolume delete command:

  btrfs/179 129s ... - output mismatch (see /home/fdmanana/git/hub/xfstests/results//btrfs/179.out.bad)
      --- tests/btrfs/179.out 2020-10-16 23:13:46.546152332 +0100
      +++ /home/fdmanana/git/hub/xfstests/results//btrfs/179.out.bad 2021-09-24 11:15:01.404863801 +0100
      @@ -1,2 +1,3 @@
       QA output created by 179
      +ERROR: Not a Btrfs subvolume: Invalid argument
       Silence is golden
      ...

Fix that by making the delete_workload() loop skip the deletion attempt
when there are no snapshots.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
tests/btrfs/179