Linux Kernel Selftest development
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: "Thomas Weißschuh" <thomas.weissschuh@linutronix.de>
Cc: "Shuah Khan" <shuah@kernel.org>,
	"Shuah Khan" <skhan@linuxfoundation.org>,
	"Willy Tarreau" <w@1wt.eu>,
	"Thomas Weißschuh" <linux@weissschuh.net>,
	"Kees Cook" <kees@kernel.org>,
	"Andy Lutomirski" <luto@amacapital.net>,
	"Will Drewry" <wad@chromium.org>,
	linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
	Aishwarya.TCV@arm.com
Subject: Re: [PATCH v3 12/32] selftests: harness: Stop using setjmp()/longjmp()
Date: Mon, 5 May 2025 19:50:31 +0900	[thread overview]
Message-ID: <aBiX9zbR7ehAxQjS@finisterre.sirena.org.uk> (raw)
In-Reply-To: <20250411-nolibc-kselftest-harness-v3-12-4d9c0295893f@linutronix.de>

[-- Attachment #1: Type: text/plain, Size: 1997 bytes --]

On Fri, Apr 11, 2025 at 11:00:36AM +0200, Thomas Weißschuh wrote:
> Usage of longjmp() was added to ensure that teardown is always run in
> commit 63e6b2a42342 ("selftests/harness: Run TEARDOWN for ASSERT failures")
> However instead of calling longjmp() to the teardown handler it is easier to
> just call the teardown handler directly from __bail().
> Any potential duplicate teardown invocations are harmless as the actual
> handler will only ever be executed once since
> commit fff37bd32c76 ("selftests/harness: Fix fixture teardown").

I didn't fully verify (I'm on holiday right now) but it looks like this,
which is in -next as 8a37733a874f:

> @@ -757,7 +749,7 @@
>   */
>  #define OPTIONAL_HANDLER(_assert) \
>  	for (; _metadata->trigger; _metadata->trigger = \
> -			__bail(_assert, _metadata))
> +			__bail(_assert, _metadata, self, variant))
>  
>  #define is_signed_type(var)       (!!(((__typeof__(var))(-1)) < (__typeof__(var))1))
>  

breaks the build of several selftests when building for arm64:

In file included from seccomp_bpf.c:56:
seccomp_bpf.c: In function ‘kill_thread_or_group’:
../kselftest_harness.h:755:52: error: ‘self’ undeclared (first use in this function)
  755 |                         __bail(_assert, _metadata, self, variant))
      |                                                    ^~~~
../kselftest_harness.h:803:14: note: in expansion of macro ‘OPTIONAL_HANDLER’
  803 | } while (0); OPTIONAL_HANDLER(_assert)
      |              ^~~~~~~~~~~~~~~~
