[PATCH v2] Add some tests for -f option

Fei, Jie/费 杰 feij.fnst at cn.fujitsu.com
Wed Dec 30 09:23:04 UTC 2015



On 12/29/2015 11:33 PM, Philippe Ombredanne wrote:
> On Thu, Dec 17, 2015 at 3:45 AM, Fei Jie <feij.fnst at cn.fujitsu.com> wrote:
>> tests: add tests from option-f_001.test to option-f_003.test
>>
>> *tests/option-f_001.c: New file.
>> *tests/option-f_001.test: Likewise.
>> *tests/option-f_001.expected: Likewise.
>> *tests/option-f_002.c: Likewise.
>> *tests/option-f_002.test: Likewise.
>> *tests/option-f_002.expected: Likewise.
>> *tests/option-f_003.test: Likewise.
>> *tests/option-f_003.expected: Likewise.
>> * tests/Makefile.am (check_PROGRAMS): Add option-f_001 and option-f_002.
>> (TESTS): Add from option-f_001.test to option-f_003.test.
>> * tests/.gitignore: Add option-f_001 and option-f_002.
> [....]
>
>> diff --git a/tests/option-f_001.c b/tests/option-f_001.c
>> new file mode 100644
>> index 0000000..ef0c295
>> --- /dev/null
>> +++ b/tests/option-f_001.c
>> @@ -0,0 +1,21 @@
>> +#include <stdlib.h>
>> +#include <unistd.h>
>> +#include <stdio.h>
>> +
>> +#define MAGIC_STRING "CT&^%@"
>> +
>> +main()
>> +{
>> +       int pid = fork();
>> +       if (pid == -1) {
>> +               printf("fork failed\n");
>> +               exit(1);
>> +       }
>> +
>> +        if(pid){
>> +               printf("father" MAGIC_STRING "\n");
>> +        }else{
>> +               printf("child" MAGIC_STRING "\n" );
>> +        }
>> +       return 0;
>> +}
> Hi:
> Here are some humble feedback and questions...
>
> IMHO you should not be mixing spaces with tabs in the above. Use tabs.
> Same comment for option-f_002.c
>
> That said, why would these tests not be part of "strace-f.test"  or at
> least be named in a similar way?
>
> And what is the new thing these are testing?
>
> option-f_001.test tests fork(). Fork is already heavily tested in
> several other tests I guess?
> option-f_002.test tests vfork(). There is already a test in
> test/vfork.c but it is manual. I wonder why btw: there could be reason
> why the test is only manual?
I don't know the reason either but the case test it automatically.
> option-f_003.test tests a plain echo fork. This would be covered in
> tests/strace-f.test I think?
These cases were added to test whether strace can trace both
child processes which were created by fork and vfork or not.

>
> Did you experience a specific issue that motivated writing these tests?
>
I have a test suite of strace and I think it can complete the internal
test suite. But some cases are not necessary and I hope that
everyone can advice.






More information about the Strace-devel mailing list