All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: bernd@bsbernd.com
Cc: fuse-devel@lists.linux.dev
Subject: Re: [PATCH 10/10] test: run mkfs.ext4 through the service examples
Date: Fri, 25 Sep 2026 15:27:50 -0700	[thread overview]
Message-ID: <20260925222750.GX6253@frogsfrogsfrogs> (raw)
In-Reply-To: <20260925-mount-service-bound-open-v1-10-bbf1a84c7995@bsbernd.com>

On Fri, Sep 25, 2026 at 12:23:38AM +0200, Bernd Schubert via B4 Relay wrote:
> From: Bernd Schubert <bernd@bsbernd.com>
> 
> The byte comparison in the service example tests does not show that a
> real filesystem tool works on the file service_ll and service_hl serve.
> mkfs.ext4 writes a filesystem through the mount, and e2fsck checks the
> image after umount.

Ooh, a file IO path test too!

> Assisted-by: LLM
> Signed-off-by: Bernd Schubert <bernd@bsbernd.com>
> ---
>  example/service_ll.c                |  5 ++++
>  test/cases/lib/service-example.sh   | 54 ++++++++++++++++++++++++++++++-------
>  test/cases/mount/service-hl-mkfs.sh |  8 ++++++
>  test/cases/mount/service-ll-mkfs.sh |  8 ++++++
>  4 files changed, 66 insertions(+), 9 deletions(-)
> 
> diff --git a/example/service_ll.c b/example/service_ll.c
> index fd43c40fc15b..7baf47905a33 100644
> --- a/example/service_ll.c
> +++ b/example/service_ll.c
> @@ -43,6 +43,11 @@
>   *
>   *     mount -t fuse.service_ll /dev/sda /mnt
>   *
> + * /mnt/single_file then holds the bytes of /dev/sda, so a filesystem can be
> + * created on it:
> + *
> + *     mkfs.ext4 /mnt/single_file
> + *
>   * ## Source code ##
>   * \include service_ll.c
>   * \include service_ll.socket
> diff --git a/test/cases/lib/service-example.sh b/test/cases/lib/service-example.sh
> index 878b379b8b16..4d7e0b27f3b9 100644
> --- a/test/cases/lib/service-example.sh
> +++ b/test/cases/lib/service-example.sh
> @@ -1,15 +1,19 @@
>  # lib/service-example.sh - body for the service_ll / service_hl cases.
>  #
> -# Caller sets FS_NAME and LAUNCH before sourcing:
> +# Caller sets FS_NAME and LAUNCH, and optionally CHECK, before sourcing:
>  #   FS_NAME   service_ll | service_hl
>  #   LAUNCH    fuservicemount3 | mount_fuse
> +#   CHECK     bytes (default) | mkfs
>  #
> -# The file the example serves has to read back as the image, and what is
> -# written through the mount has to reach the image.
> +# bytes: the file the example serves has to read back as the image, and what
> +# is written through the mount has to reach the image.
> +# mkfs: mkfs.ext4 on that file has to leave an image e2fsck accepts.
>  
>  _fuse_no_mount_needed=1
>  . "$TEST_LIB/common.sh"
>  
> +CHECK=${CHECK:-bytes}
> +
>  # Before the gates: a misspelled FS_NAME would otherwise skip as "not built"
>  case ${FS_NAME:-} in
>  service_ll | service_hl) ;;
> @@ -19,6 +23,10 @@ case ${LAUNCH:-} in
>  fuservicemount3 | mount_fuse) ;;
>  *) _fail "unknown LAUNCH '${LAUNCH:-}'" ;;
>  esac
> +case $CHECK in
> +bytes | mkfs) ;;
> +*) _fail "unknown CHECK '$CHECK'" ;;
> +esac
>  
>  _require_linux "fuservicemount3"
>  _require_root
> @@ -26,6 +34,10 @@ _require_fuse_device
>  _require_binary util/fuservicemount3
>  _require_binary "example/$FS_NAME"
>  [ "$LAUNCH" != mount_fuse ] || _require_binary util/mount.fuse3
> +if [ "$CHECK" = mkfs ]; then
> +	_require_prog mkfs.ext4
> +	_require_prog e2fsck
> +fi
>  
>  . "$TEST_LIB/service.sh"
>  
> @@ -35,9 +47,16 @@ old=$TEST_TMP/old
>  new=$TEST_TMP/new
>  
>  # The size has to be a multiple of the page size
> -head -c 1048576 /dev/urandom >"$old"
> -head -c 1048576 /dev/urandom >"$new"
> -cp "$old" "$img"
> +case $CHECK in
> +bytes)
> +	head -c 1048576 /dev/urandom >"$old"
> +	head -c 1048576 /dev/urandom >"$new"
> +	cp "$old" "$img"
> +	;;
> +mkfs)
> +	truncate -s 64M "$img"
> +	;;
> +esac
>  
>  service_start "$TEST_LOGDIR/fs-$FS_NAME.out" "$FUSE_EXAMPLE_DIR/$FS_NAME"
>  case $LAUNCH in
> @@ -53,10 +72,27 @@ mount_fuse)
>  esac
>  
>  _assert_fstype "$TEST_MNT" "fuse.$service_subtype" fuse
> -_assert_file_eq "$TEST_MNT/single_file" "$old"
> -dd if="$new" of="$TEST_MNT/single_file" bs=64k conv=notrunc,fsync status=none
> +case $CHECK in
> +bytes)
> +	_assert_file_eq "$TEST_MNT/single_file" "$old"
> +	dd if="$new" of="$TEST_MNT/single_file" bs=64k conv=notrunc,fsync \
> +		status=none
> +	;;
> +mkfs)
> +	# -F: single_file is a regular file, not a block device
> +	mkfs.ext4 -F -q "$TEST_MNT/single_file" ||
> +		_fail "mkfs.ext4 through $FS_NAME failed"