../kselftest_harness.h:516:9: note: in expansion of macro ‘__EXPECT’
  516 |         __EXPECT(expected, #expected, seen, #seen, ==, 1)
      |         ^~~~~~~~
seccomp_bpf.c:844:9: note: in expansion of macro ‘ASSERT_EQ’
  844 |         ASSERT_EQ(0, prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0)) {
      |         ^~~~~~~~~

Full build log at:

    https://builds.sirena.org.uk/407f60a151df3c44397e5afc0111eb9b026c38d3/arm64/defconfig/build.log

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2025-05-05 10:50 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-11  9:00 [PATCH v3 00/32] kselftest harness and nolibc compatibility Thomas Weißschuh
2025-04-11  9:00 ` [PATCH v3 01/32] selftests: harness: Add kselftest harness selftest Thomas Weißschuh
2025-04-18 16:56   ` Muhammad Usama Anjum
2025-04-11  9:00 ` [PATCH v3 02/32] selftests: harness: Use C89 comment style Thomas Weißschuh
2025-04-11  9:00 ` [PATCH v3 03/32] selftests: harness: Ignore unused variant argument warning Thomas Weißschuh
2025-04-18 16:57   ` Muhammad Usama Anjum
2025-04-11  9:00 ` [PATCH v3 04/32] selftests: harness: Mark functions without prototypes static Thomas Weißschuh
2025-04-18 16:59   ` Muhammad Usama Anjum
2025-04-11  9:00 ` [PATCH v3 05/32] selftests: harness: Remove inline qualifier for wrappers Thomas Weißschuh
2025-04-18 17:00   ` Muhammad Usama Anjum
2025-04-11  9:00 ` [PATCH v3 06/32] selftests: harness: Remove dependency on libatomic Thomas Weißschuh
2025-04-18 17:16   ` Muhammad Usama Anjum
2025-04-11  9:00 ` [PATCH v3 07/32] selftests: harness: Implement test timeouts through pidfd Thomas Weißschuh
2025-04-11  9:00 ` [PATCH v3 08/32] selftests: harness: Don't set setup_completed for fixtureless tests Thomas Weißschuh
2025-04-11  9:00 ` [PATCH v3 09/32] selftests: harness: Always provide "self" and "variant" Thomas Weißschuh
2025-04-11  9:00 ` [PATCH v3 10/32] selftests: harness: Move teardown conditional into test metadata Thomas Weißschuh
2025-04-11  9:00 ` [PATCH v3 11/32] selftests: harness: Add teardown callback to " Thomas Weißschuh
2025-04-11  9:00 ` [PATCH v3 12/32] selftests: harness: Stop using setjmp()/longjmp() Thomas Weißschuh
2025-05-05 10:50   ` Mark Brown [this message]
2025-05-05 14:07     ` Thomas Weißschuh
2025-04-11  9:00 ` [PATCH v3 13/32] selftests: harness: Guard includes on nolibc Thomas Weißschuh
2025-04-11  9:00 ` [PATCH v3 14/32] tools/nolibc: handle intmax_t/uintmax_t in printf Thomas Weißschuh
2025-04-11  9:00 ` [PATCH v3 15/32] tools/nolibc: use intmax definitions from compiler Thomas Weißschuh
2025-04-11  9:00 ` [PATCH v3 16/32] tools/nolibc: use pselect6_time64 if available Thomas Weißschuh
2025-04-11  9:00 ` [PATCH v3 17/32] tools/nolibc: use ppoll_time64 " Thomas Weißschuh
2025-04-11  9:00 ` [PATCH v3 18/32] tools/nolibc: add tolower() and toupper() Thomas Weißschuh
2025-04-11  9:00 ` [PATCH v3 19/32] tools/nolibc: add _exit() Thomas Weißschuh
2025-04-11  9:00 ` [PATCH v3 20/32] tools/nolibc: add setpgrp() Thomas Weißschuh
2025-04-11  9:00 ` [PATCH v3 21/32] tools/nolibc: implement waitpid() in terms of waitid() Thomas Weißschuh
2025-04-11  9:00 ` [PATCH v3 22/32] Revert "selftests/nolibc: use waitid() over waitpid()" Thomas Weißschuh
2025-04-11  9:00 ` [PATCH v3 23/32] tools/nolibc: add dprintf() and vdprintf() Thomas Weißschuh
2025-04-11  9:00 ` [PATCH v3 24/32] tools/nolibc: add getopt() Thomas Weißschuh
2025-04-11  9:00 ` [PATCH v3 25/32] tools/nolibc: allow different write callbacks in printf Thomas Weißschuh
2025-04-11  9:00 ` [PATCH v3 26/32] tools/nolibc: allow limiting of printf destination size Thomas Weißschuh
2025-04-11  9:00 ` [PATCH v3 27/32] tools/nolibc: add snprintf() and friends Thomas Weißschuh
2025-04-11  9:00 ` [PATCH v3 28/32] selftests/nolibc: use snprintf() for printf tests Thomas Weißschuh
2025-04-11  9:00 ` [PATCH v3 29/32] selftests/nolibc: rename vfprintf test suite Thomas Weißschuh
2025-04-11  9:00 ` [PATCH v3 30/32] selftests/nolibc: add test for snprintf() truncation Thomas Weißschuh
2025-04-11  9:00 ` [PATCH v3 31/32] tools/nolibc: implement width padding in printf() Thomas Weißschuh
2025-04-11  9:00 ` [PATCH v3 32/32] HACK: selftests/nolibc: demonstrate usage of the kselftest harness Thomas Weißschuh
2025-04-22  8:48 ` [PATCH v3 00/32] kselftest harness and nolibc compatibility Thomas Weißschuh
2025-04-22  8:51   ` Willy Tarreau
2025-04-24 20:06     ` Shuah Khan
2025-04-29 18:52       ` Shuah Khan
2025-04-29 19:25         ` Thomas Weißschuh
2025-04-30 18:53       ` Kees Cook

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=aBiX9zbR7ehAxQjS@finisterre.sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=Aishwarya.TCV@arm.com \
    --cc=kees@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux@weissschuh.net \
    --cc=luto@amacapital.net \
    --cc=shuah@kernel.org \
    --cc=skhan@linuxfoundation.org \
    --cc=thomas.weissschuh@linutronix.de \
    --cc=w@1wt.eu \
    --cc=wad@chromium.org \
    /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