Skip to contentSkip to conversation

progs: fix testsuite

PATCH In review Marcos Paulo de Souza 3 participants 9 messages Mar 1, 2020 – Mar 2, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover progs: fix testsuite

From: Marcos Paulo de Souza <[email protected]>

While checking issue 198[1], I tested current testsuite and it didn't work. So, these three patches aim to solve this issue.

Patch 1 isn't related to the fix, but it's related, since we remove the manpages from btrfs-find-root and btrfs-select-super because these binaries are not installed anymore.

Patches 2 and 3 adjust the testsuite to include btrfs-find-root and btrfs-select-super in the final tarball, and adjust the tests to find these binaries in INTERNAL_BIN.

Please review,
Marcos

[1]: https://github.com/kdave/btrfs-progs/issues/198

Marcos Paulo de Souza (3):
progs: Remove manpages of not packaged binaries
progs: Include btrfs-find-root and btrfs-select-super in testsuite
progs: tests: misc: btrfs-{find-root,select-super} are internal
commands

 .gitignore                                    |  2 -
 Documentation/Makefile.in                     |  2 -
 Documentation/btrfs-find-root.asciidoc        | 35 --------------
 Documentation/btrfs-select-super.asciidoc     | 46 -------------------
 Documentation/btrfs.asciidoc                  |  2 -
 Makefile                                      |  2 +-
 tests/common                                  | 13 ++++--
 .../012-find-root-no-result/test.sh           |  2 +-
 .../020-fix-superblock-corruption/test.sh     |  2 +-
 tests/testsuite-files                         |  2 +
 10 files changed, 14 insertions(+), 94 deletions(-)
 delete mode 100644 Documentation/btrfs-find-root.asciidoc
 delete mode 100644 Documentation/btrfs-select-super.asciidoc
Signature · 1 line
2.25.0
#1 lore raw

PATCH 1/3 progs: Remove manpages of not packaged binaries

From: Marcos Paulo de Souza <[email protected]>

btrfs-find-root and btrfs-select-super stopped to be shipped in 2014, so remove all references to these manpages as well.

---
 .gitignore                                |  2 -
 Documentation/Makefile.in                 |  2 -
 Documentation/btrfs-find-root.asciidoc    | 35 -----------------
 Documentation/btrfs-select-super.asciidoc | 46 -----------------------
 Documentation/btrfs.asciidoc              |  2 -
 5 files changed, 87 deletions(-)
 delete mode 100644 Documentation/btrfs-find-root.asciidoc
 delete mode 100644 Documentation/btrfs-select-super.asciidoc
.gitignore +0 -2
index aadf9ae7..2b1c1aef 100644
@@ -73,7 +73,6 @@
 /Documentation/btrfs-convert.8
 /Documentation/btrfs-device.8
 /Documentation/btrfs-filesystem.8
-/Documentation/btrfs-find-root.8
 /Documentation/btrfs-image.8
 /Documentation/btrfs-inspect-internal.8
 /Documentation/btrfs-ioctl.3
@@ -87,7 +86,6 @@
 /Documentation/btrfs-rescue.8
 /Documentation/btrfs-restore.8
 /Documentation/btrfs-scrub.8
-/Documentation/btrfs-select-super.8
 /Documentation/btrfs-send.8
 /Documentation/btrfs-subvolume.8
 /Documentation/btrfs.8
Documentation/Makefile.in +0 -2
index d35cb858..ff0459c0 100644
@@ -4,10 +4,8 @@ MAN8_TXT =
 # Top level commands
 MAN8_TXT += btrfs.asciidoc
 MAN8_TXT += btrfs-convert.asciidoc
-MAN8_TXT += btrfs-find-root.asciidoc
 MAN8_TXT += btrfs-image.asciidoc
 MAN8_TXT += btrfs-map-logical.asciidoc
-MAN8_TXT += btrfs-select-super.asciidoc
 MAN8_TXT += btrfstune.asciidoc
 MAN8_TXT += fsck.btrfs.asciidoc
 MAN8_TXT += mkfs.btrfs.asciidoc
Documentation/btrfs-find-root.asciidoc deleted +0 -35
deleted file mode 100644
index 652796c8..00000000
@@ -1,35 +0,0 @@
-btrfs-find-root(8)
-==================
-
-NAME
-----
-btrfs-find-root - filter to find btrfs root
-
-SYNOPSIS
---------
-*btrfs-find-root* [options] <device>
-
-DESCRIPTION
------------
-*btrfs-find-root* is used to find the satisfied root, you can filter by
-root tree's objectid, generation, level.
-
-OPTIONS
--------
--a::
-Search through all metadata extents, even the root has been already found.
--g <generation>::
-Filter root tree by it's original transaction id, tree root's generation in default.
--o <objectid>::
-Filter root tree by it's objectid,tree root's objectid in default.
--l <level>::
-Filter root tree by B-+ tree's level, level 0 in default.
-
-EXIT STATUS
------------
-*btrfs-find-root* will return 0 if no error happened.
-If any problems happened, 1 will be returned.
-
-SEE ALSO
---------
-`mkfs.btrfs`(8)
Documentation/btrfs-select-super.asciidoc deleted +0 -46

46 lines not on this page · raw message

Documentation/btrfs.asciidoc +0 -2
index 1625f6d8..e3328942 100644
@@ -115,8 +115,6 @@ Tools that are still in active use without an equivalent in *btrfs*:
 
 *btrfs-convert*:: in-place conversion from ext2/3/4 filesystems to btrfs
 *btrfstune*:: tweak some filesystem properties on a unmounted filesystem
-*btrfs-select-super*:: rescue tool to overwrite primary superblock from a spare copy
-*btrfs-find-root*:: rescue helper to find tree roots in a filesystem
 
 Deprecated and obsolete tools:
 
Signature · 1 line
2.25.0
#2 lore raw

Re: [PATCH 1/3] progs: Remove manpages of not packaged binaries

Quoted 4 lines · Marcos Paulo de Souza

From: Marcos Paulo de Souza <[email protected]>

btrfs-find-root and btrfs-select-super stopped to be shipped in 2014, so remove all references to these manpages as well.

Nope, my distro is still shipping it, and I find it kinda useful for certain recovery scenario.

Thus it's better to keep their documents.

Thanks,
Qu

Quoted 154 lines
---
 .gitignore                                |  2 -
 Documentation/Makefile.in                 |  2 -
 Documentation/btrfs-find-root.asciidoc    | 35 -----------------
 Documentation/btrfs-select-super.asciidoc | 46 -----------------------
 Documentation/btrfs.asciidoc              |  2 -
 5 files changed, 87 deletions(-)
 delete mode 100644 Documentation/btrfs-find-root.asciidoc
 delete mode 100644 Documentation/btrfs-select-super.asciidoc
.gitignore +0 -2
index aadf9ae7..2b1c1aef 100644
@@ -73,7 +73,6 @@
 /Documentation/btrfs-convert.8
 /Documentation/btrfs-device.8
 /Documentation/btrfs-filesystem.8
-/Documentation/btrfs-find-root.8
 /Documentation/btrfs-image.8
 /Documentation/btrfs-inspect-internal.8
 /Documentation/btrfs-ioctl.3
@@ -87,7 +86,6 @@
 /Documentation/btrfs-rescue.8
 /Documentation/btrfs-restore.8
 /Documentation/btrfs-scrub.8
-/Documentation/btrfs-select-super.8
 /Documentation/btrfs-send.8
 /Documentation/btrfs-subvolume.8
 /Documentation/btrfs.8
Documentation/Makefile.in +0 -2
index d35cb858..ff0459c0 100644
@@ -4,10 +4,8 @@ MAN8_TXT =
 # Top level commands
 MAN8_TXT += btrfs.asciidoc
 MAN8_TXT += btrfs-convert.asciidoc
-MAN8_TXT += btrfs-find-root.asciidoc
 MAN8_TXT += btrfs-image.asciidoc
 MAN8_TXT += btrfs-map-logical.asciidoc
-MAN8_TXT += btrfs-select-super.asciidoc
 MAN8_TXT += btrfstune.asciidoc
 MAN8_TXT += fsck.btrfs.asciidoc
 MAN8_TXT += mkfs.btrfs.asciidoc
