diff options
author | Dmitry V. Levin <ldv@altlinux.org> | 2017-04-02 01:03:24 +0000 |
---|---|---|
committer | Dmitry V. Levin <ldv@altlinux.org> | 2017-04-03 01:06:11 +0000 |
commit | 160360306d6ed8b484365b5db79fb1f20247242b (patch) | |
tree | ee3db4f26e45c1e3074a85fd3c0e9efc01c5a472 /tests | |
parent | 3e15e018efc5ed08eba647305ebd70e695a50967 (diff) | |
download | strace-160360306d6ed8b484365b5db79fb1f20247242b.tar.gz |
tests: run every test except ksysent.test in its own subdirectory
Many test executables create temporary files in the current work
directory for the duration of their execution.
This level of test isolation allows more test executables to be invoked
several times simultaneously.
* tests/.gitignore: Add *.dir, remove *.log.*, *.tmp, *.tmp-*,
and *.tmp.* patterns.
* tests/Makefile.am (clean-local, clean-local-check): New rules.
(.PHONY): Add clean-local-check.
(CLEANFILES): Remove all but ksysent.h.
* tests/init.sh: Strip test-specific prefix from LOG, OUT, and EXP
variables. When invoked from a test, create a new test-specific
directory, chdir into it, and add more ../ prefix to STRACE variable.
(run_prog): Replace "./" with "../".
* tests/attach-f-p.test: Replace "./" with "../".
* tests/attach-p-cmd.test: Likewise.
* tests/bexecve.test: Likewise.
* tests/btrfs-v.test: Likewise.
* tests/btrfs-vw.test: Likewise.
* tests/btrfs-w.test: Likewise.
* tests/count.test: Likewise.
* tests/detach-running.test: Likewise.
* tests/detach-sleeping.test: Likewise.
* tests/detach-stopped.test: Likewise.
* tests/mmap.test: Likewise.
* tests/net-y-unix.test: Likewise.
* tests/net-yy-inet.test: Likewise.
* tests/net-yy-netlink.test: Likewise.
* tests/net-yy-unix.test: Likewise.
* tests/net.test: Likewise.
* tests/opipe.test: Likewise.
* tests/poll.test: Likewise.
* tests/prctl-seccomp-strict.test: Likewise.
* tests/qual_fault-exit_group.test: Likewise.
* tests/qual_fault.test: Likewise.
* tests/qual_inject-error-signal.test: Likewise.
* tests/qual_inject-retval.test: Likewise.
* tests/qual_inject-signal.test: Likewise.
* tests/qual_signal.test: Likewise.
* tests/qual_syscall.test: Likewise.
* tests/readv.test: Likewise.
* tests/redirect-fds.test: Likewise.
* tests/sched.test: Likewise.
* tests/scm_rights-fd.test: Likewise.
* tests/seccomp-strict.test: Likewise.
* tests/strace-C.test: Likewise.
* tests/strace-E.expected: Likewise.
* tests/strace-E.test: Likewise.
* tests/strace-S.test: Likewise.
* tests/strace-T.test: Likewise.
* tests/strace-V.test: Likewise.
* tests/strace-ff.test: Likewise.
* tests/strace-k.test: Likewise.
* tests/strace-r.expected: Likewise.
* tests/strace-r.test: Likewise.
* tests/strace-t.test: Likewise.
* tests/strace-tt.test: Likewise.
* tests/strace-ttt.test: Likewise.
* tests/sun_path.test: Likewise.
* tests/uname.test: Likewise.
* tests/unix-pair-send-recv.test: Likewise.
* tests/unix-pair-sendto-recvfrom.test: Likewise.
Diffstat (limited to 'tests')
51 files changed, 115 insertions, 94 deletions
diff --git a/tests/.gitignore b/tests/.gitignore index 477529d0d..c21c09e19 100644 --- a/tests/.gitignore +++ b/tests/.gitignore @@ -1,9 +1,6 @@ +*.dir *.log -*.log.* *.o -*.tmp -*.tmp-* -*.tmp.* *.trs _newselect accept diff --git a/tests/Makefile.am b/tests/Makefile.am index c6c28cc02..acdb475a6 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -968,6 +968,11 @@ ksysent.$(OBJEXT): ksysent.h objects = $(filter %.$(OBJEXT),$(SOURCES:.c=.$(OBJEXT))) $(objects): scno.h -CLEANFILES = ksysent.h $(TESTS:=.tmp) $(TESTS:=.tmp.out) $(TESTS:=.tmp.exp) +clean-local: clean-local-check +.PHONY: clean-local-check +clean-local-check: + -rm -rf -- $(TESTS:.test=.dir) + +CLEANFILES = ksysent.h include ../scno.am diff --git a/tests/attach-f-p.test b/tests/attach-f-p.test index f41707409..e5a71acf1 100755 --- a/tests/attach-f-p.test +++ b/tests/attach-f-p.test @@ -34,10 +34,10 @@ framework_skip_ '/proc/self/task/ is not available' run_prog_skip_if_failed \ kill -0 $$ -run_prog ./attach-f-p-cmd > /dev/null +run_prog ../attach-f-p-cmd > /dev/null rm -f "$OUT" -./set_ptracer_any sh -c "exec ./attach-f-p >> $OUT" > /dev/null & +../set_ptracer_any sh -c "exec ../attach-f-p >> $OUT" > /dev/null & tracee_pid=$! while ! [ -s "$OUT" ]; do @@ -45,6 +45,6 @@ while ! [ -s "$OUT" ]; do fail_ 'set_ptracer_any sh failed' done -run_strace -a32 -f -echdir -p $tracee_pid ./attach-f-p-cmd > "$OUT" +run_strace -a32 -f -echdir -p $tracee_pid ../attach-f-p-cmd > "$OUT" match_diff "$LOG" "$OUT" rm -f "$OUT" diff --git a/tests/attach-p-cmd.test b/tests/attach-p-cmd.test index 2068cf1d2..b515eb814 100755 --- a/tests/attach-p-cmd.test +++ b/tests/attach-p-cmd.test @@ -34,14 +34,14 @@ run_prog_skip_if_failed \ rm -rf attach-p-cmd.test-lock rm -f "$OUT" -./set_ptracer_any ./attach-p-cmd-p >> "$OUT" & +../set_ptracer_any ../attach-p-cmd-p >> "$OUT" & tracee_pid=$! while ! [ -s "$OUT" ]; do kill -0 $tracee_pid 2> /dev/null || - fail_ 'set_ptracer_any ./attach-p-cmd-p failed' + fail_ 'set_ptracer_any ../attach-p-cmd-p failed' done -run_strace -a30 -echdir -p $tracee_pid ./attach-p-cmd-cmd > "$OUT" +run_strace -a30 -echdir -p $tracee_pid ../attach-p-cmd-cmd > "$OUT" match_diff "$LOG" "$OUT" rm -f "$OUT" diff --git a/tests/bexecve.test b/tests/bexecve.test index f1ab04f1f..631234eb3 100755 --- a/tests/bexecve.test +++ b/tests/bexecve.test @@ -35,14 +35,14 @@ run_strace_redir() $STRACE "$@" 2> "$LOG" } -run_strace_redir -enone ./set_ptracer_any true || +run_strace_redir -enone ../set_ptracer_any true || dump_log_and_fail_with "$STRACE $args: unexpected exit status" -run_strace_redir -enone ./set_ptracer_any false +run_strace_redir -enone ../set_ptracer_any false [ $? -eq 1 ] || dump_log_and_fail_with "$STRACE $args: unexpected exit status" -run_strace_redir -bexecve -enone ./set_ptracer_any false || +run_strace_redir -bexecve -enone ../set_ptracer_any false || dump_log_and_fail_with "$STRACE $args: unexpected exit status" pattern_detached='[^:]*strace: Process [1-9][0-9]* detached' diff --git a/tests/btrfs-v.test b/tests/btrfs-v.test index 1ee17b4b0..03a7cd8ff 100755 --- a/tests/btrfs-v.test +++ b/tests/btrfs-v.test @@ -4,7 +4,7 @@ . "${srcdir=.}/init.sh" -run_prog ./btrfs -v > /dev/null +run_prog ../btrfs -v > /dev/null run_strace -a16 -veioctl $args > "$EXP" check_prog grep grep -v '^ioctl([012],' < "$LOG" > "$OUT" diff --git a/tests/btrfs-vw.test b/tests/btrfs-vw.test index c7e40ad71..d97c15bcc 100755 --- a/tests/btrfs-vw.test +++ b/tests/btrfs-vw.test @@ -18,7 +18,7 @@ elif [ ! -d "${BTRFS_MOUNTPOINT}" ]; then skip_ "\$BTRFS_MOUNTPOINT does not point to a directory" fi -run_prog ./btrfs -v -w "${BTRFS_MOUNTPOINT}" > /dev/null +run_prog ../btrfs -v -w "${BTRFS_MOUNTPOINT}" > /dev/null run_strace -a16 -veioctl $args > "$EXP" check_prog grep grep -v '^ioctl([012],' < "$LOG" > "$OUT" diff --git a/tests/btrfs-w.test b/tests/btrfs-w.test index 6238dca80..1fa80469f 100755 --- a/tests/btrfs-w.test +++ b/tests/btrfs-w.test @@ -18,7 +18,7 @@ elif [ ! -d "${BTRFS_MOUNTPOINT}" ]; then skip_ "\$BTRFS_MOUNTPOINT does not point to a directory" fi -run_prog ./btrfs -w "${BTRFS_MOUNTPOINT}" > /dev/null +run_prog ../btrfs -w "${BTRFS_MOUNTPOINT}" > /dev/null run_strace -a16 -eioctl $args > "$EXP" check_prog grep grep -v '^ioctl([012],' < "$LOG" > "$OUT" diff --git a/tests/count.test b/tests/count.test index e75dc6b08..31aa45dba 100755 --- a/tests/count.test +++ b/tests/count.test @@ -29,14 +29,14 @@ . "${srcdir=.}/init.sh" -run_prog ./sleep 0 +run_prog ../sleep 0 check_prog grep grep_log() { local pattern="$1"; shift - run_strace "$@" ./sleep 1 + run_strace "$@" ../sleep 1 grep nanosleep "$LOG" > /dev/null || framework_skip_ 'sleep does not use nanosleep' diff --git a/tests/detach-running.test b/tests/detach-running.test index 006efb859..af3783e81 100755 --- a/tests/detach-running.test +++ b/tests/detach-running.test @@ -36,7 +36,7 @@ check_prog sleep set -e -./set_ptracer_any sh -c "echo > $LOG; while :; do :; done" > /dev/null & +../set_ptracer_any sh -c "echo > $LOG; while :; do :; done" > /dev/null & while ! [ -s "$LOG" ]; do kill -0 $! 2> /dev/null || diff --git a/tests/detach-sleeping.test b/tests/detach-sleeping.test index 54304f311..fe6dc777f 100755 --- a/tests/detach-sleeping.test +++ b/tests/detach-sleeping.test @@ -37,7 +37,7 @@ check_prog sleep set -e rm -f "$LOG" -./set_ptracer_any sleep $((2*$TIMEOUT_DURATION)) > "$LOG" & +../set_ptracer_any sleep $((2*$TIMEOUT_DURATION)) > "$LOG" & while ! [ -s "$LOG" ]; do kill -0 $! 2> /dev/null || diff --git a/tests/detach-stopped.test b/tests/detach-stopped.test index 8f480e7f7..961f30196 100755 --- a/tests/detach-stopped.test +++ b/tests/detach-stopped.test @@ -42,7 +42,7 @@ fi set -e rm -f "$LOG" -./set_ptracer_any sleep $((2*$TIMEOUT_DURATION)) > "$LOG" & +../set_ptracer_any sleep $((2*$TIMEOUT_DURATION)) > "$LOG" & while ! [ -s "$LOG" ]; do kill -0 $! 2> /dev/null || diff --git a/tests/init.sh b/tests/init.sh index 24a523e84..803fcd65e 100644 --- a/tests/init.sh +++ b/tests/init.sh @@ -26,10 +26,9 @@ # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ME_="${0##*/}" -LOG="$ME_.tmp" -OUT="$LOG.out" -EXP="$LOG.exp" -NAME="${ME_%.test}" +LOG="log" +OUT="out" +EXP="exp" warn_() { printf >&2 '%s\n' "$*"; } fail_() { warn_ "$ME_: failed test: $*"; exit 1; } @@ -52,7 +51,7 @@ dump_log_and_fail_with() run_prog() { if [ $# -eq 0 ]; then - set -- "./$NAME" + set -- "../$NAME" fi args="$*" "$@" || { @@ -267,17 +266,36 @@ grep_pid_status() check_prog cat check_prog rm -rm -f "$LOG" +case "$ME_" in + *.test) + NAME="${ME_%.test}" + TESTDIR="$NAME.dir" + rm -rf -- "$TESTDIR" + mkdir -- "$TESTDIR" + cd "$TESTDIR" + + case "$srcdir" in + /*) ;; + *) srcdir="../$srcdir" ;; + esac -[ -n "${STRACE-}" ] || { - STRACE=../strace - case "${LOG_COMPILER-} ${LOG_FLAGS-}" in - *--suppressions=*--error-exitcode=*--tool=*) + [ -n "${STRACE-}" ] || { + STRACE=../../strace + case "${LOG_COMPILER-} ${LOG_FLAGS-}" in + *--suppressions=*--error-exitcode=*--tool=*) # add valgrind command prefix STRACE="${LOG_COMPILER-} ${LOG_FLAGS-} $STRACE" ;; - esac -} + esac + } + + ;; + + *) + [ -n "${STRACE-}" ] || + STRACE=../strace + ;; +esac : "${TIMEOUT_DURATION:=60}" : "${SLEEP_A_BIT:=sleep 1}" diff --git a/tests/mmap.test b/tests/mmap.test index 0b87114a6..1ec43c352 100755 --- a/tests/mmap.test +++ b/tests/mmap.test @@ -50,7 +50,7 @@ fi syscall=$mmap,madvise,mlockall,mprotect,mremap,msync,munmap -run_prog "./$NAME" $mmap > /dev/null +run_prog "../$NAME" $mmap > /dev/null run_strace -a20 -e$syscall $args > "$EXP" sed -n "/^$mmap(NULL, 0, PROT_NONE,/,\$p" < "$LOG" > "$OUT" match_diff "$OUT" "$EXP" diff --git a/tests/net-y-unix.test b/tests/net-y-unix.test index aec8159fd..bdc126e6c 100755 --- a/tests/net-y-unix.test +++ b/tests/net-y-unix.test @@ -36,7 +36,7 @@ check_prog sed addr="$NAME-local-stream" -run_prog "./$NAME" $addr > /dev/null +run_prog "../$NAME" $addr > /dev/null run_strace -a20 -y -eclose,network $args > "$EXP" # Filter out close() calls made by ld.so and libc. diff --git a/tests/net-yy-inet.test b/tests/net-yy-inet.test index 2ebf91fa2..4bebac250 100755 --- a/tests/net-yy-inet.test +++ b/tests/net-yy-inet.test @@ -34,9 +34,9 @@ framework_skip_ '/proc/self/fd/ is not available' check_prog sed -run_prog ./netlink_inet_diag +run_prog ../netlink_inet_diag -run_prog "./$NAME" > /dev/null +run_prog "../$NAME" > /dev/null run_strace -a22 -yy -eclose,network $args > "$EXP" # Filter out close() calls made by ld.so and libc. diff --git a/tests/net-yy-netlink.test b/tests/net-yy-netlink.test index bff1d8616..81e04dfe7 100755 --- a/tests/net-yy-netlink.test +++ b/tests/net-yy-netlink.test @@ -37,9 +37,9 @@ framework_skip_ '/proc/self/fd/ is not available' check_prog sed -run_prog ./netlink_netlink_diag +run_prog ../netlink_netlink_diag -run_prog "./$NAME" > /dev/null +run_prog "../$NAME" > /dev/null run_strace -a22 -yy -eclose,network $args > "$EXP" # Filter out close() calls made by ld.so and libc. diff --git a/tests/net-yy-unix.test b/tests/net-yy-unix.test index b82761c34..851b43ab2 100755 --- a/tests/net-yy-unix.test +++ b/tests/net-yy-unix.test @@ -36,10 +36,10 @@ framework_skip_ '/proc/self/fd/ is not available' check_prog sed -run_prog ./netlink_unix_diag +run_prog ../netlink_unix_diag addr="$NAME-local-stream" -run_prog "./$NAME" $addr > /dev/null +run_prog "../$NAME" $addr > /dev/null run_strace -a22 -yy -eclose,network $args > "$EXP" # Filter out close() calls made by ld.so and libc. diff --git a/tests/net.test b/tests/net.test index d8e6a7390..832070780 100755 --- a/tests/net.test +++ b/tests/net.test @@ -4,7 +4,7 @@ . "${srcdir=.}/init.sh" -run_prog ./net-accept-connect net-local-stream +run_prog ../net-accept-connect net-local-stream run_strace_merge -e%network $args match_grep diff --git a/tests/opipe.test b/tests/opipe.test index 90e6838af..f658687e5 100755 --- a/tests/opipe.test +++ b/tests/opipe.test @@ -6,7 +6,7 @@ check_prog grep run_prog grep chdir $srcdir/umovestr.expected > "$EXP" -run_prog ./umovestr +run_prog ../umovestr > "$LOG" || fail_ "failed to write $LOG" $STRACE -o "|cat > $LOG && $SLEEP_A_BIT && grep chdir < $LOG > $OUT" -e chdir $args || diff --git a/tests/poll.test b/tests/poll.test index b74be29e6..09b7c50df 100755 --- a/tests/poll.test +++ b/tests/poll.test @@ -9,7 +9,7 @@ run_strace -a16 -vepoll $args > "$OUT" match_diff "$LOG" "$OUT" for abbrev in 0 1 2 3 4 5; do - run_prog "./$NAME" $abbrev > /dev/null + run_prog "../$NAME" $abbrev > /dev/null run_strace -a16 -epoll -s$abbrev $args > "$OUT" match_diff "$LOG" "$OUT" done diff --git a/tests/prctl-seccomp-strict.test b/tests/prctl-seccomp-strict.test index 1f987df72..19a41e6ac 100755 --- a/tests/prctl-seccomp-strict.test +++ b/tests/prctl-seccomp-strict.test @@ -5,7 +5,7 @@ . "${srcdir=.}/init.sh" check_prog grep -set -- "./$NAME" +set -- "../$NAME" "$@" > /dev/null || { case $? in 77) skip_ "$* exited with code 77" ;; diff --git a/tests/qual_fault-exit_group.test b/tests/qual_fault-exit_group.test index e589b754d..36f233d9f 100755 --- a/tests/qual_fault-exit_group.test +++ b/tests/qual_fault-exit_group.test @@ -41,13 +41,13 @@ test_with() match_diff } -test_with -eexit,exit_group -efault=exit_group:error=ENOSYS ./answer +test_with -eexit,exit_group -efault=exit_group:error=ENOSYS ../answer test_with -eexit,exit_group -efault=exit_group:error=ENOSYS \ - -efault=\!process:error=1 ./answer + -efault=\!process:error=1 ../answer test_with -eexit,exit_group -efault=all:error=ENOSYS \ - -efault=exit:error=1:when=2+ ./answer + -efault=exit:error=1:when=2+ ../answer test_with -eexit,exit_group -efault=exit_group:error=ENOSYS \ - -efault=\!%desc,%file,%memory,%process,%signal,%network,%ipc:error=1 ./answer + -efault=\!%desc,%file,%memory,%process,%signal,%network,%ipc:error=1 ../answer diff --git a/tests/qual_fault.test b/tests/qual_fault.test index e194a7879..49d93350f 100755 --- a/tests/qual_fault.test +++ b/tests/qual_fault.test @@ -76,7 +76,7 @@ check_fault_injection() run_strace -a11 -e trace=$trace \ "$@" -e fault=$fault$when$error $extra \ - ./$NAME $raw "$err" "$first" "$step" $N \ + ../$NAME $raw "$err" "$first" "$step" $N \ > "$EXP" 4> "$outexp" 5> "$outgot" match_diff "$EXP" "$LOG" diff --git a/tests/qual_inject-error-signal.test b/tests/qual_inject-error-signal.test index fcbcc398f..1fe46126d 100755 --- a/tests/qual_inject-error-signal.test +++ b/tests/qual_inject-error-signal.test @@ -4,5 +4,5 @@ . "${srcdir=.}/scno_tampering.sh" run_strace -a12 -echdir,exit_group -einject=chdir:error=ENOENT:signal=USR1 \ - "./$NAME" + "../$NAME" match_diff diff --git a/tests/qual_inject-retval.test b/tests/qual_inject-retval.test index 419030ad4..4d55196de 100755 --- a/tests/qual_inject-retval.test +++ b/tests/qual_inject-retval.test @@ -12,7 +12,7 @@ check_injection() rval="$1"; shift run_strace -a12 -e$syscall -einject="$syscall:retval=$rval" "$@" \ - ./qual_inject-retval "$rval" > "$EXP" + ../qual_inject-retval "$rval" > "$EXP" match_diff "$LOG" "$EXP" rm -f "$EXP" } diff --git a/tests/qual_inject-signal.test b/tests/qual_inject-signal.test index 88002ce94..f17e5a018 100755 --- a/tests/qual_inject-signal.test +++ b/tests/qual_inject-signal.test @@ -4,5 +4,5 @@ . "${srcdir=.}/init.sh" run_strace -a12 -echdir,exit_group -einject=chdir:signal=USR1 \ - ./$NAME + ../$NAME match_diff diff --git a/tests/qual_signal.test b/tests/qual_signal.test index 54a37a30c..eed18fd08 100755 --- a/tests/qual_signal.test +++ b/tests/qual_signal.test @@ -34,8 +34,8 @@ test_one_sig() local sigs sigs="$1"; shift - run_prog "./$NAME" "$@" > /dev/null - run_strace -e trace=none -e signal="$sigs" "./$NAME" "$@" > "$EXP" + run_prog "../$NAME" "$@" > /dev/null + run_strace -e trace=none -e signal="$sigs" "../$NAME" "$@" > "$EXP" match_diff "$LOG" "$EXP" rm -f "$EXP" } diff --git a/tests/qual_syscall.test b/tests/qual_syscall.test index 23a9b6272..e33fd044d 100755 --- a/tests/qual_syscall.test +++ b/tests/qual_syscall.test @@ -5,17 +5,17 @@ . "${srcdir=.}/init.sh" -run_prog ./umovestr -pattern_abbrev_verbose='execve("\./umovestr", \["\./umovestr"\], \[/\* [[:digit:]]* vars \*/\]) = 0' -pattern_nonabbrev_verbose='execve("\./umovestr", \["\./umovestr"\], \[".*\"\(\.\.\.\)\?\]) = 0' -pattern_nonverbose='execve("\./umovestr", 0x[[:xdigit:]]*, 0x[[:xdigit:]]*) = 0' +run_prog ../umovestr +pattern_abbrev_verbose='execve("\.\./umovestr", \["\.\./umovestr"\], \[/\* [[:digit:]]* vars \*/\]) = 0' +pattern_nonabbrev_verbose='execve("\.\./umovestr", \["\.\./umovestr"\], \[".*\"\(\.\.\.\)\?\]) = 0' +pattern_nonverbose='execve("\.\./umovestr", 0x[[:xdigit:]]*, 0x[[:xdigit:]]*) = 0' pattern_raw='execve(0x[[:xdigit:]]*, 0x[[:xdigit:]]*, 0x[[:xdigit:]]*) = 0' check_output_mismatch() { local pattern pattern="$1"; shift - run_strace "$@" ./umovestr + run_strace "$@" ../umovestr LC_ALL=C grep -x "$pattern" "$LOG" > /dev/null || { printf '%s\n%s\n' \ 'Failed patterns of expected output:' "$pattern" @@ -32,7 +32,7 @@ check_output_mismatch "$pattern_abbrev_verbose" -e trace=%process LC_ALL=C grep '^chdir' "$LOG" > /dev/null && dump_log_and_fail_with "$STRACE $args unexpected output" -run_strace -e 42 ./umovestr +run_strace -e 42 ../umovestr LC_ALL=C grep '^[[:alnum:]_]*(' "$LOG" > /dev/null && dump_log_and_fail_with "$STRACE $args unexpected output" diff --git a/tests/readv.test b/tests/readv.test index dc187996f..1623e2bf1 100755 --- a/tests/readv.test +++ b/tests/readv.test @@ -38,7 +38,7 @@ run_strace_match_diff -a16 -e trace=readv,writev \ run_strace_match_diff -a16 -e trace=readv,writev \ -eread='!all' -ewrite=none -eread='!0,1,2' -ewrite='!0,1,2' -wfd="$(./print_maxfd)" +wfd="$(../print_maxfd)" rfd="$(($wfd - 1))" run_strace_match_diff -a16 -e trace=readv,writev \ -eread="$rfd" -ewrite="$wfd" diff --git a/tests/redirect-fds.test b/tests/redirect-fds.test index ddef8fab1..6731f9480 100755 --- a/tests/redirect-fds.test +++ b/tests/redirect-fds.test @@ -50,7 +50,7 @@ check_fd() touch "$LOG" "$fd0" || framework_skip_ 'failed to create files' - set -- "\"./$NAME\"" "\"$1\"" "\"$2\"" "\"$3\"" + set -- "\"../$NAME\"" "\"$1\"" "\"$2\"" "\"$3\"" eval "$@" "<${a1:-&-}" ">${a2:-&-}" "2>${a3:-&-}" || fail_ "$* failed with code $rc" diff --git a/tests/sched.test b/tests/sched.test index a62f7868a..c65653a62 100755 --- a/tests/sched.test +++ b/tests/sched.test @@ -31,8 +31,8 @@ while read w i do - try_run_prog "./$i" || continue - run_strace -a$w -e%sched ./$i > "$EXP" + try_run_prog "../$i" || continue + run_strace -a$w -e%sched ../$i > "$EXP" match_diff "$LOG" "$EXP" done << EOF 28 sched_xetaffinity @@ -48,8 +48,8 @@ echo '+++ exited with 0 +++' > "$EXP" while read w i do - try_run_prog "./$i" || continue - run_strace -a$w -e%sched ./$i > /dev/null + try_run_prog "../$i" || continue + run_strace -a$w -e%sched ../$i > /dev/null match_diff "$LOG" "$EXP" done << EOF 11 fchdir diff --git a/tests/scm_rights-fd.test b/tests/scm_rights-fd.test index ba34f6b01..767d2279c 100755 --- a/tests/scm_rights-fd.test +++ b/tests/scm_rights-fd.test @@ -48,7 +48,7 @@ file="$dir/$(for i in $(seq 1 127); do echo A; done; echo Z)" touch -- "$file" || framework_skip_ 'failed to create a file' -run_prog ./scm_rights /dev/zero +run_prog ../scm_rights /dev/zero run_strace -y -x -e%network $args "$file" hex='[[:xdigit:]]' diff --git a/tests/seccomp-strict.test b/tests/seccomp-strict.test index b354c6a29..0c290c64f 100755 --- a/tests/seccomp-strict.test +++ b/tests/seccomp-strict.test @@ -4,7 +4,7 @@ . "${srcdir=.}/init.sh" -set -- "./$NAME" +set -- "../$NAME" "$@" > /dev/null || { case $? in 77) skip_ "$* exited with code 77" ;; diff --git a/tests/strace-C.test b/tests/strace-C.test index ccca9a091..359ddbde2 100755 --- a/tests/strace-C.test +++ b/tests/strace-C.test @@ -4,6 +4,6 @@ . "${srcdir=.}/init.sh" -run_prog ./sleep 0 -run_strace -a24 -C -enanosleep ./sleep 1 +run_prog ../sleep 0 +run_strace -a24 -C -enanosleep ../sleep 1 match_grep diff --git a/tests/strace-E.expected b/tests/strace-E.expected index d7823b7a2..3ae2c28e8 100644 --- a/tests/strace-E.expected +++ b/tests/strace-E.expected @@ -1 +1 @@ -execve\("\./sleep", \["\./sleep", "0"\], \[.*"option_E_var=OPTION_E_VAL".*\]\) = 0 +execve\("\.\./sleep", \["\.\./sleep", "0"\], \[.*"option_E_var=OPTION_E_VAL".*\]\) = 0 diff --git a/tests/strace-E.test b/tests/strace-E.test index d76ec3f5c..843f27a9a 100755 --- a/tests/strace-E.test +++ b/tests/strace-E.test @@ -4,6 +4,6 @@ . "${srcdir=.}/init.sh" -run_prog ./sleep 0 > /dev/null +run_prog ../sleep 0 > /dev/null run_strace -E option_E_var=OPTION_E_VAL -v $args match_grep diff --git a/tests/strace-S.test b/tests/strace-S.test index 3ea315cef..ab0773573 100755 --- a/tests/strace-S.test +++ b/tests/strace-S.test @@ -4,7 +4,7 @@ . "${srcdir=.}/init.sh" -run_prog ./readv > /dev/null +run_prog ../readv > /dev/null test_c() { @@ -13,7 +13,7 @@ test_c() sortopts="$1"; shift sedexpr="$1"; shift - run_strace -c -w -S "$sortby" ./readv > /dev/null + run_strace -c -w -S "$sortby" ../readv > /dev/null sed -r -n -e "$sedexpr" < "$LOG" > "$OUT" [ -s "$OUT" ] || diff --git a/tests/strace-T.test b/tests/strace-T.test index 7ab84a743..a6dac4e6a 100755 --- a/tests/strace-T.test +++ b/tests/strace-T.test @@ -4,6 +4,6 @@ . "${srcdir=.}/init.sh" -run_prog ./sleep 0 -run_strace -a24 -T -enanosleep ./sleep 1 +run_prog ../sleep 0 +run_strace -a24 -T -enanosleep ../sleep 1 match_grep diff --git a/tests/strace-V.test b/tests/strace-V.test index 9a051e00e..7d19fa16e 100755 --- a/tests/strace-V.test +++ b/tests/strace-V.test @@ -10,7 +10,8 @@ run_strace -V > "$LOG" getval() { - sed -r -n 's/#define[[:space:]]*'"$1"'[[:space:]]*"([^"]*)".*/\1/p' ../config.h + sed -r -n 's/#define[[:space:]]*'"$1"'[[:space:]]*"([^"]*)".*/\1/p' \ + ../../config.h } cat > "$EXP" << __EOF__ diff --git a/tests/strace-ff.test b/tests/strace-ff.test index 2ce06f19d..4f7327914 100755 --- a/tests/strace-ff.test +++ b/tests/strace-ff.test @@ -7,7 +7,7 @@ run_prog_skip_if_failed \ kill -0 $$ -./set_ptracer_any ./sleep 1 > "$OUT" & +../set_ptracer_any ../sleep 1 > "$OUT" & tracee_pid=$! while ! [ -s "$OUT" ]; do diff --git a/tests/strace-k.test b/tests/strace-k.test index d5e8ed2bc..459aaca93 100755 --- a/tests/strace-k.test +++ b/tests/strace-k.test @@ -37,7 +37,7 @@ check_prog sed check_prog tr -run_prog ./stack-fcall +run_prog ../stack-fcall run_strace -e getpid -k $args expected='getpid f3 f2 f1 f0 main ' diff --git a/tests/strace-r.expected b/tests/strace-r.expected index 8009c353c..a3d09079d 100644 --- a/tests/strace-r.expected +++ b/tests/strace-r.expected @@ -1,2 +1,2 @@ -[ ]{5}0\.0{6} execve\("\./sleep", \["\./sleep", "1"\], \[/\* [[:digit:]]+ vars \*/\]\) = 0 +[ ]{5}0\.0{6} execve\("\.\./sleep", \["\.\./sleep", "1"\], \[/\* [[:digit:]]+ vars \*/\]\) = 0 [ ]{5}(1\.[01]|0\.9)[[:digit:]]{5} \+\+\+ exited with 0 \+\+\+ diff --git a/tests/strace-r.test b/tests/strace-r.test index 4ba01f12a..00649b560 100755 --- a/tests/strace-r.test +++ b/tests/strace-r.test @@ -4,6 +4,6 @@ . "${srcdir=.}/init.sh" -run_prog ./sleep 0 -run_strace -r -eexecve ./sleep 1 +run_prog ../sleep 0 +run_strace -r -eexecve ../sleep 1 match_grep diff --git a/tests/strace-t.test b/tests/strace-t.test index 1d213e639..6ec9aa119 100755 --- a/tests/strace-t.test +++ b/tests/strace-t.test @@ -5,7 +5,7 @@ . "${srcdir=.}/init.sh" run_prog_skip_if_failed date +%T > /dev/null -run_prog ./sleep 0 +run_prog ../sleep 0 t0="$(date +%T)" run_strace -t -eexecve $args @@ -13,7 +13,7 @@ t1="$(date +%T)" EXPECTED="$LOG.expected" cat > "$EXPECTED" << __EOF__ -($t0|$t1) execve\\("\\./sleep", \\["\\./sleep", "0"\\], \\[/\\* [[:digit:]]+ vars \\*/\\]\\) = 0 +($t0|$t1) execve\\("\\.\\./sleep", \\["\\.\\./sleep", "0"\\], \\[/\\* [[:digit:]]+ vars \\*/\\]\\) = 0 __EOF__ match_grep "$LOG" "$EXPECTED" diff --git a/tests/strace-tt.test b/tests/strace-tt.test index 3f80001eb..36b0be9e8 100755 --- a/tests/strace-tt.test +++ b/tests/strace-tt.test @@ -6,7 +6,7 @@ run_prog_skip_if_failed date +%s > "$LOG" run_prog_skip_if_failed date +%T --date "@$(cat "$LOG")" > /dev/null -run_prog ./sleep 0 +run_prog ../sleep 0 s0="$(date +%s)" run_strace -tt -eexecve $args @@ -21,7 +21,7 @@ while [ "$s" -le "$s1" ]; do done cat > "$EXP" << __EOF__ -($t_reg)\\.[[:digit:]]{6} execve\\("\\./sleep", \\["\\./sleep", "0"\\], \\[/\\* [[:digit:]]+ vars \\*/\\]\\) = 0 +($t_reg)\\.[[:digit:]]{6} execve\\("\\.\\./sleep", \\["\\.\\./sleep", "0"\\], \\[/\\* [[:digit:]]+ vars \\*/\\]\\) = 0 __EOF__ match_grep "$LOG" "$EXP" diff --git a/tests/strace-ttt.test b/tests/strace-ttt.test index 4439715b5..333b99c53 100755 --- a/tests/strace-ttt.test +++ b/tests/strace-ttt.test @@ -5,7 +5,7 @@ . "${srcdir=.}/init.sh" run_prog_skip_if_failed date +%s > /dev/null -run_prog ./sleep 0 +run_prog ../sleep 0 s0="$(date +%s)" run_strace -ttt -eexecve $args @@ -19,7 +19,7 @@ while [ "$s" -le "$s1" ]; do done cat > "$EXP" << __EOF__ -($t_reg)\\.[[:digit:]]{6} execve\\("\\./sleep", \\["\\./sleep", "0"\\], \\[/\\* [[:digit:]]+ vars \\*/\\]\\) = 0 +($t_reg)\\.[[:digit:]]{6} execve\\("\\.\\./sleep", \\["\\.\\./sleep", "0"\\], \\[/\\* [[:digit:]]+ vars \\*/\\]\\) = 0 __EOF__ match_grep "$LOG" "$EXP" diff --git a/tests/sun_path.test b/tests/sun_path.test index 728328a84..f0b7a0263 100755 --- a/tests/sun_path.test +++ b/tests/sun_path.test @@ -4,7 +4,7 @@ . "${srcdir=.}/init.sh" -run_prog ./net-accept-connect 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678 +run_prog ../net-accept-connect 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678 run_strace_merge -ebind,connect,getsockname $args match_grep diff --git a/tests/uname.test b/tests/uname.test index 03fe30cd8..24732e10d 100755 --- a/tests/uname.test +++ b/tests/uname.test @@ -10,7 +10,7 @@ run_prog > /dev/null run_strace -v -euname $args > "$EXP" uniq < "$LOG" > "$OUT" -run_prog "./$NAME" abbrev > /dev/null +run_prog "../$NAME" abbrev > /dev/null run_strace -euname $args >> "$EXP" uniq < "$LOG" >> "$OUT" diff --git a/tests/unix-pair-send-recv.test b/tests/unix-pair-send-recv.test index 4defdebb7..10ab7ccc5 100755 --- a/tests/unix-pair-send-recv.test +++ b/tests/unix-pair-send-recv.test @@ -4,7 +4,7 @@ . "${srcdir=.}/init.sh" -run_prog ./unix-pair-send-recv abcdefghijklmnopqrstuvwxyz +run_prog ../unix-pair-send-recv abcdefghijklmnopqrstuvwxyz run_strace -a32 -esignal=none -esend,recv -eread=0 -ewrite=0 $args match_diff diff --git a/tests/unix-pair-sendto-recvfrom.test b/tests/unix-pair-sendto-recvfrom.test index 21afe236d..0bd9a040f 100755 --- a/tests/unix-pair-sendto-recvfrom.test +++ b/tests/unix-pair-sendto-recvfrom.test @@ -4,7 +4,7 @@ . "${srcdir=.}/init.sh" -run_prog ./unix-pair-sendto-recvfrom abcdefghijklmnopqrstuvwxyz +run_prog ../unix-pair-sendto-recvfrom abcdefghijklmnopqrstuvwxyz run_strace -esignal=none -esendto,recvfrom -eread=0 -ewrite=0 $args match_diff |