Re: [PATCH v4 10/10] selftests/harness: Fix TEST_F()'s exit codes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
> 





[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux