[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZjQXghB6imRFU4HX@google.com>
Date: Thu, 2 May 2024 15:45:22 -0700
From: Sean Christopherson <seanjc@...gle.com>
To: "Mickaël Salaün" <mic@...ikod.net>
Cc: Christian Brauner <brauner@...nel.org>, Jakub Kicinski <kuba@...nel.org>,
Kees Cook <keescook@...omium.org>, Mark Brown <broonie@...nel.org>,
Shengyu Li <shengyu.li.evgeny@...il.com>, Shuah Khan <shuah@...nel.org>,
"David S . Miller" <davem@...emloft.net>, "Günther Noack" <gnoack@...gle.com>, Will Drewry <wad@...omium.org>,
kernel test robot <oliver.sang@...el.com>, kvm@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-kselftest@...r.kernel.org
Subject: Re: [PATCH v4 10/10] selftests/harness: Fix TEST_F()'s exit codes
On Thu, May 02, 2024, Mickaël Salaün wrote:
> @@ -462,8 +462,10 @@ static inline pid_t clone3_vfork(void)
> munmap(teardown, sizeof(*teardown)); \
> if (self && fixture_name##_teardown_parent) \
> munmap(self, sizeof(*self)); \
> - if (!WIFEXITED(status) && WIFSIGNALED(status)) \
> - /* Forward signal to __wait_for_test(). */ \
> + /* Forward exit codes and signals to __wait_for_test(). */ \
> + if (WIFEXITED(status)) \
> + _exit(_metadata->exit_code); \
This needs to be:
if (WIFEXITED(status)) \
_exit(WEXITSTATUS(status)); \
otherwise existing tests that communicate FAIL/SKIP via exit() continue to yield
exit(0) and thus false passes.
If that conflicts with tests that want to communicate via _metadata->exit_code,
then maybe this?
if (WIFEXITED(status)) \
_exit(WEXITSTATUS(status) ?: _metadata->exit_code); \
Or I suppose _metadata->exit_code could have priority, but that seems weird to
me, e.g. if a test sets exit_code and then explodes, it seems like the explosion
should be reported.
> + if (WIFSIGNALED(status)) \
> kill(getpid(), WTERMSIG(status)); \
> __test_check_assert(_metadata); \
> } \
> --
> 2.45.0
>
Powered by blists - more mailing lists