Documentation/btrfs-find-root.asciidoc deleted +0 -35
deleted file mode 100644
index 652796c8..00000000
@@ -1,35 +0,0 @@
-btrfs-find-root(8)
-==================
-
-NAME
-----
-btrfs-find-root - filter to find btrfs root
-
-SYNOPSIS
---------
-*btrfs-find-root* [options] <device>
-
-DESCRIPTION
------------
-*btrfs-find-root* is used to find the satisfied root, you can filter by
-root tree's objectid, generation, level.
-
-OPTIONS
--------
--a::
-Search through all metadata extents, even the root has been already found.
--g <generation>::
-Filter root tree by it's original transaction id, tree root's generation in default.
--o <objectid>::
-Filter root tree by it's objectid,tree root's objectid in default.
--l <level>::
-Filter root tree by B-+ tree's level, level 0 in default.
-
-EXIT STATUS
------------
-*btrfs-find-root* will return 0 if no error happened.
-If any problems happened, 1 will be returned.
-
-SEE ALSO
---------
-`mkfs.btrfs`(8)
Documentation/btrfs-select-super.asciidoc deleted +0 -46
deleted file mode 100644
index e3bca98b..00000000
@@ -1,46 +0,0 @@
-btrfs-select-super(8)
-=====================
-
-NAME
-----
-btrfs-select-super - overwrite primary superblock with a backup copy
-
-SYNOPSIS
---------
-*btrfs-select-super* -s number <device>
-
-DESCRIPTION
------------
-Destructively overwrite all copies of the superblock
-with a specified copy.  This helps in certain cases, for example when write
-barriers were disabled during a power failure and not all superblocks were
-written, or if the primary superblock is damaged, eg. accidentally overwritten.
-
-The filesystem specified by 'device' must not be mounted.
-
-NOTE: *Prior to overwriting the primary superblock, please make sure that the backup
-copies are valid!*
-
-To dump a superblock use the *btrfs inspect-internal dump-super* command.
-
-Then run the check (in the non-repair mode) using the command *btrfs check -s*
-where '-s' specifies the superblock copy to use.
-
-Superblock copies exist in the following offsets on the device:
-
-- primary: '64KiB' (65536)
-- 1st copy: '64MiB' (67108864)
-- 2nd copy: '256GiB' (274877906944)
-
-A superblock size is '4KiB' (4096).
-
-OPTIONS
--------
--s|--super <superblock>::
-use 'superblock'th superblock copy, valid values are 0 1 or 2 if the
-respective superblock offset is within the device size
-
-SEE ALSO
---------
-`btrfs-inspect-internal`(8),
-`btrfsck check`(8)
Documentation/btrfs.asciidoc +0 -2
index 1625f6d8..e3328942 100644
@@ -115,8 +115,6 @@ Tools that are still in active use without an equivalent in *btrfs*:
 
 *btrfs-convert*:: in-place conversion from ext2/3/4 filesystems to btrfs
 *btrfstune*:: tweak some filesystem properties on a unmounted filesystem
-*btrfs-select-super*:: rescue tool to overwrite primary superblock from a spare copy
-*btrfs-find-root*:: rescue helper to find tree roots in a filesystem
 
 Deprecated and obsolete tools:
 
#3 lore raw

Re: [PATCH 1/3] progs: Remove manpages of not packaged binaries

Quoted 4 lines · Qu Wenruo
Quoted 2 lines · Marcos Paulo de Souza

From: Marcos Paulo de Souza <[email protected]>

Quoted 8 lines
Quoted 1 line

btrfs-find-root and btrfs-select-super stopped to be shipped in

2014, so

Quoted 1 line

remove all references to these manpages as well.

Nope, my distro is still shipping it, and I find it kinda useful for certain recovery scenario.

Thus it's better to keep their documents.

Thanks for checking this Qu. What do you think about the other two patches?

David, do you think you can only patches 2 and 3? The first patch can be skipped, since only the later two solve the issue.

Thanks,
Marcos

Quoted 179 lines

Thanks,
Qu

Quoted 7 lines
---
 .gitignore                                |  2 -
 Documentation/Makefile.in                 |  2 -
 Documentation/btrfs-find-root.asciidoc    | 35 -----------------
 Documentation/btrfs-select-super.asciidoc | 46 -----------------

------

Review

Quoted 41 lines
 Documentation/btrfs.asciidoc              |  2 -
 5 files changed, 87 deletions(-)
 delete mode 100644 Documentation/btrfs-find-root.asciidoc
 delete mode 100644 Documentation/btrfs-select-super.asciidoc
