* [PATCH v2 1/1] btrfs/339: test receive dump stream for different user
@ 2025-11-19 5:28 Sidong Yang
2025-12-02 14:57 ` Filipe Manana
0 siblings, 1 reply; 3+ messages in thread
From: Sidong Yang @ 2025-11-19 5:28 UTC (permalink / raw)
To: fstests; +Cc: Sidong Yang, linux-btrfs
Test receive to dump stream file from different user.
This is a regression test for the btrfs-progs commit cd933616d485
("btrfs-progs: receive: don't use O_NOATIME to open stream for
dumping").
Signed-off-by: Sidong Yang <realwakka@gmail.com>
---
v2:
- forward to $seqres.full rather than -q
- use $tmp for stream file
---
tests/btrfs/339 | 40 ++++++++++++++++++++++++++++++++++++++++
tests/btrfs/339.out | 2 ++
2 files changed, 42 insertions(+)
create mode 100755 tests/btrfs/339
create mode 100644 tests/btrfs/339.out
diff --git a/tests/btrfs/339 b/tests/btrfs/339
new file mode 100755
index 00000000..0df24577
--- /dev/null
+++ b/tests/btrfs/339
@@ -0,0 +1,40 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2025 Sidong Yang. All Rights Reserved.
+#
+# FS QA Test 339
+#
+# Test btrfs receive dump stream from different user
+#
+. ./common/preamble
+_begin_fstest auto quick send snapshot
+
+# Override the default cleanup function.
+_cleanup()
+{
+ cd /
+ rm -r -f $tmp.*
+}
+
+. ./common/filter
+. ./common/quota
+
+_require_scratch
+_require_user
+
+_fixed_by_git_commit btrfs-progs cd933616d485 \
+ "btrfs-progs: receive: don't use O_NOATIME to open stream for dumping"
+
+_scratch_mkfs >> $seqres.full 2>&1 || _fail "mkfs failed"
+_scratch_mount
+
+stream=$tmp.fsv.ss
+
+$BTRFS_UTIL_PROG subvolume snapshot -r $SCRATCH_MNT $SCRATCH_MNT/snap >> $seqres.full
+$BTRFS_UTIL_PROG send -f $stream $SCRATCH_MNT/snap >> $seqres.full 2>&1 || _fail "send failed"
+chmod a+r $stream
+_su $qa_user -c "$BTRFS_UTIL_PROG receive --dump -f $stream" >> $seqres.full
+
+# success, all done
+echo "Silence is golden"
+_exit 0
diff --git a/tests/btrfs/339.out b/tests/btrfs/339.out
new file mode 100644
index 00000000..293ea808
--- /dev/null
+++ b/tests/btrfs/339.out
@@ -0,0 +1,2 @@
+QA output created by 339
+Silence is golden
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH v2 1/1] btrfs/339: test receive dump stream for different user 2025-11-19 5:28 [PATCH v2 1/1] btrfs/339: test receive dump stream for different user Sidong Yang @ 2025-12-02 14:57 ` Filipe Manana 2025-12-03 11:38 ` Sidong Yang 0 siblings, 1 reply; 3+ messages in thread From: Filipe Manana @ 2025-12-02 14:57 UTC (permalink / raw) To: Sidong Yang; +Cc: fstests, linux-btrfs On Wed, Nov 19, 2025 at 5:30 AM Sidong Yang <realwakka@gmail.com> wrote: > > Test receive to dump stream file from different user. > > This is a regression test for the btrfs-progs commit cd933616d485 > ("btrfs-progs: receive: don't use O_NOATIME to open stream for > dumping"). > > Signed-off-by: Sidong Yang <realwakka@gmail.com> > --- > v2: > - forward to $seqres.full rather than -q > - use $tmp for stream file > --- > tests/btrfs/339 | 40 ++++++++++++++++++++++++++++++++++++++++ > tests/btrfs/339.out | 2 ++ > 2 files changed, 42 insertions(+) > create mode 100755 tests/btrfs/339 > create mode 100644 tests/btrfs/339.out > > diff --git a/tests/btrfs/339 b/tests/btrfs/339 > new file mode 100755 > index 00000000..0df24577 > --- /dev/null > +++ b/tests/btrfs/339 > @@ -0,0 +1,40 @@ > +#! /bin/bash > +# SPDX-License-Identifier: GPL-2.0 > +# Copyright (c) 2025 Sidong Yang. All Rights Reserved. > +# > +# FS QA Test 339 > +# > +# Test btrfs receive dump stream from different user > +# > +. ./common/preamble > +_begin_fstest auto quick send snapshot > + > +# Override the default cleanup function. > +_cleanup() > +{ > + cd / > + rm -r -f $tmp.* > +} This does the same as the default _cleanup function, so there's no need to have it, just remove it. > + > +. ./common/filter > +. ./common/quota Why include the quota file? It's not needed, the test doesn't use anything from it, just remove it. > + > +_require_scratch > +_require_user > + > +_fixed_by_git_commit btrfs-progs cd933616d485 \ > + "btrfs-progs: receive: don't use O_NOATIME to open stream for dumping" > + > +_scratch_mkfs >> $seqres.full 2>&1 || _fail "mkfs failed" > +_scratch_mount > + > +stream=$tmp.fsv.ss > + > +$BTRFS_UTIL_PROG subvolume snapshot -r $SCRATCH_MNT $SCRATCH_MNT/snap >> $seqres.full Nowadays we use _btrfs, it's shorter and does the same (including the stdout redirection): _btrfs subvolume snapshot -r $SCRATCH_MNT $SCRATCH_MNT/snap > +$BTRFS_UTIL_PROG send -f $stream $SCRATCH_MNT/snap >> $seqres.full 2>&1 || _fail "send failed" And here: _btrfs send -f $stream $SCRATCH_MNT/snap There's no need to: || _fail "send failed" That is generally discouraged in fstests. A failure will just cause a mismatch with the golden output and make the test fail. But _btrfs already calls _fail and redirects to the .full file anyway. Otherwise it looks good, thanks. > +chmod a+r $stream > +_su $qa_user -c "$BTRFS_UTIL_PROG receive --dump -f $stream" >> $seqres.full > + > +# success, all done > +echo "Silence is golden" > +_exit 0 > diff --git a/tests/btrfs/339.out b/tests/btrfs/339.out > new file mode 100644 > index 00000000..293ea808 > --- /dev/null > +++ b/tests/btrfs/339.out > @@ -0,0 +1,2 @@ > +QA output created by 339 > +Silence is golden > -- > 2.43.0 > > ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2 1/1] btrfs/339: test receive dump stream for different user 2025-12-02 14:57 ` Filipe Manana @ 2025-12-03 11:38 ` Sidong Yang 0 siblings, 0 replies; 3+ messages in thread From: Sidong Yang @ 2025-12-03 11:38 UTC (permalink / raw) To: Filipe Manana; +Cc: fstests, linux-btrfs On Tue, Dec 02, 2025 at 02:57:19PM +0000, Filipe Manana wrote: > On Wed, Nov 19, 2025 at 5:30 AM Sidong Yang <realwakka@gmail.com> wrote: > > > > Test receive to dump stream file from different user. > > > > This is a regression test for the btrfs-progs commit cd933616d485 > > ("btrfs-progs: receive: don't use O_NOATIME to open stream for > > dumping"). > > > > Signed-off-by: Sidong Yang <realwakka@gmail.com> > > --- > > v2: > > - forward to $seqres.full rather than -q > > - use $tmp for stream file > > --- > > tests/btrfs/339 | 40 ++++++++++++++++++++++++++++++++++++++++ > > tests/btrfs/339.out | 2 ++ > > 2 files changed, 42 insertions(+) > > create mode 100755 tests/btrfs/339 > > create mode 100644 tests/btrfs/339.out > > > > diff --git a/tests/btrfs/339 b/tests/btrfs/339 > > new file mode 100755 > > index 00000000..0df24577 > > --- /dev/null > > +++ b/tests/btrfs/339 > > @@ -0,0 +1,40 @@ > > +#! /bin/bash > > +# SPDX-License-Identifier: GPL-2.0 > > +# Copyright (c) 2025 Sidong Yang. All Rights Reserved. > > +# > > +# FS QA Test 339 > > +# > > +# Test btrfs receive dump stream from different user > > +# > > +. ./common/preamble > > +_begin_fstest auto quick send snapshot > > + > > +# Override the default cleanup function. > > +_cleanup() > > +{ > > + cd / > > + rm -r -f $tmp.* > > +} > > This does the same as the default _cleanup function, so there's no > need to have it, just remove it. I see, Thanks > > > + > > +. ./common/filter > > +. ./common/quota > > Why include the quota file? It's not needed, the test doesn't use > anything from it, just remove it. I don't need it. Removed. > > > + > > +_require_scratch > > +_require_user > > + > > +_fixed_by_git_commit btrfs-progs cd933616d485 \ > > + "btrfs-progs: receive: don't use O_NOATIME to open stream for dumping" > > + > > +_scratch_mkfs >> $seqres.full 2>&1 || _fail "mkfs failed" > > +_scratch_mount > > + > > +stream=$tmp.fsv.ss > > + > > +$BTRFS_UTIL_PROG subvolume snapshot -r $SCRATCH_MNT $SCRATCH_MNT/snap >> $seqres.full > > Nowadays we use _btrfs, it's shorter and does the same (including the > stdout redirection): > > _btrfs subvolume snapshot -r $SCRATCH_MNT $SCRATCH_MNT/snap > > > +$BTRFS_UTIL_PROG send -f $stream $SCRATCH_MNT/snap >> $seqres.full 2>&1 || _fail "send failed" > > And here: > > _btrfs send -f $stream $SCRATCH_MNT/snap > > There's no need to: || _fail "send failed" > That is generally discouraged in fstests. A failure will just cause a > mismatch with the golden output and make the test fail. > > But _btrfs already calls _fail and redirects to the .full file anyway. > > Otherwise it looks good, thanks. Thanks, I'll send a new version right away. Thanks, Sidong > > > > > +chmod a+r $stream > > +_su $qa_user -c "$BTRFS_UTIL_PROG receive --dump -f $stream" >> $seqres.full > > + > > +# success, all done > > +echo "Silence is golden" > > +_exit 0 > > diff --git a/tests/btrfs/339.out b/tests/btrfs/339.out > > new file mode 100644 > > index 00000000..293ea808 > > --- /dev/null > > +++ b/tests/btrfs/339.out > > @@ -0,0 +1,2 @@ > > +QA output created by 339 > > +Silence is golden > > -- > > 2.43.0 > > > > ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-12-03 11:38 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2025-11-19 5:28 [PATCH v2 1/1] btrfs/339: test receive dump stream for different user Sidong Yang 2025-12-02 14:57 ` Filipe Manana 2025-12-03 11:38 ` Sidong Yang
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox