[PATCH] Makefile.am: use readlink as a fallback for realpath
Since realpath utility is fairly new in GNU coreutils, there could be possibility that it is not present in the system. Instead of checking its presence in configure script it probably makes sense to resort to calling readlink since it is (probably) more widespread. --- Makefile.am |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 65f5c64..b77c2e1 100644 --- a/Makefile.am +++ b/Makefile.am @@ -256,7 +256,8 @@ endif @CODE_COVERAGE_RULES@ CODE_COVERAGE_BRANCH_COVERAGE = 1 CODE_COVERAGE_GENHTML_OPTIONS = $(CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT) \ - --prefix $(shell realpath -Ls $(abs_top_srcdir)/..) + --prefix $(shell realpath -Ls $(abs_top_srcdir)/.. || \ + readlink -f $(abs_top_srcdir)/..) CODE_COVERAGE_IGNORE_PATTERN = '/usr/include/*' strace_CPPFLAGS += $(CODE_COVERAGE_CPPFLAGS) strace_CFLAGS += $(CODE_COVERAGE_CFLAGS) -- 1.7.10.4 -- ___ Strace-devel mailing list Strace-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/strace-devel
[PATCH 2/2] tests: check decoding of readahead syscall
* tests/readahead.c: New file. * tests/readahead.test: New test. * tests/.gitignore: Add readahead. * tests/Makefile.am (check_PROGRAMS): Likewise. (DECODER_TESTS): Add readahead.test. --- Simple test for simple decoder. tests/.gitignore |1 + tests/Makefile.am|2 ++ tests/readahead.c| 63 ++ tests/readahead.test |6 + 4 files changed, 72 insertions(+) create mode 100644 tests/readahead.c create mode 100755 tests/readahead.test diff --git a/tests/.gitignore b/tests/.gitignore index 5c5d092..8c41bea 100644 --- a/tests/.gitignore +++ b/tests/.gitignore @@ -185,6 +185,7 @@ pselect6 ptrace pwritev read-write +readahead readdir readlink readlinkat diff --git a/tests/Makefile.am b/tests/Makefile.am index b879bf4..d7421fc 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -241,6 +241,7 @@ check_PROGRAMS = \ ptrace \ pwritev \ read-write \ + readahead \ readdir \ readlink \ readlinkat \ @@ -568,6 +569,7 @@ DECODER_TESTS = \ ptrace.test \ pwritev.test \ read-write.test \ + readahead.test \ readdir.test \ readlink.test \ readlinkat.test \ diff --git a/tests/readahead.c b/tests/readahead.c new file mode 100644 index 000..307dbff --- /dev/null +++ b/tests/readahead.c @@ -0,0 +1,63 @@ +#include "tests.h" +#include + +#ifdef __NR_readahead + +# include +# include + +static const int fds[] = { + -0x8000, + -100, + -1, + 0, + 1, + 2, + 0x7fff, +}; + +static const off64_t offsets[] = { + -0x8000LL, + -0x5060708090a0b0c0LL, + -1LL, +0, +1, +0xbadfaced, +0x7fffLL, +}; + +static const unsigned long counts[] = { + 0UL, + 0xdeadca75, + (unsigned long)0xface1e55beeff00dULL, + (unsigned long)0xULL, +}; + +int +main(void) +{ + unsigned i; + unsigned j; + unsigned k; + ssize_t rc; + + for (i = 0; i < ARRAY_SIZE(fds); i++) + for (j = 0; j < ARRAY_SIZE(offsets); j++) + for (k = 0; k < ARRAY_SIZE(counts); k++) { + rc = readahead(fds[i], offsets[j], counts[k]); + + printf("readahead(%d, %lld, %lu) = " + "%ld %s (%m)\n", fds[i], + (long long)offsets[j], counts[k], rc, + errno2name()); + } + + puts("+++ exited with 0 +++"); + return 0; +} + +#else + +SKIP_MAIN_UNDEFINED("__NR_readahead") + +#endif diff --git a/tests/readahead.test b/tests/readahead.test new file mode 100755 index 000..397c690 --- /dev/null +++ b/tests/readahead.test @@ -0,0 +1,6 @@ +#!/bin/sh + +# Check readahead syscall decoding. + +. "${srcdir=.}/init.sh" +run_strace_match_diff -a1 -- 1.7.10.4 -- ___ Strace-devel mailing list Strace-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/strace-devel
[PATCH 0/2] Test and minor printf format fix for the readahead syscall
Hello. There is some initial implementation of readahead syscall decoder test. While it is implemented, it has been noticed that incorrect format is used for printing "count" argument. Eugene Syromyatnikov (2): readahead: Fix print format for the "count" argument tests: check decoding of readahead syscall readahead.c |2 +- tests/.gitignore |1 + tests/Makefile.am|2 ++ tests/readahead.c| 63 ++ tests/readahead.test |6 + 5 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 tests/readahead.c create mode 100755 tests/readahead.test -- 1.7.10.4 -- ___ Strace-devel mailing list Strace-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/strace-devel
Re: [PATCH] Refactor common sa_handler printing code
On Wed, Aug 31, 2016 at 07:04:21PM +0300, Eugene Syromyatnikov wrote: > * xlat/sa_handler_values.in: New file. > * signal.c: Include "xlat/sa_handler_values.h". > (get_sa_handler_str, print_sa_handler): New functions. > (SYS_FUNC(sigsetmask), SYS_FUNC(signal), decode_new_sigaction): Use them. > --- > signal.c | 64 > - > xlat/sa_handler_values.in |4 +++ > 2 files changed, 27 insertions(+), 41 deletions(-) > create mode 100644 xlat/sa_handler_values.in Applied, thanks. -- ldv pgpjm8dXlS_Mr.pgp Description: PGP signature -- ___ Strace-devel mailing list Strace-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/strace-devel
[PATCH] Refactor common sa_handler printing code
* xlat/sa_handler_values.in: New file. * signal.c: Include "xlat/sa_handler_values.h". (get_sa_handler_str, print_sa_handler): New functions. (SYS_FUNC(sigsetmask), SYS_FUNC(signal), decode_new_sigaction): Use them. --- signal.c | 64 - xlat/sa_handler_values.in |4 +++ 2 files changed, 27 insertions(+), 41 deletions(-) create mode 100644 xlat/sa_handler_values.in diff --git a/signal.c b/signal.c index 5b530cf..b796b10 100644 --- a/signal.c +++ b/signal.c @@ -70,6 +70,7 @@ # endif #endif +#include "xlat/sa_handler_values.h" #include "xlat/sigact_flags.h" #include "xlat/sigprocmaskcmds.h" @@ -113,6 +114,23 @@ * Use (NSIG / 8) as a size instead. */ +static const char * +get_sa_handler_str(unsigned long handler) +{ + return xlookup(sa_handler_values, handler); +} + +static void +print_sa_handler(unsigned long handler) +{ + const char *sa_handler_str = get_sa_handler_str(handler); + + if (sa_handler_str) + tprints(sa_handler_str); + else + printaddr(handler); +} + const char * signame(const int sig) { @@ -320,14 +338,7 @@ decode_old_sigaction(struct tcb *tcp, long addr) * compiler from generating code to manipulate * __sa_handler we cast the function pointers to long. */ tprints("{"); - if ((long)sa.__sa_handler == (long)SIG_ERR) - tprints("SIG_ERR"); - else if ((long)sa.__sa_handler == (long)SIG_DFL) - tprints("SIG_DFL"); - else if ((long)sa.__sa_handler == (long)SIG_IGN) - tprints("SIG_IGN"); - else - printaddr((long) sa.__sa_handler); + print_sa_handler((unsigned long)sa.__sa_handler); tprints(", "); #ifdef MIPS tprintsigmask_addr("", sa.sa_mask); @@ -360,32 +371,10 @@ SYS_FUNC(signal) if (entering(tcp)) { printsignal(tcp->u_arg[0]); tprints(", "); - switch (tcp->u_arg[1]) { - case (long) SIG_ERR: - tprints("SIG_ERR"); - break; - case (long) SIG_DFL: - tprints("SIG_DFL"); - break; - case (long) SIG_IGN: - tprints("SIG_IGN"); - break; - default: - printaddr(tcp->u_arg[1]); - } + print_sa_handler(tcp->u_arg[1]); return 0; - } - else if (!syserror(tcp)) { - switch (tcp->u_rval) { - case (long) SIG_ERR: - tcp->auxstr = "SIG_ERR"; break; - case (long) SIG_DFL: - tcp->auxstr = "SIG_DFL"; break; - case (long) SIG_IGN: - tcp->auxstr = "SIG_IGN"; break; - default: - tcp->auxstr = NULL; - } + } else if (!syserror(tcp)) { + tcp->auxstr = get_sa_handler_str(tcp->u_rval); return RVAL_HEX | RVAL_STR; } return 0; @@ -560,14 +549,7 @@ decode_new_sigaction(struct tcb *tcp, long addr) * compiler from generating code to manipulate * __sa_handler we cast the function pointers to long. */ tprints("{"); - if ((long)sa.__sa_handler == (long)SIG_ERR) - tprints("SIG_ERR"); - else if ((long)sa.__sa_handler == (long)SIG_DFL) - tprints("SIG_DFL"); - else if ((long)sa.__sa_handler == (long)SIG_IGN) - tprints("SIG_IGN"); - else - printaddr((unsigned long) sa.__sa_handler); + print_sa_handler((unsigned long)sa.__sa_handler); tprints(", "); /* * Sigset size is in tcp->u_arg[4] (SPARC) diff --git a/xlat/sa_handler_values.in b/xlat/sa_handler_values.in new file mode 100644 index 000..e907611 --- /dev/null +++ b/xlat/sa_handler_values.in @@ -0,0 +1,4 @@ +#val_type unsigned long +SIG_ERR +SIG_DFL +SIG_IGN -- 1.7.10.4 -- ___ Strace-devel mailing list Strace-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/strace-devel
Re: [PATCH v3] tests: Add test for the futex syscall
On Wed, Aug 31, 2016 at 12:32:58AM +0300, Eugene Syromyatnikov wrote: > * tests/futex.c: New file. > * tests/futex.test: Likewise. > * tests/Makefile.am (check_PROGRAMS): Add futex. > (DECODER_TESTS): Add futex.test. > --- > Changes since v2: > * Commands not available on the old kernels (2.6.18 onwards) are wrapped in >CHECK_FUTEX_ENOSYS which prevents failure in case errno is ENOSYS and is > not >expected one. > * Checks for PI mutexes do no rely on PID 2 being kthreadd (which is not true >when process namespaces are employed, for example). > * Printing return code is done via retstr() which utilizes errno2name for > errno >printing. > * All headers except asm/unistd.h moved under ifdef __NR_futex. > * inclusion removed since it is proven broken in some >distros > * Added definitions for FUTEX_PRIVATE_FLAG, FUTEX_CLOCK_REALTIME, > FUTEX_CMD_MASK > * Skip on EPERM since it is sometimes returned for otherwise perfectly >valid commands (WAKE_OP on AArch64) > * Minor formatting fixes. > > tests/Makefile.am |2 + > tests/futex.c | 692 > + > tests/futex.test |8 + > 3 files changed, 702 insertions(+) > create mode 100644 tests/futex.c > create mode 100755 tests/futex.test Wow, what a test! The whole series are now applied. Thanks! -- ldv pgp0oijQquXZv.pgp Description: PGP signature -- ___ Strace-devel mailing list Strace-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/strace-devel