.gitignore +0 -2
index aadf9ae7..2b1c1aef 100644
@@ -73,7 +73,6 @@
 /Documentation/btrfs-convert.8
 /Documentation/btrfs-device.8
 /Documentation/btrfs-filesystem.8
-/Documentation/btrfs-find-root.8
 /Documentation/btrfs-image.8
 /Documentation/btrfs-inspect-internal.8
 /Documentation/btrfs-ioctl.3
@@ -87,7 +86,6 @@
 /Documentation/btrfs-rescue.8
 /Documentation/btrfs-restore.8
 /Documentation/btrfs-scrub.8
-/Documentation/btrfs-select-super.8
 /Documentation/btrfs-send.8
 /Documentation/btrfs-subvolume.8
 /Documentation/btrfs.8
Documentation/Makefile.in +0 -2
index d35cb858..ff0459c0 100644
@@ -4,10 +4,8 @@ MAN8_TXT =
 # Top level commands
 MAN8_TXT += btrfs.asciidoc
 MAN8_TXT += btrfs-convert.asciidoc
-MAN8_TXT += btrfs-find-root.asciidoc
 MAN8_TXT += btrfs-image.asciidoc
 MAN8_TXT += btrfs-map-logical.asciidoc
-MAN8_TXT += btrfs-select-super.asciidoc
 MAN8_TXT += btrfstune.asciidoc
 MAN8_TXT += fsck.btrfs.asciidoc
 MAN8_TXT += mkfs.btrfs.asciidoc
(quoted diff) +0 -0

b/Documentation/btrfs-find-root.asciidoc

Quoted 9 lines

deleted file mode 100644
index 652796c8..00000000

Documentation/btrfs-find-root.asciidoc deleted +0 -4
@@ -1,35 +0,0 @@
-btrfs-find-root(8)
-==================
-
-NAME

Documentation/btrfs-find-root.asciidoc line 14

Quoted 10 lines
Documentation/btrfs-find-root.asciidoc deleted +0 -10
-----
-btrfs-find-root - filter to find btrfs root
-
-SYNOPSIS
---------
-*btrfs-find-root* [options] <device>
-
-DESCRIPTION
------------
-*btrfs-find-root* is used to find the satisfied root, you can

filter by

Documentation/btrfs-find-root.asciidoc

Quoted 6 lines
Documentation/btrfs-find-root.asciidoc deleted +0 -6
-root tree's objectid, generation, level.
-
-OPTIONS
--------
--a::
-Search through all metadata extents, even the root has been

already found.

Documentation/btrfs-find-root.asciidoc line 22

Quoted 2 lines
Documentation/btrfs-find-root.asciidoc deleted +0 -2
--g <generation>::
-Filter root tree by it's original transaction id, tree root's

generation in default.

Review

Quoted 14 lines
Documentation/btrfs-find-root.asciidoc deleted +0 -13
--o <objectid>::
-Filter root tree by it's objectid,tree root's objectid in default.
--l <level>::
-Filter root tree by B-+ tree's level, level 0 in default.
-
-EXIT STATUS
------------
-*btrfs-find-root* will return 0 if no error happened.
-If any problems happened, 1 will be returned.
-
-SEE ALSO
---------
-`mkfs.btrfs`(8)
(quoted diff) +0 -0

b/Documentation/btrfs-select-super.asciidoc

Documentation/btrfs-select-super.asciidoc line 6

Quoted 11 lines

deleted file mode 100644
index e3bca98b..00000000

Documentation/btrfs-select-super.asciidoc deleted +0 -6
@@ -1,46 +0,0 @@
-btrfs-select-super(8)
-=====================
-
-NAME
-----
-btrfs-select-super - overwrite primary superblock with a backup

copy

Documentation/btrfs-select-super.asciidoc

Quoted 9 lines
Documentation/btrfs-select-super.asciidoc deleted +0 -9
-
-SYNOPSIS
---------
-*btrfs-select-super* -s number <device>
-
-DESCRIPTION
------------
-Destructively overwrite all copies of the superblock
-with a specified copy.  This helps in certain cases, for example

when write

Documentation/btrfs-select-super.asciidoc line 16

