On Mon, Apr 03, 2017 at 02:52:35AM +0530, Sandhya Bankar wrote: > Add tests for getpid and getppid.
What's the use of testing these zero arguments syscalls? The syscall table is already tested by ksysent.test, and the return code is tested by almost every test. > --- 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 \ Well, I'm applying this trivia in a vain hope next time students will take something less useless for their GSoC microprojects. > 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 This is blind "sed s/getpgrp/getpid/g < tests/getpgrp.c > tests/getpid.c", but whatever is reasonable for getpgrp is not necessarily reasonable for getpid. I suppose you've never met a linux without getpid. > 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 We don't need this any longer. > 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 This is blind "sed s/getpgrp/getppid/g < tests/getpgrp.c > tests/getppid.c", but whatever is reasonable for getpgrp is not necessarily reasonable for getppid. I suppose you've never met a linux without getppid. > 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 We don't need this any longer. -- ldv
signature.asc
Description: PGP signature
------------------------------------------------------------------------------ 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