2011-02-27 00:28:50 +00:00
#!/bin/sh
2015-12-17 17:56:48 +00:00
#
2016-03-30 00:13:37 +00:00
# Copyright (c) 2011-2016 Dmitry V. Levin <ldv@altlinux.org>
2017-05-22 19:14:52 +02:00
# Copyright (c) 2011-2017 The strace developers.
2015-12-17 17:56:48 +00:00
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. The name of the author may not be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2011-02-27 00:28:50 +00:00
2017-04-01 13:14:15 +00:00
export LC_ALL = C
2011-02-27 00:28:50 +00:00
ME_ = " ${ 0 ##*/ } "
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.
2017-04-02 01:03:24 +00:00
LOG = "log"
OUT = "out"
EXP = "exp"
2011-02-27 00:28:50 +00:00
warn_( ) { printf >& 2 '%s\n' " $* " ; }
fail_( ) { warn_ " $ME_ : failed test: $* " ; exit 1; }
skip_( ) { warn_ " $ME_ : skipped test: $* " ; exit 77; }
framework_failure_( ) { warn_ " $ME_ : framework failure: $* " ; exit 99; }
2011-02-28 19:57:24 -05:00
framework_skip_( ) { warn_ " $ME_ : framework skip: $* " ; exit 77; }
2011-02-27 00:28:50 +00:00
check_prog( )
{
2013-03-18 11:35:06 +01:00
type " $@ " > /dev/null 2>& 1 ||
2011-02-28 19:57:24 -05:00
framework_skip_ " $* is not available "
2011-02-27 00:28:50 +00:00
}
2015-03-17 17:07:57 +00:00
dump_log_and_fail_with( )
{
2017-07-19 08:59:50 +00:00
cat < " $LOG " >& 2
2015-03-17 17:07:57 +00:00
fail_ " $* "
}
run_prog( )
{
if [ $# -eq 0 ] ; then
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.
2017-04-02 01:03:24 +00:00
set -- " ../ $NAME "
2015-03-17 17:07:57 +00:00
fi
args = " $* "
" $@ " || {
2016-08-13 22:05:20 +00:00
rc = $?
if [ $rc -eq 77 ] ; then
2015-03-17 17:07:57 +00:00
skip_ " $args exited with code 77 "
else
2016-08-13 22:05:20 +00:00
fail_ " $args failed with code $rc "
2015-03-17 17:07:57 +00:00
fi
}
}
run_prog_skip_if_failed( )
{
args = " $* "
2016-08-13 22:05:20 +00:00
" $@ " || framework_skip_ " $args failed with code $? "
2015-03-17 17:07:57 +00:00
}
2017-03-17 21:04:03 +01:00
try_run_prog( )
{
local rc
" $@ " > /dev/null || {
rc = $?
if [ $rc -eq 77 ] ; then
return 1
else
fail_ " $* failed with code $rc "
fi
}
}
2015-03-17 17:07:57 +00:00
run_strace( )
{
> " $LOG " || fail_ " failed to write $LOG "
args = " $* "
$STRACE -o " $LOG " " $@ " ||
2016-08-13 22:05:20 +00:00
dump_log_and_fail_with " $STRACE $args failed with code $? "
2015-03-17 17:07:57 +00:00
}
run_strace_merge( )
{
rm -f -- " $LOG " .[ 0-9] *
run_strace -ff -tt " $@ "
" $srcdir " /../strace-log-merge " $LOG " > " $LOG " ||
2016-08-13 22:05:20 +00:00
dump_log_and_fail_with 'strace-log-merge failed with code $?'
2015-03-17 17:07:57 +00:00
rm -f -- " $LOG " .[ 0-9] *
}
2015-04-06 23:40:13 +00:00
check_gawk( )
{
check_prog gawk
check_prog grep
local program = " $1 " ; shift
if grep '^@include[[:space:]]' < " $program " > /dev/null; then
gawk '@include "/dev/null"' < /dev/null ||
framework_skip_ 'gawk does not support @include'
fi
}
2015-03-17 17:07:57 +00:00
# Usage: [FILE_TO_CHECK [AWK_PROGRAM [ERROR_MESSAGE [EXTRA_AWK_OPTIONS...]]]]
2015-09-19 00:01:35 +00:00
# Check whether AWK_PROGRAM matches FILE_TO_CHECK using gawk.
# If it doesn't, dump FILE_TO_CHECK and fail with ERROR_MESSAGE.
2015-03-17 17:07:57 +00:00
match_awk( )
{
2015-03-18 19:14:02 +00:00
local output program error
2015-03-17 17:07:57 +00:00
if [ $# -eq 0 ] ; then
output = " $LOG "
else
output = " $1 " ; shift
fi
if [ $# -eq 0 ] ; then
2016-03-30 00:13:56 +00:00
program = " $srcdir / $NAME .awk "
2015-03-17 17:07:57 +00:00
else
program = " $1 " ; shift
fi
if [ $# -eq 0 ] ; then
error = " $STRACE $args output mismatch "
else
error = " $1 " ; shift
fi
2015-04-06 23:40:13 +00:00
check_gawk " $program "
2015-03-17 17:07:57 +00:00
2015-03-18 19:14:02 +00:00
AWKPATH = " $srcdir " gawk -f " $program " " $@ " < " $output " || {
2015-03-17 17:07:57 +00:00
cat < " $output "
fail_ " $error "
}
}
# Usage: [FILE_TO_CHECK [FILE_TO_COMPATE_WITH [ERROR_MESSAGE]]]
# Check whether FILE_TO_CHECK differs from FILE_TO_COMPATE_WITH.
# If it does, dump the difference and fail with ERROR_MESSAGE.
match_diff( )
{
local output expected error
if [ $# -eq 0 ] ; then
output = " $LOG "
else
output = " $1 " ; shift
fi
if [ $# -eq 0 ] ; then
2016-03-30 00:13:56 +00:00
expected = " $srcdir / $NAME .expected "
2015-03-17 17:07:57 +00:00
else
expected = " $1 " ; shift
fi
if [ $# -eq 0 ] ; then
error = " $STRACE $args output mismatch "
else
error = " $1 " ; shift
fi
check_prog diff
2017-07-02 21:03:09 +03:00
diff -u -- " $expected " " $output " ||
2015-03-17 17:07:57 +00:00
fail_ " $error "
}
# Usage: [FILE_TO_CHECK [FILE_WITH_PATTERNS [ERROR_MESSAGE]]]
# Check whether all patterns listed in FILE_WITH_PATTERNS
# match FILE_TO_CHECK using egrep.
# If at least one of these patterns does not match,
# dump both files and fail with ERROR_MESSAGE.
match_grep( )
{
2016-08-19 18:36:06 +03:00
local output patterns error pattern cnt failed =
2015-03-17 17:07:57 +00:00
if [ $# -eq 0 ] ; then
output = " $LOG "
else
output = " $1 " ; shift
fi
if [ $# -eq 0 ] ; then
2016-03-30 00:13:56 +00:00
patterns = " $srcdir / $NAME .expected "
2015-03-17 17:07:57 +00:00
else
patterns = " $1 " ; shift
fi
if [ $# -eq 0 ] ; then
error = " $STRACE $args output mismatch "
else
error = " $1 " ; shift
fi
check_prog wc
check_prog grep
2016-08-19 18:36:06 +03:00
cnt = 1
2015-09-19 00:11:07 +00:00
while read -r pattern; do
LC_ALL = C grep -E -x -e " $pattern " < " $output " > /dev/null || {
test -n " $failed " || {
echo 'Failed patterns of expected output:'
failed = 1
}
2016-08-19 18:36:06 +03:00
printf '#%d: %s\n' " $cnt " " $pattern "
2015-09-19 00:11:07 +00:00
}
2016-08-19 18:36:06 +03:00
cnt = $(( $cnt + 1 ))
2015-09-19 00:11:07 +00:00
done < " $patterns "
test -z " $failed " || {
2015-03-17 17:07:57 +00:00
echo 'Actual output:'
cat < " $output "
fail_ " $error "
}
}
2016-03-30 00:16:24 +00:00
# Usage: run_strace_match_diff [args to run_strace]
run_strace_match_diff( )
{
args = " $* "
[ -n " $args " -a -z " ${ args ##*-e trace=* } " ] ||
set -- -e trace = " $NAME " " $@ "
run_prog > /dev/null
run_strace " $@ " $args > " $EXP "
match_diff " $LOG " " $EXP "
}
2018-04-29 20:46:45 +02:00
# Usage: run_strace_match_grep [args to run_strace]
run_strace_match_grep( )
{
args = " $* "
[ -n " $args " -a -z " ${ args ##*-e trace=* } " ] ||
set -- -e trace = " $NAME " " $@ "
run_prog > /dev/null
run_strace " $@ " $args > " $EXP "
match_grep " $LOG " " $EXP "
}
2016-12-07 18:05:28 +00:00
# Print kernel version code.
# usage: kernel_version_code $(uname -r)
kernel_version_code( )
{
(
set -f
IFS = .
2018-03-23 13:43:13 +00:00
set -- $1 0 0
2016-12-07 18:05:28 +00:00
v1 = " ${ 1 %%[!0-9]* } " && [ -n " $v1 " ] || v1 = 0
v2 = " ${ 2 %%[!0-9]* } " && [ -n " $v2 " ] || v2 = 0
v3 = " ${ 3 %%[!0-9]* } " && [ -n " $v3 " ] || v3 = 0
echo " $(( $v1 * 65536 + $v2 * 256 + $v3 )) "
)
}
# Usage: require_min_kernel_version_or_skip 3.0
require_min_kernel_version_or_skip( )
{
local uname_r
uname_r = " $( uname -r) "
[ " $( kernel_version_code " $uname_r " ) " -ge \
" $( kernel_version_code " $1 " ) " ] ||
skip_ " the kernel release $uname_r is not $1 or newer "
}
2016-12-13 19:59:47 +00:00
# Usage: grep_pid_status $pid GREP-OPTIONS...
grep_pid_status( )
{
local pid
pid = $1 ; shift
cat < " /proc/ $pid /status " | grep " $@ "
}
2017-04-20 02:39:54 +02:00
# Subtracts one program set from another.
# If an optional regular expression is specified, the lines in the minuend file
# that match this regular expression are elso excluded from the output.
#
# Usage: prog_set_subtract minuend_file subtrahend_file [subtrahend_regexp]
prog_set_subtract( )
{
local min sub re pat
min = " $1 " ; shift
sub = " $1 " ; shift
re = " ${ 1 - } "
pat = " $re | $( sed 's/[[:space:]].*//' < " $sub " | tr -s '\n' '|' ) "
grep -E -v -x -e " $pat " < " $min "
}
# Usage: test_pure_prog_set [--expfile FILE] COMMON_ARGS < tests_file
# stdin should consist of lines in "test_name strace_args..." format.
test_pure_prog_set( )
{
local expfile
expfile = " $EXP "
while [ -n " $1 " ] ; do
case " $1 " in
--expfile)
shift
expfile = " $1 "
shift
; ;
*)
break
; ;
esac
done
while read -r t prog_args; do {
# skip lines beginning with "#" symbol
[ " ${ t ### } " = " $t " ] || continue
try_run_prog " ../ $t " || continue
run_strace $prog_args " $@ " " ../ $t " > " $expfile "
match_diff " $LOG " " $expfile "
} < /dev/null; done
}
# Run strace against list of programs put in "$NAME.in" and then against the
# rest of pure_executables.list with the expectation of empty output in the
# latter case.
#
# Usage: source this file after init.sh and call:
# test_trace_expr subtrahend_regexp strace_args
# Environment:
# $NAME: test name, used for "$NAME.in" file containing list of tests
# for positive trace expression match;
# $srcdir: used to find pure_executables.list and "$NAME.in" files.
# Files created:
# negative.list: File containing list of tests for negative match.
test_trace_expr( )
{
local subtrahend_regexp
subtrahend_regexp = " $1 " ; shift
test_pure_prog_set " $@ " < " $srcdir / $NAME .in "
prog_set_subtract " $srcdir /pure_executables.list " " $srcdir / $NAME .in " \
" $subtrahend_regexp " > negative.list
test_pure_prog_set --expfile /dev/null -qq -esignal= none " $@ " \
< negative.list
}
2014-09-23 01:51:05 +00:00
check_prog cat
check_prog rm
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.
2017-04-02 01:03:24 +00:00
case " $ME_ " in
2017-04-04 18:03:45 +00:00
*.gen.test) NAME = " ${ ME_ %.gen.test } " ; ;
*.test) NAME = " ${ ME_ %.test } " ; ;
*) NAME =
esac
2017-08-05 23:05:54 +00:00
STRACE_EXE =
2017-04-04 18:03:45 +00:00
if [ -n " $NAME " ] ; then
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.
2017-04-02 01:03:24 +00:00
TESTDIR = " $NAME .dir "
rm -rf -- " $TESTDIR "
mkdir -- " $TESTDIR "
cd " $TESTDIR "
case " $srcdir " in
/*) ; ;
*) srcdir = " ../ $srcdir " ; ;
esac
2014-09-23 01:51:05 +00:00
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.
2017-04-02 01:03:24 +00:00
[ -n " ${ STRACE - } " ] || {
STRACE = ../../strace
case " ${ LOG_COMPILER - } ${ LOG_FLAGS - } " in
*--suppressions= *--error-exitcode= *--tool= *)
2017-08-05 23:05:54 +00:00
STRACE_EXE = " $STRACE "
2016-12-06 02:31:31 +00:00
# add valgrind command prefix
STRACE = " ${ LOG_COMPILER - } ${ LOG_FLAGS - } $STRACE "
; ;
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.
2017-04-02 01:03:24 +00:00
esac
}
2017-07-19 02:38:37 +00:00
trap 'dump_log_and_fail_with "time limit ($TIMEOUT_DURATION) exceeded"' XCPU
2017-04-04 18:03:45 +00:00
else
2017-08-05 23:05:54 +00:00
: " ${ STRACE : =../strace } "
2017-04-04 18:03:45 +00:00
fi
2016-12-06 02:31:31 +00:00
2017-08-05 23:05:54 +00:00
# Export $STRACE_EXE to check_PROGRAMS.
: " ${ STRACE_EXE : = $STRACE } "
export STRACE_EXE
2017-08-01 20:59:48 +00:00
: " ${ TIMEOUT_DURATION : =600 } "
2013-06-18 20:51:49 +00:00
: " ${ SLEEP_A_BIT : =sleep 1 } "
2015-11-26 21:25:31 +00:00
[ -z " ${ VERBOSE - } " ] ||
set -x