Quoted 1 line
Documentation/btrfs-select-super.asciidoc deleted +0 -1
-barriers were disabled during a power failure and not all

superblocks were

Documentation/btrfs-select-super.asciidoc line 17

Quoted 1 line
Documentation/btrfs-select-super.asciidoc deleted +0 -1
-written, or if the primary superblock is damaged, eg. accidentally

overwritten.

Documentation/btrfs-select-super.asciidoc

Quoted 4 lines
Documentation/btrfs-select-super.asciidoc deleted +0 -4
-
-The filesystem specified by 'device' must not be mounted.
-
-NOTE: *Prior to overwriting the primary superblock, please make

sure that the backup

Documentation/btrfs-select-super.asciidoc

Quoted 3 lines
Documentation/btrfs-select-super.asciidoc deleted +0 -3
-copies are valid!*
-
-To dump a superblock use the *btrfs inspect-internal dump-super*

command.

Documentation/btrfs-select-super.asciidoc line 26

Quoted 2 lines
Documentation/btrfs-select-super.asciidoc deleted +0 -2
-
-Then run the check (in the non-repair mode) using the command

*btrfs check -s*

Quoted 4 lines
Documentation/btrfs-select-super.asciidoc deleted +0 -4
-where '-s' specifies the superblock copy to use.
-
-Superblock copies exist in the following offsets on the device:
-

Documentation/btrfs-select-super.asciidoc

Quoted 10 lines
Documentation/btrfs-select-super.asciidoc deleted +0 -10
-- primary: '64KiB' (65536)
-- 1st copy: '64MiB' (67108864)
-- 2nd copy: '256GiB' (274877906944)
-
-A superblock size is '4KiB' (4096).
-
-OPTIONS
--------
--s|--super <superblock>::
-use 'superblock'th superblock copy, valid values are 0 1 or 2 if

the

Review

Quoted 7 lines
Documentation/btrfs-select-super.asciidoc deleted +0 -6
-respective superblock offset is within the device size
-
-SEE ALSO
---------
-`btrfs-inspect-internal`(8),
-`btrfsck check`(8)
(quoted diff) +0 -0

b/Documentation/btrfs.asciidoc

Documentation/btrfs.asciidoc Tools that are still in active use without an

Quoted 4 lines

index 1625f6d8..e3328942 100644

Documentation/btrfs.asciidoc +0 -0
@@ -115,8 +115,6 @@ Tools that are still in active use without an

equivalent in *btrfs*:

Documentation/btrfs.asciidoc Tools that are still in active use without an · line 115

Quoted 2 lines
Documentation/btrfs.asciidoc +0 -0
 *btrfs-convert*:: in-place conversion from ext2/3/4 filesystems to

btrfs

Documentation/btrfs.asciidoc Tools that are still in active use without an · line 116

Quoted 1 line
Documentation/btrfs.asciidoc +0 -0
 *btrfstune*:: tweak some filesystem properties on a unmounted

filesystem

Documentation/btrfs.asciidoc Tools that are still in active use without an · line 117

Quoted 1 line
Documentation/btrfs.asciidoc +0 -1
-*btrfs-select-super*:: rescue tool to overwrite primary superblock

from a spare copy

Documentation/btrfs.asciidoc Tools that are still in active use without an · line 118

Quoted 1 line
Documentation/btrfs.asciidoc +0 -1
-*btrfs-find-root*:: rescue helper to find tree roots in a

filesystem

Quoted 4 lines
Documentation/btrfs.asciidoc +0 -0
 Deprecated and obsolete tools:
 
 
#4 lore raw

Re: [PATCH 1/3] progs: Remove manpages of not packaged binaries

Quoted 12 lines · Marcos Paulo de Souza
Quoted 11 lines · Qu Wenruo
Quoted 3 lines · Marcos Paulo de Souza

From: Marcos Paulo de Souza <[email protected]>

btrfs-find-root and btrfs-select-super stopped to be shipped in

2014, so

Quoted 1 line

remove all references to these manpages as well.

Nope, my distro is still shipping it, and I find it kinda useful for certain recovery scenario.

Quoted 7 lines
Quoted 1 line

Thus it's better to keep their documents.

Thanks for checking this Qu. What do you think about the other two patches?

David, do you think you can only patches 2 and 3? The first patch can be skipped, since only the later two solve the issue.

