[PATCH 1/4] tests: add option_d_r.test

Dmitry V. Levin ldv at altlinux.org
Thu Mar 24 22:41:56 UTC 2016


On Wed, Mar 23, 2016 at 04:56:36PM +0800, Zhou Wenjian wrote:
> * tests/option_d_r.c: New file.
> * tests/option_d_r.expected: New file.
> * tests/option_d_r.test: New test.
> * tests/.gitignore: Add option_d_r.
> * tests/Makefile.am (check_PROGRAMS): Likewise.
> (TESTS): Add option_d_r.test.

Well, what can I say?  This patch is so spectacularly wrong
in various aspects that I hardly can do it justice.

> --- a/tests/.gitignore
> +++ b/tests/.gitignore
> @@ -151,3 +151,4 @@ xetitimer
>  xetpgid
>  xetpriority
>  xettimeofday
> +option_d_r

An element is added at the end of the sorted list.

> --- a/tests/Makefile.am
> +++ b/tests/Makefile.am
> @@ -199,6 +199,7 @@ check_PROGRAMS = \
>  	xetpgid \
>  	xetpriority \
>  	xettimeofday \
> +	option_d_r \
>  	# end of check_PROGRAMS

An element is added at the end of the sorted list.

> @@ -378,6 +379,7 @@ TESTS = \
>  	opipe.test \
>  	redirect.test \
>  	restart_syscall.test \
> +	option_d_r.test \
>  	$(LIBUNWIND_TESTS)

An element is added at the end of the sorted list.

> +int
> +main()
> +{
> +        int pid = fork();
> +	assert(pid != -1);

Inconsistent indentation.

> +        return 0;
> +}
> +

Trailing whitespace.

> --- /dev/null
> +++ b/tests/option_d_r.expected
> @@ -0,0 +1,6 @@
> +.*/strace: new tcb for pid [0-9]*, active tcbs:1
> +.*/strace: pid [0-9]* has TCB_STARTUP, initializing it
> +.*/strace: new tcb for pid [0-9]*, active tcbs:2
> +.*/strace: dropped tcb for pid [0-9]*, 1 remain
> +.*/strace: dropped tcb for pid [0-9]*, 0 remain
> +^.*0.[0-9] execve.*

Two completely unrelated options -d and -r are tested together.

-d enables debug output which is not a part of any API and therefore
can change (and sometimes changes) without notice, so hardly worth a test.

Does it test whether the output produced by -r option makes any sense?
No, it doesn't.

Compare with tests/strace-r.expected that does a strict check.


-- 
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20160325/dfb8a60c/attachment.bin>


More information about the Strace-devel mailing list