Commit Graph

10 Commits

Author SHA1 Message Date
Eugene Syromyatnikov
9d095c7860 Add copyright headers 2017-05-22 17:33:51 +00:00
c446d22fc6 tests: cleanup temporary files removals
As every test now runs in its own subdirectory, there is no need
to remove leftover files manually by each test.

* tests/init.sh (run_strace_match_diff): Do not remove $EXP.
* tests/brk.test: Likewise.
* tests/options-syntax.test: Likewise.
* tests/qual_inject-retval.test (check_injection): Likewise.
* tests/qual_signal.test (test_one_sig): Likewise.
* tests/sched.test: Likewise.
* tests/seccomp-strict.test: Likewise.
* tests/strace-V.test: Likewise.
* tests/strace-tt.test: Likewise.
* tests/strace-ttt.test: Likewise.
* tests/threads-execve.test: Likewise.
* tests/attach-f-p.test: Use $EXP instead of $OUT, do not remove it.
* tests/personality.test: Likewise.
* tests/poll.test: Likewise.
* tests/fstat.test: Likewise.
* tests/ipc.sh: Likewise.
* tests/restart_syscall.test: Likewise.
* tests/utimensat.test: Likewise.
* tests/attach-p-cmd.test: Likewise.  Do not remove
attach-p-cmd.test-lock.
* tests/detach-running.test: Do not remove $LOG.
* tests/detach-sleeping.test: Likewise.
* tests/detach-stopped.test: Likewise.
* tests/redirect.test: Do not remove $OUT.
* tests/strace-S.test: Likewise.
* tests/getdents.test: Do not remove $LOG.dir.
* tests/getdents64.test: Likewise.
* tests/readdir.test: Likewise.
* tests/btrfs-v.test: Do not remove $EXP and $OUT.
* tests/btrfs-vw.test: Likewise.
* tests/btrfs-w.test: Likewise.
* tests/execve-v.test: Likewise.
* tests/execve.test: Likewise.
* tests/fadvise64.test: Likewise.
* tests/getuid.test: Likewise.
* tests/ioctl.test: Likewise.
* tests/ioctl_dm-v.test: Likewise.
* tests/ioctl_dm.test: Likewise.
* tests/ioctl_evdev-v.test: Likewise.
* tests/ioctl_loop-nv.test: Likewise.
* tests/ioctl_loop-v.test: Likewise.
* tests/ioctl_loop.test: Likewise.
* tests/ioctl_rtc-v.test: Likewise.
* tests/ioctl_sock_gifconf.test: Likewise.
* tests/llseek.test: Likewise.
* tests/lseek.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/opipe.test: Likewise.
* tests/prctl-arg2-intptr.test: Likewise.
* tests/prctl-dumpable.test: Likewise.
* tests/prctl-name.test: Likewise.
* tests/prctl-no-args.test: Likewise.
* tests/prctl-pdeathsig.test: Likewise.
* tests/prctl-seccomp-filter-v.test: Likewise.
* tests/prctl-seccomp-strict.test: Likewise.
* tests/prctl-securebits.test: Likewise.
* tests/prctl-tid_address.test: Likewise.
* tests/prctl-tsc.test: Likewise.
* tests/umovestr2.test: Likewise.
* tests/uname.test: Likewise.
* tests/pread64-pwrite64.test: Do nore remove pread64-pwrite64-tmpfile.
* tests/read-write.test: Do nore remove read-write-tmpfile.
* tests/qual_fault.test (check_fault_injection): Do not remove $EXP,
$outexp, and $outgot.
* tests/redirect-fds.test (check_fd): Reorder removal of work files.
* tests/pc.test: Use $EXP instead of $EXPECTED, do not remove it.
* tests/strace-t.test: Likewise.
* tests/scm_rights-fd.test: Likewise.  Use dir instead of $LOG.dir,
do not remove it.
* tests/strace-ff.test: Do not remove $OUT and $LOG.* files.
2017-04-03 16:24:28 +00:00
160360306d 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-03 01:06:11 +00:00
3dac7272e8 tests: workaround a bug in GNU grep
Workaround a bug introduced in GNU grep 2.27, for details see
https://lists.gnu.org/archive/html/bug-grep/2016-12/msg00011.html

