Skip to contentSkip to conversation

btrfs/300: check existence of unshare arguments

PATCH In review Darrick J. Wong 2 participants 2 messages Sep 27, 2023 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 btrfs/300: check existence of unshare arguments

From: Darrick J. Wong <[email protected]>

Make sure the installed unshare binary supports all the arguments that it wants to use. The unshare program on my system (Ubuntu 22.04) doesn't support --map-auto, so this test fails unnecessarily.

---
 common/rc       |    2 +-
 tests/btrfs/300 |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
common/rc +1 -1
index 41862c2766..722e3bdcaa 100644
@@ -5333,7 +5333,7 @@ _soak_loop_running() {
 
 _require_unshare() {
 	unshare -f -r -m -p -U $@ true &>/dev/null || \
-		_notrun "unshare: command not found, should be in util-linux"
+		_notrun "unshare $*: command not found, should be in util-linux"
 }
 
 # Return a random file in a directory. A directory is *not* followed
tests/btrfs/300 +1 -1
index ff87ee7112..8a0eaecf87 100755
@@ -20,7 +20,7 @@ _require_test
 _require_user
 _require_group
 _require_unix_perm_checking
-_require_unshare
+_require_unshare --keep-caps --map-auto --map-root-user
 
 test_dir="${TEST_DIR}/${seq}"
 cleanup() {
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Darrick J. Wong

From: Darrick J. Wong <[email protected]>

Make sure the installed unshare binary supports all the arguments that it wants to use. The unshare program on my system (Ubuntu 22.04) doesn't support --map-auto, so this test fails unnecessarily.

Looks good, thanks.

Quoted 31 lines
---
 common/rc       |    2 +-
 tests/btrfs/300 |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
common/rc +1 -1
index 41862c2766..722e3bdcaa 100644
@@ -5333,7 +5333,7 @@ _soak_loop_running() {
 
 _require_unshare() {
        unshare -f -r -m -p -U $@ true &>/dev/null || \
-               _notrun "unshare: command not found, should be in util-linux"
+               _notrun "unshare $*: command not found, should be in util-linux"
 }
 
 # Return a random file in a directory. A directory is *not* followed
tests/btrfs/300 +1 -1
index ff87ee7112..8a0eaecf87 100755
@@ -20,7 +20,7 @@ _require_test
 _require_user
 _require_group
 _require_unix_perm_checking
-_require_unshare
+_require_unshare --keep-caps --map-auto --map-root-user
 
 test_dir="${TEST_DIR}/${seq}"
 cleanup() {