Linux Btrfs filesystem development
 help / color / mirror / Atom feed
* [PATCH 0/4] btrfs-progs: make some of the fsck-tests run without root
@ 2023-04-10 18:11 Josef Bacik
  2023-04-10 18:11 ` [PATCH 1/4] btrfs-progs: fix fsck-tests/056 to " Josef Bacik
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Josef Bacik @ 2023-04-10 18:11 UTC (permalink / raw)
  To: linux-btrfs

Hello,

While running tests on my ctree sync patches I noticed these tests were failing
when I ran as a normal user.  Most of them are just needing to call
setup_root_helper before calling the loop device helpers, some need a
$SUDO_HELPER added to a few places.  With these patches in place I can run make
test-fsck as a normal user.  Thanks,

Josef

Josef Bacik (4):
  btrfs-progs: fix fsck-tests/056 to run without root
  btrfs-progs: fix fsck-tests/057 to run without root
  btrfs-progs: fix fsck-tests/059 to run without root
  btrfs-progs: fix fsck-tests/060 to run without root

 tests/fsck-tests/056-raid56-false-alerts/test.sh | 6 +++---
 tests/fsck-tests/057-seed-false-alerts/test.sh   | 8 ++++----
 tests/fsck-tests/059-shrunk-device/test.sh       | 4 ++--
 tests/fsck-tests/060-degraded-check/test.sh      | 4 ++--
 4 files changed, 11 insertions(+), 11 deletions(-)

-- 
2.39.2


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/4] btrfs-progs: fix fsck-tests/056 to run without root
  2023-04-10 18:11 [PATCH 0/4] btrfs-progs: make some of the fsck-tests run without root Josef Bacik
@ 2023-04-10 18:11 ` Josef Bacik
  2023-04-10 18:11 ` [PATCH 2/4] btrfs-progs: fix fsck-tests/057 " Josef Bacik
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Josef Bacik @ 2023-04-10 18:11 UTC (permalink / raw)
  To: linux-btrfs

We need to make sure the root helper is setup before calling the loop
helpers, and additionally we need to use $SUDO_HELPER when we run the
final btrfs check.  With this patch we can now run this test as a normal
user.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
---
 tests/fsck-tests/056-raid56-false-alerts/test.sh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tests/fsck-tests/056-raid56-false-alerts/test.sh b/tests/fsck-tests/056-raid56-false-alerts/test.sh
index 6efb5c00..fcd37971 100755
--- a/tests/fsck-tests/056-raid56-false-alerts/test.sh
+++ b/tests/fsck-tests/056-raid56-false-alerts/test.sh
@@ -10,13 +10,13 @@ check_prereq btrfs
 check_prereq mkfs.btrfs
 check_global_prereq losetup
 
+setup_root_helper
+
 setup_loopdevs 3
 prepare_loopdevs
 dev1=${loopdevs[1]}
 TEST_DEV=$dev1
 
-setup_root_helper
-
 run_check $SUDO_HELPER "$TOP/mkfs.btrfs" -f -m raid1 -d raid5 "${loopdevs[@]}"
 run_check_mount_test_dev
 
@@ -26,6 +26,6 @@ run_check $SUDO_HELPER dd if=/dev/urandom of="$TEST_MNT/file" bs=16K count=1 \
 run_check_umount_test_dev
 
 # Check data csum should not report false alerts
-run_check "$TOP/btrfs" check --check-data-csum "$dev1"
+run_check $SUDO_HELPER "$TOP/btrfs" check --check-data-csum "$dev1"
 
 cleanup_loopdevs
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/4] btrfs-progs: fix fsck-tests/057 to run without root
  2023-04-10 18:11 [PATCH 0/4] btrfs-progs: make some of the fsck-tests run without root Josef Bacik
  2023-04-10 18:11 ` [PATCH 1/4] btrfs-progs: fix fsck-tests/056 to " Josef Bacik
@ 2023-04-10 18:11 ` Josef Bacik
  2023-04-10 18:11 ` [PATCH 3/4] btrfs-progs: fix fsck-tests/059 " Josef Bacik
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Josef Bacik @ 2023-04-10 18:11 UTC (permalink / raw)
  To: linux-btrfs

The setup_root_helper needs to be called before messing with the loop
devices, and btrfs check needs to be run with $SUDO_HELPER.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
---
 tests/fsck-tests/057-seed-false-alerts/test.sh | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tests/fsck-tests/057-seed-false-alerts/test.sh b/tests/fsck-tests/057-seed-false-alerts/test.sh
index 1d5ad878..4af83c92 100755
--- a/tests/fsck-tests/057-seed-false-alerts/test.sh
+++ b/tests/fsck-tests/057-seed-false-alerts/test.sh
@@ -10,14 +10,14 @@ check_prereq mkfs.btrfs
 check_prereq btrfstune
 check_global_prereq losetup
 