* tests/init.sh (grep_pid_status): New function.
* tests/detach-running.test: Use it instead of grep to search
in /proc/$pid/status.
* tests/detach-sleeping.test: Likewise.
* tests/detach-stopped.test: Likewise.
2016-12-13 20:21:22 +00:00
38a34c9349 Add copyright headers to some files which lack them
Before this change, all files that exist since 20th century had
copyright headers, while most files that appeared later didn't.  This
change fixes the inconsistency by adding missing copyright headers.

It doesn't mean that copyright headers became maintained.  In my view,
git history provides much better information on this subject and is much
more accurate than copyright headers.
2015-12-17 17:56:48 +00:00
8f54664d68 tests: factor out common shell code to functions
Factor out shell code used in several tests to common functions.

* tests/fanotify_mark.expected: New file.
* tests/ioctl.expected: New file.
* tests/net-fd.expected: New file.
* tests/net.expected: New file.
* tests/statfs.expected: New file.
* tests/sun_path.expected: New file.
* tests/uio.expected: New file.
* tests/ipc.sh: New file.
* tests/Makefile.am (EXTRA_DIST): Add them.
* tests/init.sh (dump_log_and_fail_with, run_prog,
run_prog_skip_if_failed, run_strace, run_strace_merge,
match_awk, match_diff, match_grep): New functions.
* tests/*.test: Use them.
2015-03-18 02:29:36 +00:00
74697bd29b tests: skip detach tests if kill does not work
* tests/detach-running.test: Skip if "kill -0" does not work.
* tests/detach-sleeping.test: Likewise.
* tests/detach-stopped.test: Likewise.
2015-01-14 08:10:59 +00:00
3ec5c0492c tests: cleanup checks for basic programs
* tests/init.sh: Check for cat and rm.
* tests/getdents.test: Check for awk.
* tests/ptrace_setoptions.test: Check for grep.
* tests/net-fd.test: Do not check for rm.
* tests/net.test: Likewise.
* tests/scm_rights-fd.test: Likewise.
* tests/stat.test: Likewise.
* tests/uio.test: Likewise.
2014-09-23 01:51:05 +00:00
Mike Frysinger
2b5bfeb2a8 tests: fix shell errors in detach tests
The current detach test code does:
	set -e
	...
	cleanup() {
		set +e
		kill ...
		wait ...
	}
	...
	cleanup
	exit 0

The problem is that while `set -e` is disabled for the body of the
cleanup function, it isn't necessarily disabled in the caller scope.
So if the return value of the cleanup function (`wait` in this case)
is non-zero, the script ends up failing overall.

Add an explicit return 0 to the cleanup function so that we don't kill
the overall test pipeline.

* tests/detach-running.test (cleanup): Add return 0.
* tests/detach-sleeping.test (cleanup): Likewise.
* tests/detach-stopped.test (cleanup): Likewise.
2014-08-11 17:22:38 +00:00
123d401508 tests: rename all tests so that their names end in .test suffix
Due to automake limitations, some features work only for tests
that end in one of the suffixes listed in TEST_EXTENSIONS.

* tests/detach-running: Rename to detach-running.test.
* tests/detach-sleeping: Rename to detach-sleeping.test.
* tests/detach-stopped: Rename to detach-stopped.test.
* tests/net: Rename to net.test.
* tests/ptrace_setoptions: Rename to ptrace_setoptions.test.
* tests/qual_syscall: Rename to qual_syscall.test.
* tests/sigaction.sh: Rename to sigaction.test.
* tests/stat: Rename to stat.test.
* tests/strace-f: Rename to strace-f.test.
* tests/Makefile.am (TESTS): Update.
(LOG_COMPILER): Rename to TEST_LOG_COMPILER.
2014-02-02 16:49:41 +00:00