From 854a25930c41b726934175a18fd533c10bb4f013 Mon Sep 17 00:00:00 2001 From: Fei Jie Date: Tue, 17 May 2016 17:59:45 +0800 Subject: [PATCH] tests: add brk.test * tests/brk.c: New file. * tests/brk.test: New test. * tests/.gitignore: Add brk. * tests/Makefile.am (check_PROGRAMS): Likewise. (DECODER_TESTS): Add brk.test. --- tests/.gitignore | 1 + tests/Makefile.am | 2 ++ tests/brk.c | 22 ++++++++++++++++++++++ tests/brk.test | 10 ++++++++++ 4 files changed, 35 insertions(+) create mode 100644 tests/brk.c create mode 100755 tests/brk.test diff --git a/tests/.gitignore b/tests/.gitignore index 05cbd43c..26c18ec9 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 a6642755..64c1879a 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 00000000..ed311aad --- /dev/null +++ b/tests/brk.c @@ -0,0 +1,22 @@ +#include "tests.h" +#include + +#ifdef __NR_brk + +# include +# include + +int +main(void) +{ + long rc = syscall(__NR_brk, NULL); + printf("brk\\(NULL\\) = %#lx\n", rc); + + return 0; +} + +#else + +SKIP_MAIN_UNDEFINED("__NR_brk") + +#endif diff --git a/tests/brk.test b/tests/brk.test new file mode 100755 index 00000000..8c0e2e49 --- /dev/null +++ b/tests/brk.test @@ -0,0 +1,10 @@ +#!/bin/sh + +# Check brk syscall decoding. + +. "${srcdir=.}/init.sh" + +run_prog > /dev/null +run_strace -a10 -ebrk $args > "$EXP" +match_grep "$LOG" "$EXP" +rm -f "$EXP" -- 2.40.0