+setup_root_helper
+
 setup_loopdevs 2
 prepare_loopdevs
 dev1=${loopdevs[1]}
 dev2=${loopdevs[2]}
 TEST_DEV=$dev1
 
-setup_root_helper
-
 run_check $SUDO_HELPER "$TOP/mkfs.btrfs" -f "$dev1"
 run_check $SUDO_HELPER "$TOP/btrfstune" -S 1 "$dev1"
 run_check_mount_test_dev
@@ -32,8 +32,8 @@ sprouted_output=$(_mktemp btrfs-progs-sprouted-check-stdout.XXXXXX)
 
 # The false alerts are just warnings, so we need to save and filter
 # the output
-run_check_stdout "$TOP/btrfs" check "$dev1" >> "$seed_output"
-run_check_stdout "$TOP/btrfs" check "$dev2" >> "$sprouted_output"
+run_check_stdout $SUDO_HELPER "$TOP/btrfs" check "$dev1" >> "$seed_output"
+run_check_stdout $SUDO_HELPER "$TOP/btrfs" check "$dev2" >> "$sprouted_output"
 
 # There should be no warning for both seed and sprouted fs
 if grep -q "WARNING" "$seed_output"; then
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/4] btrfs-progs: fix fsck-tests/059 to run without root
  2023-04-10 18:11 [PATCH 0/4] btrfs-progs: make some of the fsck-tests run without root Josef Bacik
  2023-04-10 18:11 ` [PATCH 1/4] btrfs-progs: fix fsck-tests/056 to " Josef Bacik
  2023-04-10 18:11 ` [PATCH 2/4] btrfs-progs: fix fsck-tests/057 " Josef Bacik
@ 2023-04-10 18:11 ` Josef Bacik
  2023-04-10 18:11 ` [PATCH 4/4] btrfs-progs: fix fsck-tests/060 " Josef Bacik
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Josef Bacik @ 2023-04-10 18:11 UTC (permalink / raw)
  To: linux-btrfs

We missed a couple of $SUDO_HELPER uses in this test that made it
impossible to run without root.  Add them in so we can run as a normal
user.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
---
 tests/fsck-tests/059-shrunk-device/test.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/fsck-tests/059-shrunk-device/test.sh b/tests/fsck-tests/059-shrunk-device/test.sh
index 140ee3a4..3ac2640f 100755
--- a/tests/fsck-tests/059-shrunk-device/test.sh
+++ b/tests/fsck-tests/059-shrunk-device/test.sh
@@ -14,7 +14,7 @@ _mktemp_local "$file" 1g
 
 dev=$(run_check_stdout $SUDO_HELPER losetup --find --show "$file")
 
-run_check "$TOP/mkfs.btrfs" -f "$dev"
+run_check $SUDO_HELPER "$TOP/mkfs.btrfs" -f "$dev"
 
 # The original device size from prepare_loopdevs is 2G.
 # Since the fs is empty, shrinking it to 996m will not cause any
@@ -26,5 +26,5 @@ dev=$(run_check_stdout $SUDO_HELPER losetup --find --show "$file")
 run_mustfail "btrfs check should detect errors in device size" \
 	"$TOP/btrfs" check "$dev"
 
-losetup -d "$dev"
+$SUDO_HELPER losetup -d "$dev"
 rm -- "$file"
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 4/4] btrfs-progs: fix fsck-tests/060 to run without root
  2023-04-10 18:11 [PATCH 0/4] btrfs-progs: make some of the fsck-tests run without root Josef Bacik
                   ` (2 preceding siblings ...)
  2023-04-10 18:11 ` [PATCH 3/4] btrfs-progs: fix fsck-tests/059 " Josef Bacik
