[LTP] [PATCH v2 07/33] keyctl15: Test KEYCTL_GET_SECURITY label retrieval

Petr Vorel pvorel@suse.cz
Fri Sep 11 21:24:18 CEST 2026


> Hi!
> > > TST_EXP_POSITIVE()?

> > Well, it would not help much because Andrea wanted to use tst_brk().
> > I've been thinking for a while to add TST_EXP_*_BRK() variants.

> > Therefore it would need to check the result anyway:

> > TST_EXP_POSITIVE(keyctl(KEYCTL_GET_SECURITY, key, (unsigned long)buf, sizeof(buf), 0));
> > if (TST_PASS)
> > 	tst_brk(TBROK | TTERRNO, "KEYCTL_GET_SECURITY failed");

> > (And I ignore that we don't have TST_EXP_POSITIVE_SILENT() and probably we don't
> > want to call TST_EXP_POSITIVE_() to make it quiet on TPASS).

> Why can't we just do:

> 	TST_EXP_POSITIVE(keyctl(KEYCTL_GET_SECURITY, key, (unsigned long)buf, sizeof(buf), 0));
> 	if (!TST_PASS)
> 		return;

Right, return would work here as well. And generally it would work unless code
is more structured (i.e. test macro is not directly in .test_all/.test function.
That should eliminate many of TST_*_BRK() potential use.

Kind regards,
Petr


More information about the ltp mailing list