[LTP] [PATCH v2] waitid10: raise SIGFPE directly
Li Wang
liwang@redhat.com
Fri May 13 04:02:54 CEST 2022
On Thu, May 12, 2022 at 9:08 PM Cyril Hrubis <chrubis@suse.cz> wrote:
> The SIGFPE for division by zero is actually not send for quite a few
> architectures (ARM for instance) and even on x86 and x86_64 we need to
> work around compiler to make it generate code that actually triggers the
> condition.
>
> So this patch fixes the test in the simplest way possible. the child
> just directly raises SIGFPE instead.
>
> Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
> ---
> testcases/kernel/syscalls/waitid/waitid10.c | 8 ++------
> 1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/testcases/kernel/syscalls/waitid/waitid10.c
> b/testcases/kernel/syscalls/waitid/waitid10.c
> index e75edd07e..388b31cc9 100644
> --- a/testcases/kernel/syscalls/waitid/waitid10.c
> +++ b/testcases/kernel/syscalls/waitid/waitid10.c
> @@ -24,12 +24,8 @@ static void run(void)
> pid_t pidchild;
>
> pidchild = SAFE_FORK();
> - if (!pidchild) {
> - volatile int a, zero = 0;
> -
> - a = 1 / zero;
> - exit(a);
> - }
> + if (!pidchild)
> + raise(SIGFPE);
>
Better to have code comments to explain the reason here,
just for better readability.
And vote for merging before the new release as well.
Reviewed-by: Li Wang <liwang@redhat.com>
>
> TST_EXP_PASS(waitid(P_ALL, 0, infop, WEXITED));
> TST_EXP_EQ_LI(infop->si_pid, pidchild);
> --
> 2.35.1
>
>
> --
> Mailing list info: https://lists.linux.it/listinfo/ltp
>
>
--
Regards,
Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20220513/b9283ec5/attachment.htm>
More information about the ltp
mailing list