]> granicus.if.org Git - strace/commitdiff
tests: add brk.test
authorFei Jie <feij.fnst@cn.fujitsu.com>
Tue, 17 May 2016 09:59:45 +0000 (17:59 +0800)
committerDmitry V. Levin <ldv@altlinux.org>
Tue, 17 May 2016 10:53:03 +0000 (10:53 +0000)
* 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
tests/Makefile.am
tests/brk.c [new file with mode: 0644]
tests/brk.test [new file with mode: 0755]

index 05cbd43c7958993264ac8b503baf0cef5b6fb6b3..26c18ec9b1d7db15d6c5ac4036cac22d48289ccf 100644 (file)
@@ -15,6 +15,7 @@ attach-f-p
 attach-p-cmd-cmd
 attach-p-cmd-p
 bpf
+brk
 caps
 chmod
 chown
index a6642755a327b1b1bd75ff4c21bbb9aa18cb1d15..64c1879ac7d8d786f358afd84f08d1c065bcd23d 100644 (file)
@@ -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 (file)
index 0000000..ed311aa
--- /dev/null
@@ -0,0 +1,22 @@
+#include "tests.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_brk
+
+# include <stdio.h>
+# include <unistd.h>
+
+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 (executable)
index 0000000..8c0e2e4
--- /dev/null
@@ -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"