[LTP] [PATCH v3 2/3] lib/tst_test.c: Update result counters when calling tst_brk()

Cyril Hrubis chrubis@suse.cz
Tue Jan 8 14:11:03 CET 2019


Hi!
> > So if we ever want to have a function to exit child process with a result we
> > should implement tst_ret() that would be equivalent to tst_res() followed by
> > exit(0).
> > 
> > It could be even implemented as:
> > 
> > #define tst_ret(ttype, fmt, ...) \
> > 	do { \
> > 		tst_res_(__FILE__, __LINE__, (ttype), (fmt), ##__VA_ARGS__); \
> > 		exit(0); \
> > 	} while (0)
> > 
> > This function has one big advantage, it increments the results counters
> > before the child process exits.
> 
> If all call-sites switch to tst_ret(), we could add TFAIL to tst_brk
> compile time check.

And it's even more complicated than this.

The problem is that if we add tst_ret() that calls exit(0) it will have
slightly different semantics for the main test process and for the
children.

The subtle difference is that we run the loop that executes the tests in
the case of the -i parameter or in the case that we defined tcnt is in
the main test process. If we call tst_ret() there it will exit the test
before we manage to run rest of the iterations and I would like to avoid
adding an API that is slightly confusing easy to misuse.

I will try to rethink this, however it looks like there is no silver
bullet to solve the problem. And it's certainly late for the release.

Also I've opened an issue for the problem in order not to forget:

https://github.com/linux-test-project/ltp/issues/462

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list