[PATCH v2] Add some tests for -f option

Philippe Ombredanne pombredanne at nexb.com
Tue Dec 29 15:33:55 UTC 2015


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?
option-f_003.test tests a plain echo fork. This would be covered in
tests/strace-f.test I think?

Did you experience a specific issue that motivated writing these tests?

-- 
Cordially
Philippe Ombredanne




More information about the Strace-devel mailing list