Add tests for getpid and getppid. Signed-off-by: Sandhya Bankar <bankarsandhya...@gmail.com> --- tests/.gitignore | 2 ++ tests/Makefile.am | 2 ++ tests/getpid.c | 21 +++++++++++++++++++++ tests/getpid.test | 6 ++++++ tests/getppid.c | 23 +++++++++++++++++++++++ tests/getppid.test | 6 ++++++ 6 files changed, 60 insertions(+) create mode 100644 tests/getpid.c create mode 100755 tests/getpid.test create mode 100644 tests/getppid.c create mode 100755 tests/getppid.test
diff --git a/tests/.gitignore b/tests/.gitignore index 477529d..bd76df1 100644 --- a/tests/.gitignore +++ b/tests/.gitignore @@ -95,6 +95,8 @@ getgroups getgroups32 getpeername getpgrp +getpid +getppid getrandom getresgid getresgid32 diff --git a/tests/Makefile.am b/tests/Makefile.am index c6c28cc..a7b1b92 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -158,6 +158,8 @@ check_PROGRAMS = \ getgroups32 \ getpeername \ getpgrp \ + getpid \ + getppid \ getrandom \ getresgid \ getresgid32 \ diff --git a/tests/getpid.c b/tests/getpid.c new file mode 100644 index 0000000..96f2d15 --- /dev/null +++ b/tests/getpid.c @@ -0,0 +1,21 @@ +#include "tests.h" +#include <asm/unistd.h> + +#ifdef __NR_getpid + +# include <stdio.h> +# include <unistd.h> + +int +main(void) +{ + printf("getpid() = %ld\n", syscall(__NR_getpid)); + puts("+++ exited with 0 +++"); + return 0; +} + +#else + +SKIP_MAIN_UNDEFINED("__NR_getpid") + +#endif diff --git a/tests/getpid.test b/tests/getpid.test new file mode 100755 index 0000000..ad12f14 --- /dev/null +++ b/tests/getpid.test @@ -0,0 +1,6 @@ +#!/bin/sh + +# Check getpid syscall decoding. + +. "${srcdir=.}/init.sh" +run_strace_match_diff -a9 diff --git a/tests/getppid.c b/tests/getppid.c new file mode 100644 index 0000000..b071c7f --- /dev/null +++ b/tests/getppid.c @@ -0,0 +1,23 @@ +#include "tests.h" +#include <asm/unistd.h> + +#ifdef __NR_getppid + +# include <stdio.h> +# include <unistd.h> + +int +main(void) +{ + printf("getppid() = %ld\n", syscall(__NR_getppid)); + + puts("+++ exited with 0 +++"); + + return 0; +} + +#else + +SKIP_MAIN_UNDEFINED("__NR_getppid") + +#endif diff --git a/tests/getppid.test b/tests/getppid.test new file mode 100755 index 0000000..f1e1acc --- /dev/null +++ b/tests/getppid.test @@ -0,0 +1,6 @@ +#!/bin/sh + +# Check getppid syscall decoding. + +. "${srcdir=.}/init.sh" +run_strace_match_diff -a9 -- 1.8.3.1 ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Strace-devel mailing list Strace-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/strace-devel