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
> 

Reply via email to