[LTP] [PATCH v1] Rewrite waitid01.c test using new LTP API

Cyril Hrubis chrubis@suse.cz
Tue Feb 22 15:49:12 CET 2022


Hi!
> +	TST_EXP_PASS(waitid(P_ALL, getpid(), infop, WEXITED));
> +	TST_EXP_EQ_LI(infop->si_pid, pidchild);
> +	TST_EXP_EQ_LI(infop->si_status, 123);
> +	TST_EXP_EQ_LI(infop->si_signo, SIGCHLD);
> +	TST_EXP_EQ_LI(infop->si_code, CLD_EXITED);
>  }

Looks good, but we should add the two different cases as well.

The one that kills the child with SIGHUP should have si_code set to
CLD_KILLED and and the si_status should be SIGHUP. And the 'division by
zero' case is supposed to have it set to CLD_DUMPED. I think that we
should add these two tests as well.

Also looking at man pages the idtype can be set to P_PIDFD since 5.4 as
well, so we should add a waitid test with a pidfd too.

> +static struct tst_test test = {
> +	.test_all = run,
> +	.forks_child = 1,
> +	.bufs =
> +		(struct tst_buffers[]){
> +			{ &infop, .size = sizeof(*infop) },
> +			{},
> +		},
> +};
> -- 
> 2.35.1
> 
> 
> -- 
> Mailing list info: https://lists.linux.it/listinfo/ltp

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list