Hi,

On 07/01/2014 09:55 PM, chru...@suse.cz wrote:

>> +    } else {
>> +            tst_brkm(TBROK, cleanup, "child process terminated "
>> +                             "abnormally. status: %d", status);
>> +    }
> 
> The child code uses exit(1) directly, which coincidentally maps to the
> TFAIL but we should be consistent and better use 1 here or TFAIL in the
> child code.
> 
> Also this would be better written as a switch statement
> 
>       switch (ret) {
>       case TPASS:
>               ...
>       break;
>       case TCONF:
>               ...
>       break;
>       default:
>               tst_resm(TFAIL, "...");
>       }

OK. And I'd like to introduce two new function tst_reset_exitval() and 
tst_record_childstatus().
Here are some explanations:
Some test cases need do real test work in child process and parent process deal 
with the test results.
Usually it is not recommended to use tst_* interfaces in child process, because 
child process's test
results are not propagated to parent process correctly. But if child process 
call tst_exit() to report
the test results, I think it is OK.

And the big problem prohibits us to call tst_brkm(cleanup, ...) in child 
process is that child
and parent process share the directory created by tst_tmpdir(). Though child 
and parent process
share many other kernel resources, but mostly they are based on kernel COW 
mechanism. So if we can
remove the tst_rmdir() operation in cleanup() or put it elsewhere, I think we 
are free to call
tst_brkm(cleanup,..) interface, thanks.

If later we need do real test work in child process, the code flow would be:
child:
        tst_reset_exitval()
        ...
        tst_resm(...) //record test resutls
        ...
        tsr_brkm(...) //terminate the test
        ...
        tst_exit()

parent:
        wait(child)
        tst_record_childstatus()


Regards,
Xiaoguang Wang 
> 


------------------------------------------------------------------------------
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to