FILESYSTEM IN USERSPACE (FUSE) development
 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 01/10] test: register pytest run as a meson test
Date: Fri, 8 May 2026 16:53:02 -0700	[thread overview]
Message-ID: <20260508235302.GG2241589@frogsfrogsfrogs> (raw)
In-Reply-To: <20260508-new-mount-fixes-and-tests-v1-1-c67a0893ddbc@bsbernd.com>

On Fri, May 08, 2026 at 06:39:04PM +0200, Bernd Schubert via B4 Relay wrote:
> From: Bernd Schubert <bernd@bsbernd.com>
> 
> Wire the pytest suite into meson as a single test() so it can be run
> via 'meson test -C build' (or 'meson test -C build pytest -v') instead
> of having to invoke pytest directly. The same definition works for
> both unprivileged and root runs -- invoke 'meson test' as your user,
> or 'sudo -E meson test' to exercise the tests that need root (these
> detect the uid at runtime via os.geteuid()).

Hey, that would be a nice simplification!

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

--D


> Assisted by Claude/Opus 4.7
> Signed-off-by: Bernd Schubert <bernd@bsbernd.com>
> ---
>  test/ci-build.sh |  9 ++++++---
>  test/meson.build | 23 +++++++++++++++++++----
>  2 files changed, 25 insertions(+), 7 deletions(-)
> 
> diff --git a/test/ci-build.sh b/test/ci-build.sh
> index 799f13b2..727cc8c9 100755
> --- a/test/ci-build.sh
> +++ b/test/ci-build.sh
> @@ -2,7 +2,7 @@
>  
>  set -e
>  
> -TEST_CMD="pytest -vv --tb=short --maxfail=1 --log-level=INFO --log-cli-level=INFO test/"
> +TEST_CMD="meson test -C . --print-errorlogs"
>  SAN="-Db_sanitize=address,undefined"
>  
>  # not default
> @@ -122,8 +122,11 @@ sanitized_build()
>      sudo chown root:root util/fusermount3
>      sudo chmod 4755 util/fusermount3
>  
> -    # Test as root and regular user
> -    sudo env PATH=$PATH ${TEST_CMD}
> +    # Test as root and regular user. Give the root run a distinct
> +    # meson log basename so its meson-logs/testlog.* files don't end
> +    # up owned by root and block the subsequent user run from writing
> +    # them.
> +    sudo env PATH=$PATH ${TEST_CMD} --logbase=testlog-root
>      # Cleanup temporary files (since they are now owned by root)
>      sudo rm -rf test/.pytest_cache/ test/__pycache__
>  
> diff --git a/test/meson.build b/test/meson.build
> index 84333f96..87668d61 100644
> --- a/test/meson.build
> +++ b/test/meson.build
> @@ -41,13 +41,28 @@ td += custom_target('test_scripts', input: test_scripts,
>                        command: ['cp', '-fPp',
>                                  '@INPUT@', meson.current_build_dir() ])
>  
> -# Provide something helpful when running 'ninja test'
> -
>  if meson.is_subproject()
>  	test('libfuse is a subproject, skipping tests', executable('wrong_command',
>                        'wrong_command.c', install: false,
>                         c_args: [ '-DMESON_IS_SUBPROJECT' ]))
>  else
> -	test('wrong_command', executable('wrong_command', 'wrong_command.c',
> -                      install: false))
> +	# Run the pytest suite via 'meson test'. The same definition works
> +	# both as a regular user and under sudo: invoke 'meson test -C build'
> +	# for the unprivileged subset, or 'sudo -E meson test -C build' to
> +	# also exercise the tests that require root (they pick the uid up at
> +	# runtime via os.geteuid()).
> +	pytest = find_program('pytest', required: false)
> +	if pytest.found()
> +		test('pytest', pytest,
> +		     args: ['-vv', '--tb=short', '--maxfail=1',
> +		            '--log-level=INFO', '--log-cli-level=INFO',
> +		            meson.current_build_dir()],
> +		     depends: td,
> +		     workdir: meson.project_build_root(),
> +		     timeout: 600,
> +		     is_parallel: false)
> +	else
> +		test('pytest not found', executable('wrong_command',
> +                              'wrong_command.c', install: false))
> +	endif
>  endif
> 
> -- 
> 2.53.0
> 
> 

  reply	other threads:[~2026-05-08 23:53 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-08 16:39 [PATCH 00/10] libfuse: new mount API and SYNC_INIT fixes and tests Bernd Schubert via B4 Relay
2026-05-08 16:39 ` [PATCH 01/10] test: register pytest run as a meson test Bernd Schubert via B4 Relay
2026-05-08 23:53   ` Darrick J. Wong [this message]
2026-05-08 16:39 ` [PATCH 02/10] Add tests to verify that mountinfo matches requested options Bernd Schubert via B4 Relay
2026-05-08 23:59   ` Darrick J. Wong
2026-05-08 16:39 ` [PATCH 03/10] test: assert ro/rw, nosuid/suid, nodev/dev round-trip via fsmount Bernd Schubert via B4 Relay
2026-05-09  0:04   ` Darrick J. Wong
2026-05-08 16:39 ` [PATCH 04/10] New mount API: read-only option is for fsmount() and fsconfig() Bernd Schubert via B4 Relay
2026-05-09  0:17   ` Darrick J. Wong
2026-05-08 16:39 ` [PATCH 05/10] libfuse: don't use SYNC_INIT unless asked for Bernd Schubert via B4 Relay
2026-05-08 16:39 ` [PATCH 06/10] example: silence add_languages warning by setting 'native: false' Bernd Schubert via B4 Relay
2026-05-09  0:23   ` Darrick J. Wong
2026-05-08 16:39 ` [PATCH 07/10] mount: clarify kernel_opts vs mnt_opts vs flags in fuse_kern_fsmount Bernd Schubert via B4 Relay
2026-05-09  0:27   ` Darrick J. Wong
2026-05-10 17:21     ` Bernd Schubert
2026-05-08 16:39 ` [PATCH 08/10] fuse_daemonize_early_start: Disallow daemonization when already active Bernd Schubert via B4 Relay
2026-05-09  0:30   ` Darrick J. Wong
2026-05-10 16:53     ` Bernd Schubert
2026-05-10 17:01       ` Bernd Schubert
2026-05-08 16:39 ` [PATCH 09/10] fuse mount: Do not set sync_init when sync_init was not used Bernd Schubert via B4 Relay
2026-05-09  0:35   ` Darrick J. Wong
2026-05-10 17:04     ` Bernd Schubert
2026-05-08 16:39 ` [PATCH 10/10] highlevel: Switch fuse_main_real_versioned() to fuse_daemonize_early() Bernd Schubert via B4 Relay
2026-05-09  0:38   ` Darrick J. Wong
2026-05-10 17:19     ` 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=20260508235302.GG2241589@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox