[LTP] [PATCH 4/4] libs: sigwait: Get rid of REPORT_SUCCESS() macro

Cyril Hrubis chrubis@suse.cz
Fri Jul 24 14:32:35 CEST 2020


Hi!
>  void test_empty_set(swi_func sigwaitinfo, int signo,
>  		    enum tst_ts_type type LTP_ATTRIBUTE_UNUSED)
>  {
> @@ -55,7 +22,15 @@ void test_empty_set(swi_func sigwaitinfo, int signo,
>  	child = create_sig_proc(signo, INT_MAX, 100000);
>  
>  	TEST(sigwaitinfo(&sigs, &si, NULL));
> -	REPORT_SUCCESS(-1, EINTR);
> +	if (TST_RET == -1) {
> +		if (TST_ERR == EINTR)
> +			tst_res(TPASS, "%s: Test passed", __func__);
> +		else
> +			tst_res(TFAIL | TTERRNO, "%s: Unexpected failure", __func__);

Can we please make the messages a bit more user friendly?

- the tst_res() already prints line and filename the __func__ is a bit
  redundant

- it also prints PASS/FAIL so we can omit the "Test passed" we can print
  something that describes the testcase instead e.g.
  "Wait interrupted by a signal"

- also in the "Unexpected failure" case we should print which error we
  expected with someting as: tst_res(TFAIL | TTERRNO, "Expected to return EINTER, got");

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list