All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] Question about the usage of tst_brk()
@ 2018-11-07 10:33 Xiao Yang
  2018-11-07 10:39 ` Xiao Yang
  0 siblings, 1 reply; 6+ messages in thread
From: Xiao Yang @ 2018-11-07 10:33 UTC (permalink / raw)
  To: ltp

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



^ permalink raw reply	[flat|nested] 6+ messages in thread

* [LTP] Question about the usage of tst_brk()
  2018-11-07 10:33 [LTP] Question about the usage of tst_brk() Xiao Yang
@ 2018-11-07 10:39 ` Xiao Yang
  2018-11-07 11:09   ` Cyril Hrubis
  0 siblings, 1 reply; 6+ messages in thread
From: Xiao Yang @ 2018-11-07 10:39 UTC (permalink / raw)
  To: ltp

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

On 2018/11/07 18:33, Xiao Yang wrote:
> 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
>
>
>




^ permalink raw reply	[flat|nested] 6+ messages in thread

* [LTP] Question about the usage of tst_brk()
  2018-11-07 10:39 ` Xiao Yang
@ 2018-11-07 11:09   ` Cyril Hrubis
  2018-11-07 11:31     ` Jan Stancek
  0 siblings, 1 reply; 6+ messages in thread
From: Cyril Hrubis @ 2018-11-07 11:09 UTC (permalink / raw)
  To: ltp

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.

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:

diff --git a/lib/tst_test.c b/lib/tst_test.c
index 661fbbfce..b76871b38 100644
--- a/lib/tst_test.c
+++ b/lib/tst_test.c
@@ -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)

-- 
Cyril Hrubis
chrubis@suse.cz

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [LTP] Question about the usage of tst_brk()
  2018-11-07 11:09   ` Cyril Hrubis
@ 2018-11-07 11:31     ` Jan Stancek
  2018-11-07 11:54       ` Cyril Hrubis
  0 siblings, 1 reply; 6+ messages in thread
From: Jan Stancek @ 2018-11-07 11:31 UTC (permalink / raw)
  To: ltp


----- Original Message -----
> 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.
> 
> 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.

tst_brk is macro in newlib, so maybe we can catch this at compile-time?

> 
> 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [LTP] Question about the usage of tst_brk()
  2018-11-07 11:31     ` Jan Stancek
@ 2018-11-07 11:54       ` Cyril Hrubis
  2018-11-07 12:38         ` Jan Stancek
  0 siblings, 1 reply; 6+ messages in thread
From: Cyril Hrubis @ 2018-11-07 11:54 UTC (permalink / raw)
  To: ltp

Hi!
> tst_brk is macro in newlib, so maybe we can catch this at compile-time?

Interesting idea, will you look into that?

> > 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
chrubis@suse.cz

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [LTP] Question about the usage of tst_brk()
  2018-11-07 11:54       ` Cyril Hrubis
@ 2018-11-07 12:38         ` Jan Stancek
  0 siblings, 0 replies; 6+ messages in thread
From: Jan Stancek @ 2018-11-07 12:38 UTC (permalink / raw)
  To: ltp



----- Original Message -----
> Hi!
> > tst_brk is macro in newlib, so maybe we can catch this at compile-time?
> 
> Interesting idea, will you look into that?

Yes, I can.

> 
> > > 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
> chrubis@suse.cz
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-11-07 12:38 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-07 10:33 [LTP] Question about the usage of tst_brk() Xiao Yang
2018-11-07 10:39 ` Xiao Yang
2018-11-07 11:09   ` Cyril Hrubis
2018-11-07 11:31     ` Jan Stancek
2018-11-07 11:54       ` Cyril Hrubis
2018-11-07 12:38         ` Jan Stancek

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.