You might consider adding a -D <path> argument to mkfs.ext4 so that it
will copy a directory tree into the filesystem image.  That way you're
testing block overwrites.

That said, if you're satisified with writing just the superblock and
log, that's fine with me too.

Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>

--D

> +	;;
> +esac
>  
>  umount "$TEST_MNT"
>  service_wait_exit
>  _assert_eq "$service_rc" 0 "$FS_NAME exit status"
> -_assert_file_eq "$img" "$new"
> +case $CHECK in
> +bytes)
> +	_assert_file_eq "$img" "$new"
> +	;;
> +mkfs)
> +	e2fsck -fn "$img" || _fail "e2fsck found errors in $img"
> +	;;
> +esac
> diff --git a/test/cases/mount/service-hl-mkfs.sh b/test/cases/mount/service-hl-mkfs.sh
> new file mode 100755
> index 000000000000..af552818cd90
> --- /dev/null
> +++ b/test/cases/mount/service-hl-mkfs.sh
> @@ -0,0 +1,8 @@
> +#!/usr/bin/env bash
> +# GROUP: mount
> +
> +FS_NAME=service_hl
> +LAUNCH=fuservicemount3
> +CHECK=mkfs
> +
> +. "$TEST_LIB/service-example.sh"
> diff --git a/test/cases/mount/service-ll-mkfs.sh b/test/cases/mount/service-ll-mkfs.sh
> new file mode 100755
> index 000000000000..9908937010de
> --- /dev/null
> +++ b/test/cases/mount/service-ll-mkfs.sh
> @@ -0,0 +1,8 @@
> +#!/usr/bin/env bash
> +# GROUP: mount
> +
> +FS_NAME=service_ll
> +LAUNCH=fuservicemount3
> +CHECK=mkfs
> +
> +. "$TEST_LIB/service-example.sh"
> 
> -- 
> 2.53.0
> 
> 
> 

  reply	other threads:[~2026-09-25 22:27 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-24 22:23 [PATCH 00/10] libfuse: Add mount service safety checks and tests Bernd Schubert via B4 Relay
2026-09-24 22:23 ` Bernd Schubert
2026-09-24 22:23 ` [PATCH 01/10] mount_service: move the command line check into arg_in_cmdline() Bernd Schubert via B4 Relay
2026-09-24 22:23   ` Bernd Schubert
2026-09-25 21:40   ` Darrick J. Wong
2026-09-24 22:23 ` [PATCH 02/10] mount_service: open only paths named on the command line Bernd Schubert via B4 Relay
2026-09-24 22:23   ` Bernd Schubert
2026-09-25 22:05   ` Darrick J. Wong
2026-09-28  9:19     ` Bernd Schubert
2026-09-24 22:23 ` [PATCH 03/10] mount_service: refuse OPEN after the MNTPT request Bernd Schubert via B4 Relay
2026-09-24 22:23   ` Bernd Schubert
2026-09-25 22:07   ` Darrick J. Wong
2026-09-28  9:21     ` Bernd Schubert
2026-09-24 22:23 ` [PATCH 04/10] util: give fuservicemount3 an absolute build-tree runpath Bernd Schubert via B4 Relay
2026-09-24 22:23   ` Bernd Schubert
2026-09-25 22:09   ` Darrick J. Wong
2026-09-24 22:23 ` [PATCH 05/10] mount.fuse: free the options on the service mount return path Bernd Schubert via B4 Relay
2026-09-24 22:23   ` Bernd Schubert
2026-09-25 22:10   ` Darrick J. Wong
2026-09-24 22:23 ` [PATCH 06/10] example/single_file: take no sector size from a regular backing file Bernd Schubert via B4 Relay
2026-09-24 22:23   ` Bernd Schubert
2026-09-25 22:13   ` Darrick J. Wong
2026-09-24 22:23 ` [PATCH 07/10] test: check which files fuservicemount3 opens for the server Bernd Schubert via B4 Relay
2026-09-24 22:23   ` Bernd Schubert
2026-09-24 22:23 ` [PATCH 08/10] test: check what fuservicemount3 refuses Bernd Schubert via B4 Relay
2026-09-24 22:23   ` Bernd Schubert
2026-09-24 22:23 ` [PATCH 09/10] test: mount the service examples through fuservicemount3 Bernd Schubert via B4 Relay
2026-09-24 22:23   ` Bernd Schubert
2026-09-25 22:25   ` Darrick J. Wong
2026-09-28  9:27     ` Bernd Schubert
2026-09-24 22:23 ` [PATCH 10/10] test: run mkfs.ext4 through the service examples Bernd Schubert via B4 Relay
2026-09-24 22:23   ` Bernd Schubert
2026-09-25 22:27   ` Darrick J. Wong [this message]
2026-09-28  9:30     ` Bernd Schubert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260925222750.GX6253@frogsfrogsfrogs \
    --to=djwong@kernel.org \
    --cc=bernd@bsbernd.com \
    --cc=fuse-devel@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.