I was not expecing to see actual removal of the manual pages but rather removing manual pages installed by distro packages without the related binaries. In the long term we want to migrate the functionality of find-root and select-super to the 'rescue' subcommand and at that time the manual pages' text will be moved. Until then it should be kept but it's up to the distro package to either ship the binaries + manual pages or neither.

#5 lore raw

PATCH 2/3 progs: Include btrfs-find-root and btrfs-select-super in testsuite

In reply to Marcos Paulo de Souza

From: Marcos Paulo de Souza <[email protected]>

Since these two binaries are not shipped into userspace, and they are used by the testsuite, they need to be include in the final tar.

---
 Makefile              | 2 +-
 tests/testsuite-files | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)
Makefile +1 -1
index b00eafe4..0cd7f0c1 100644
@@ -424,7 +424,7 @@ test-inst: all
 
 test: test-fsck test-mkfs test-misc test-cli test-convert test-fuzz
 
-testsuite: btrfs-corrupt-block fssum
+testsuite: btrfs-corrupt-block btrfs-find-root btrfs-select-super fssum
 	@echo "Export tests as a package"
 	$(Q)cd tests && ./export-testsuite.sh
 
tests/testsuite-files +2 -0
index 09df6298..507d35fb 100644
@@ -3,6 +3,8 @@ G Documentation/
 F testsuite-id
 F ../fssum
 F ../btrfs-corrupt-block
+F ../btrfs-find-root
+F ../btrfs-select-super
 F common
 F common.convert
 F common.local
Signature · 1 line
2.25.0
Reviewed-by on v1 2/3
#6 lore raw

Re: [PATCH 2/3] progs: Include btrfs-find-root and btrfs-select-super in testsuite

Quoted 6 lines · Marcos Paulo de Souza

From: Marcos Paulo de Souza <[email protected]>

Since these two binaries are not shipped into userspace, and they are used by the testsuite, they need to be include in the final tar.

Just a small nitpick, the prefix for the patch should be "btrfs-progs: " not "progs: ".

Thanks,
Qu

Quoted 32 lines
---
 Makefile              | 2 +-
 tests/testsuite-files | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)
Makefile +1 -1
index b00eafe4..0cd7f0c1 100644
@@ -424,7 +424,7 @@ test-inst: all
 
 test: test-fsck test-mkfs test-misc test-cli test-convert test-fuzz
 
-testsuite: btrfs-corrupt-block fssum
+testsuite: btrfs-corrupt-block btrfs-find-root btrfs-select-super fssum
 	@echo "Export tests as a package"
 	$(Q)cd tests && ./export-testsuite.sh
 
tests/testsuite-files +2 -0
index 09df6298..507d35fb 100644
@@ -3,6 +3,8 @@ G Documentation/
 F testsuite-id
 F ../fssum
 F ../btrfs-corrupt-block
+F ../btrfs-find-root
+F ../btrfs-select-super
 F common
 F common.convert
 F common.local
#7 lore raw

PATCH 3/3 progs: tests: misc: btrfs-{find-root,select-super} are internal commands

In reply to Marcos Paulo de Souza

From: Marcos Paulo de Souza <[email protected]>

With this commit, testsuite works as expected.

---
 tests/common                                        | 13 +++++++++----
 tests/misc-tests/012-find-root-no-result/test.sh    |  2 +-
 .../020-fix-superblock-corruption/test.sh           |  2 +-
 3 files changed, 11 insertions(+), 6 deletions(-)
tests/common +9 -4
index 605cf72c..26190d85 100644
@@ -305,13 +305,18 @@ run_mustfail_stdout()
 
 check_prereq()
 {
-	if [ "$1" = "btrfs-corrupt-block" -o "$1" = "fssum" ]; then
+	case "$1" in
+	btrfs-corrupt-block|btrfs-find-root|btrfs-select-super|fssum)
 		if ! [ -f "$INTERNAL_BIN/$1" ]; then
 			_fail "Failed prerequisites: $INTERNAL_BIN/$1";
 		fi
-	elif ! [ -f "$TOP/$1" ]; then
-		_fail "Failed prerequisites: $TOP/$1";
-	fi
+		;;
+	*)
+		if ! [ -f "$TOP/$1" ]; then
+			_fail "Failed prerequisites: $TOP/$1";
+		fi
+		;;
+	esac
 }
 
 check_global_prereq()