@ 2023-04-10 18:11 ` Josef Bacik
  2023-04-11 17:00 ` [PATCH 0/4] btrfs-progs: make some of the fsck-tests " Neal Gompa
  2023-04-11 23:56 ` David Sterba
  5 siblings, 0 replies; 7+ messages in thread
From: Josef Bacik @ 2023-04-10 18:11 UTC (permalink / raw)
  To: linux-btrfs

We need to call the setup_root_helper before we start messing with the
loop devices.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
---
 tests/fsck-tests/060-degraded-check/test.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/fsck-tests/060-degraded-check/test.sh b/tests/fsck-tests/060-degraded-check/test.sh
index 6a1f50c8..f185a655 100755
--- a/tests/fsck-tests/060-degraded-check/test.sh
+++ b/tests/fsck-tests/060-degraded-check/test.sh
@@ -10,14 +10,14 @@ check_prereq mkfs.btrfs
 check_global_prereq losetup
 check_global_prereq wipefs
 
+setup_root_helper
+
 setup_loopdevs 3
 prepare_loopdevs
 dev1=${loopdevs[1]}
 dev2=${loopdevs[2]}
 dev3=${loopdevs[3]}
 
-setup_root_helper
-
 # Run 1: victim is dev1
 run_check $SUDO_HELPER "$TOP/mkfs.btrfs" -f -m raid5 -d raid5 "${loopdevs[@]}"
 run_check $SUDO_HELPER wipefs -fa $dev1
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/4] btrfs-progs: make some of the fsck-tests run without root
  2023-04-10 18:11 [PATCH 0/4] btrfs-progs: make some of the fsck-tests run without root Josef Bacik
                   ` (3 preceding siblings ...)
  2023-04-10 18:11 ` [PATCH 4/4] btrfs-progs: fix fsck-tests/060 " Josef Bacik
@ 2023-04-11 17:00 ` Neal Gompa
  2023-04-11 23:56 ` David Sterba
  5 siblings, 0 replies; 7+ messages in thread
From: Neal Gompa @ 2023-04-11 17:00 UTC (permalink / raw)
  To: Josef Bacik; +Cc: linux-btrfs

On Mon, Apr 10, 2023 at 2:13 PM Josef Bacik <josef@toxicpanda.com> wrote:
>
> Hello,
>
> While running tests on my ctree sync patches I noticed these tests were failing
> when I ran as a normal user.  Most of them are just needing to call
> setup_root_helper before calling the loop device helpers, some need a
> $SUDO_HELPER added to a few places.  With these patches in place I can run make
> test-fsck as a normal user.  Thanks,
>
> Josef
>
> Josef Bacik (4):
>   btrfs-progs: fix fsck-tests/056 to run without root
>   btrfs-progs: fix fsck-tests/057 to run without root
>   btrfs-progs: fix fsck-tests/059 to run without root
>   btrfs-progs: fix fsck-tests/060 to run without root
>
>  tests/fsck-tests/056-raid56-false-alerts/test.sh | 6 +++---
>  tests/fsck-tests/057-seed-false-alerts/test.sh   | 8 ++++----
>  tests/fsck-tests/059-shrunk-device/test.sh       | 4 ++--
>  tests/fsck-tests/060-degraded-check/test.sh      | 4 ++--
>  4 files changed, 11 insertions(+), 11 deletions(-)
>
> --
> 2.39.2
>

LGTM.

Reviewed-by: Neal Gompa <neal@gompa.dev>



--
真実はいつも一つ!/ Always, there's only one truth!

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/4] btrfs-progs: make some of the fsck-tests run without root
  2023-04-10 18:11 [PATCH 0/4] btrfs-progs: make some of the fsck-tests run without root Josef Bacik
                   ` (4 preceding siblings ...)
  2023-04-11 17:00 ` [PATCH 0/4] btrfs-progs: make some of the fsck-tests " Neal Gompa
@ 2023-04-11 23:56 ` David Sterba
  5 siblings, 0 replies; 7+ messages in thread
From: David Sterba @ 2023-04-11 23:56 UTC (permalink / raw)
  To: Josef Bacik; +Cc: linux-btrfs

On Mon, Apr 10, 2023 at 02:11:30PM -0400, Josef Bacik wrote:
> Hello,
> 
> While running tests on my ctree sync patches I noticed these tests were failing
> when I ran as a normal user.  Most of them are just needing to call
> setup_root_helper before calling the loop device helpers, some need a
> $SUDO_HELPER added to a few places.  With these patches in place I can run make
> test-fsck as a normal user.  Thanks,
> 
> Josef
> 
> Josef Bacik (4):
>   btrfs-progs: fix fsck-tests/056 to run without root
>   btrfs-progs: fix fsck-tests/057 to run without root
>   btrfs-progs: fix fsck-tests/059 to run without root
>   btrfs-progs: fix fsck-tests/060 to run without root

Added to devel, thanks. I went through all other tests, there are some
more missing helper setup calls but they're also called within some
other helpers (like run_check_mkfs_test_dev). I've added them for
clarity.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-04-11 23:56 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-10 18:11 [PATCH 0/4] btrfs-progs: make some of the fsck-tests run without root Josef Bacik
2023-04-10 18:11 ` [PATCH 1/4] btrfs-progs: fix fsck-tests/056 to " Josef Bacik
2023-04-10 18:11 ` [PATCH 2/4] btrfs-progs: fix fsck-tests/057 " Josef Bacik
2023-04-10 18:11 ` [PATCH 3/4] btrfs-progs: fix fsck-tests/059 " Josef Bacik
2023-04-10 18:11 ` [PATCH 4/4] btrfs-progs: fix fsck-tests/060 " Josef Bacik
2023-04-11 17:00 ` [PATCH 0/4] btrfs-progs: make some of the fsck-tests " Neal Gompa
2023-04-11 23:56 ` David Sterba

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox