[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20240503.Ioj0ahCi7aeN@digikod.net>
Date: Fri, 3 May 2024 09:51:05 +0200
From: Mickaël Salaün <mic@...ikod.net>
To: Sean Christopherson <seanjc@...gle.com>
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 at 03:45:22PM GMT, Sean Christopherson wrote:
> 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.
Yes of course.
>
> 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); \
I prefer this approach handling failed expectations in the fixture
teardown too.
However, the direct call to _exit() doesn't handle failed asserts. I'll
fix that.
>
> 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