tests/misc-tests/012-find-root-no-result/test.sh +1 -1
index 6dd447f3..edfdfd38 100755
@@ -11,7 +11,7 @@ check_prereq btrfs-image
 run_check "$TOP/btrfs-image" -r first_meta_chunk.btrfs-image test.img || \
 	_fail "failed to extract first_meta_chunk.btrfs-image"
 
-result=$(run_check_stdout "$TOP/btrfs-find-root" test.img | sed '/^Superblock/d')
+result=$(run_check_stdout "$INTERNAL_BIN/btrfs-find-root" test.img | sed '/^Superblock/d')
 
 if [ -z "$result" ]; then
 	_fail "btrfs-find-root failed to find tree root"
tests/misc-tests/020-fix-superblock-corruption/test.sh +1 -1
index 404d416b..d67a87c3 100755
@@ -25,7 +25,7 @@ test_superblock_restore()
 		_fail "btrfs check should detect corruption"
 
 	# Copy backup superblock to primary
-	run_check "$TOP/btrfs-select-super" -s 1 "$TEST_DEV"
+	run_check "$INTERNAL_BIN/btrfs-select-super" -s 1 "$TEST_DEV"
 
 	# Perform btrfs check
 	run_check "$TOP/btrfs" check "$TEST_DEV"
Signature · 1 line
2.25.0
Reviewed-by on v1 3/3
#8 lore raw

Re: [PATCH 3/3] progs: tests: misc: btrfs-{find-root,select-super} are internal commands

Quoted 5 lines · Marcos Paulo de Souza

From: Marcos Paulo de Souza <[email protected]>

With this commit, testsuite works as expected.

Thanks,
Qu

Quoted 60 lines
---
 tests/common                                        | 13 +++++++++----
 tests/misc-tests/012-find-root-no-result/test.sh    |  2 +-
 .../020-fix-superblock-corruption/test.sh           |  2 +-
 3 files changed, 11 insertions(+), 6 deletions(-)
tests/common +9 -4
index 605cf72c..26190d85 100644
@@ -305,13 +305,18 @@ run_mustfail_stdout()
 
 check_prereq()
 {
-	if [ "$1" = "btrfs-corrupt-block" -o "$1" = "fssum" ]; then
+	case "$1" in
+	btrfs-corrupt-block|btrfs-find-root|btrfs-select-super|fssum)
 		if ! [ -f "$INTERNAL_BIN/$1" ]; then
 			_fail "Failed prerequisites: $INTERNAL_BIN/$1";
 		fi
-	elif ! [ -f "$TOP/$1" ]; then
-		_fail "Failed prerequisites: $TOP/$1";
-	fi
+		;;
+	*)
+		if ! [ -f "$TOP/$1" ]; then
+			_fail "Failed prerequisites: $TOP/$1";
+		fi
+		;;
+	esac
 }
 
 check_global_prereq()
tests/misc-tests/012-find-root-no-result/test.sh +1 -1
index 6dd447f3..edfdfd38 100755
@@ -11,7 +11,7 @@ check_prereq btrfs-image
 run_check "$TOP/btrfs-image" -r first_meta_chunk.btrfs-image test.img || \
 	_fail "failed to extract first_meta_chunk.btrfs-image"
 
-result=$(run_check_stdout "$TOP/btrfs-find-root" test.img | sed '/^Superblock/d')
+result=$(run_check_stdout "$INTERNAL_BIN/btrfs-find-root" test.img | sed '/^Superblock/d')
 
 if [ -z "$result" ]; then
 	_fail "btrfs-find-root failed to find tree root"
tests/misc-tests/020-fix-superblock-corruption/test.sh +1 -1
index 404d416b..d67a87c3 100755
@@ -25,7 +25,7 @@ test_superblock_restore()
 		_fail "btrfs check should detect corruption"
 
 	# Copy backup superblock to primary
-	run_check "$TOP/btrfs-select-super" -s 1 "$TEST_DEV"
+	run_check "$INTERNAL_BIN/btrfs-select-super" -s 1 "$TEST_DEV"
 
 	# Perform btrfs check
 	run_check "$TOP/btrfs" check "$TEST_DEV"