[PATCH v2] tests: add brk.test

Dmitry V. Levin ldv at altlinux.org
Tue May 17 09:16:13 UTC 2016


On Tue, May 17, 2016 at 04:19:01PM +0800, Fei Jie wrote:
> * tests/brk.c: New file.
> * tests/brk.expected: Likewise.
> * tests/brk.test: New test.
> * tests/.gitignore: Add brk.
> * tests/Makefile.am (check_PROGRAMS): Likewise.
> (DECODER_TESTS): Add brk.test.

tests/brk.expected is not going to be distributed unless added to
EXTRA_DIST.

> ---
>  tests/.gitignore   |  1 +
>  tests/Makefile.am  |  2 ++
>  tests/brk.c        | 20 ++++++++++++++++++++
>  tests/brk.expected |  1 +
>  tests/brk.test     | 10 ++++++++++
>  5 files changed, 34 insertions(+)
>  create mode 100644 tests/brk.c
>  create mode 100644 tests/brk.expected
>  create mode 100755 tests/brk.test
> 
> diff --git a/tests/.gitignore b/tests/.gitignore
> index 05cbd43..26c18ec 100644
> --- a/tests/.gitignore
> +++ b/tests/.gitignore
> @@ -15,6 +15,7 @@ attach-f-p
>  attach-p-cmd-cmd
>  attach-p-cmd-p
>  bpf
> +brk
>  caps
>  chmod
>  chown
> diff --git a/tests/Makefile.am b/tests/Makefile.am
> index a664275..64c1879 100644
> --- a/tests/Makefile.am
> +++ b/tests/Makefile.am
> @@ -70,6 +70,7 @@ check_PROGRAMS = \
>  	attach-p-cmd-cmd \
>  	attach-p-cmd-p \
>  	bpf \
> +	brk \
>  	caps \
>  	chmod \
>  	chown \
> @@ -359,6 +360,7 @@ DECODER_TESTS = \
>  	aio.test \
>  	alarm.test \
>  	bpf.test \
> +	brk.test \
>  	caps.test \
>  	chmod.test \
>  	chown.test \
> diff --git a/tests/brk.c b/tests/brk.c
> new file mode 100644
> index 0000000..1309bdc
> --- /dev/null
> +++ b/tests/brk.c
> @@ -0,0 +1,20 @@
> +#include "tests.h"
> +#include <sys/syscall.h>
> +
> +#ifdef __NR_brk
> +
> +# include <unistd.h>
> +
> +int
> +main(void)
> +{
> +	syscall(__NR_brk, NULL);
> +
> +	return 0;

Let's include more details in the check, e.g.

	long rc = syscall(__NR_brk, NULL);
	printf("brk\\(NULL\\) = %#lx\n", rc);

with subsequent

run_strace -a10 -ebrk $args > "$EXP"
match_grep "$LOG" "$EXP"
rm -f "$EXP"


-- 
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/20160517/99817f3e/attachment.bin>


More information about the Strace-devel mailing list