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 > > >