Hi!
> >> In case we need do real test work in child porcess, it is OK for child 
> >> process
> >> to use tst_resm(), tst_brkm() or tst_exit(). Parent process can use
> >> tst_record_childstatus() to make child process's test results propagated 
> >> to parent
> >> process correctly.
> >>
> >> Meanwhile we reset T_exitval to 0 for child process in tst_fork(), which 
> >> will
> >> make child process can record test results with tst_resm() or tst_brkm() 
> >> correctly.
> > 
> > Looks technically correct to me. The only caveat is that you have to
> > decide to use either tst_* interface in child or plain exit() and do not
> > to mix them.
> Yeah, Or I should write some notes about using tst_* interfaces in child 
> process in Test Writing Guidelines.
> And sorry for the delay, I was busy last week.

Yes, this patch would need more changes into the Test Writing Guidelines
anyway...

> > Also as the code si now we don't have to reset the T_exitval because
> > what we do now is or the flags form child to add them to the paren't
> > flags (which will be set anyway if the child has started with nonzero
> > flags).
> 
> Ah, you are right.
> But I think reseting T_exitval is necessary, at least we should give child 
> process
> a clean test environment...
> Assume a simple case:
>   Parent already has TFAIL set, then it fork() a child to have some
> other test work and everything is OK in child, child only calls 
> tst_resm(TPASS,...),
> then in child, T_exitval will have TPASS and TFAIL set. Finally, child calls
> tst_exit() to report the test results, in this case, child will return a 
> non-zero value, it seems child exits abnormally, though it does not affect 
> the final
> test results, it is still not reasonable, obviously 0 value is reasonable for 
> child, 
> after all child does not do any wrong.

Yes, it's better to reset it but it's not really necessary.

-- 
Cyril Hrubis
[email protected]

------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to