Question about the usage of tst_brk()
Hi Jan, Cyril
From old library(i.e. test.h), it seems that only TFAIL, TBROK and TCONF are supported by tst_brkm().
From new library, are only TFAIL, TBROK and TCONF are supported by tst_brk() as well?
I am not sure if tst_brk()should support TWARN.
Best Regards,
Xiao Yang
Hi,
If only TFAIL, TBROK and TCONF should be supported by tst_brk() in new library, i will add check to mark TWARN and TPASS as invalid.
Best Regards,
Xiao Yang
Quoted 14 lines · Xiao Yang
Hi Jan, Cyril
From old library(i.e.
test.h), it seems that only TFAIL, TBROK and TCONF
are supported bytst_brkm().From new library, are only TFAIL, TBROK and TCONF are supported by
tst_brk()as well?
I am not sure if tst_brk()should support TWARN.Best Regards,
Xiao Yang
Hi!
Quoted 2 lines
If only TFAIL, TBROK and TCONF should be supported by
tst_brk()in new library, i will add check to mark TWARN and TPASS as invalid.
First of all I think that tst_brk() will only work with TBROK and TCONF at the moment, see the check_child_status() function, we do handle only TBROK and TCONF in the switch there, anything else will cause the test library to exit with invalid exit value. Well the tst_brk(TPASS, ...) will work by accident since we have to handle zero exit value there as well.
However how the code is now the tst_brk(TPASS, ...) in new library will not account the passed result in the result counters, so it would be a good idea to check what value has been passed to the tst_brk() and allow only TBROK and TCONF there.
If we wanted to enable TPASS and TFAIL we would have to first define sane semantic for it. I guess that something as "exit currect test process and increment result counters" would be reasonable, this could be done with:
lib/tst_test.c +9 -1
@@ -311,7 +311,15 @@ void tst_vbrk_(const char *file, const int lineno, int ttype,if (getpid () == lib_pid)do_exit (TTYPE_RESULT (ttype)); -exit (TTYPE_RESULT (ttype)); +switch (TTYPE_RESULT (ttype)) { +case TPASS : +case TFAIL : +update_results (TTYPE_RESULT (ttype)); +exit (0 ); +break ; +default : +exit (TTYPE_RESULT (ttype)); + } }
(beware untested)
Signature · 2 lines
Cyril Hrubis [email protected]
----- Original Message -----
Quoted 12 lines
Hi!
Quoted 3 lines
If only TFAIL, TBROK and TCONF should be supported by
tst_brk()in new library,
i will add check to mark TWARN and TPASS as invalid.First of all I think that
tst_brk()will only work with TBROK and TCONF at the
moment, see thecheck_child_status()function, we do handle only TBROK and TCONF in the switch there, anything else will cause the test library to exit with invalid exit value. Well thetst_brk(TPASS, ...)will work by accident since we have to handle zero exit value there as well.
Quoted 5 lines
However how the code is now the
tst_brk(TPASS, ...)in new library will not account the passed result in the result counters, so it would be a good idea to
check what value has been passed to thetst_brk()and allow only TBROK and TCONF there.
tst_brk is macro in newlib, so maybe we can catch this at compile-time?
Quoted 4 lines
If we wanted to enable TPASS and TFAIL we would have to first define sane semantic for it. I guess that something as "exit currect test process and increment result counters" would be reasonable, this could be done with:
tst_brk() always suggested to me that this is somehow unusual termination of test - something's not right with environment or test itself.
Our docs say "Printf-like function to report error and exit the test", so my preference would to not use it for "good" outcomes.
Regards,
Jan
Hi!
Quoted 1 line
tst_brkis macro in newlib, so maybe we can catch this at compile-time?
Interesting idea, will you look into that?
Quoted 9 lines
Quoted 3 lines
If we wanted to enable TPASS and TFAIL we would have to first define sane semantic for it. I guess that something as "exit currect test process and increment result counters" would be reasonable, this could be done with:
tst_brk()always suggested to me that this is somehow unusual termination of test - something's not right with environment or test itself.Our docs say "Printf-like function to report error and exit the test", so my preference would to not use it for "good" outcomes.
Well yes, the name suggests that.
Maybe we just need a few more reporting functions, I was thinking of adding tst_chk() that would print PASS/FAIL based on expression passed as first argument, since it seems that several people wanted to have something like this.
Signature · 2 lines
Cyril Hrubis [email protected]
----- Original Message -----
Quoted 4 lines
Hi!
Quoted 1 line
tst_brkis macro in newlib, so maybe we can catch this at compile-time?Interesting idea, will you look into that?
Yes, I can.
Quoted 22 lines
Quoted 10 lines
Quoted 4 lines
If we wanted to enable TPASS and TFAIL we would have to first define sane semantic for it. I guess that something as "exit currect test process and increment result counters" would be reasonable, this could be done with:
tst_brk()always suggested to me that this is somehow unusual termination of test - something's not right with environment or test itself.Our docs say "Printf-like function to report error and exit the test", so my preference would to not use it for "good" outcomes.
Well yes, the name suggests that.
Maybe we just need a few more reporting functions, I was thinking of adding
tst_chk()that would print PASS/FAIL based on expression passed as first argument, since it seems that several people wanted to have something like this.--
Cyril Hrubis
[email protected]