strace/bootstrap
Dmitry V. Levin 0527093a7c tests: tabulate stereotypical test scripts
Convert test scripts that follow simple testing patterns to a table.
Generate all these scripts from gen_tests.in file using gen_tests.sh
script at bootstrap time.

The largest set of test scripts has been converted using
the following command:

grep -l ^run_strace_match_diff *.test |while read f; do
	n="${f%.test}"
	grep '^[^#]' "$f" |
	grep -Evq '^(\. "\${srcdir=\.}/init\.sh"|run_strace_match_diff)' ||
	sed -n 's/^run_strace_match_diff\(.*\)/'$n'\1/p' "$f"
done

The second largest set of test scripts has been converted using
the following command:

grep -l srcdir= *.test |while read f; do
	n="${f%.test}"
	grep '^[^#]' "$f" |
	grep -Fvq srcdir= ||
	sed -n 's/^. "\${srcdir=.}\/\([^"]\+\)".*/'$n'\t+\1/p' "$f"
done

* tests/gen_tests.in: New file.
* tests/gen_tests.sh: New file.
* bootstrap: Invoke it.
* tests/.gitignore: Add *.gen.test and gen_tests.am.
* tests/_newselect.test: Remove.
* tests/accept.test: Ditto.
* tests/accept4.test: Ditto.
* tests/access.test: Ditto.
* tests/acct.test: Ditto.
* tests/add_key.test: Ditto.
* tests/adjtimex.test: Ditto.
* tests/aio.test: Ditto.
* tests/alarm.test: Ditto.
* tests/bpf.test: Ditto.
* tests/btrfs.test: Ditto.
* tests/chmod.test: Ditto.
* tests/chown.test: Ditto.
* tests/chown32.test: Ditto.
* tests/chroot.test: Ditto.
* tests/clock_adjtime.test: Ditto.
* tests/clock_nanosleep.test: Ditto.
* tests/clock_xettime.test: Ditto.
* tests/copy_file_range.test: Ditto.
* tests/creat.test: Ditto.
* tests/delete_module.test: Ditto.
* tests/dup.test: Ditto.
* tests/dup2.test: Ditto.
* tests/dup3.test: Ditto.
* tests/epoll_create.test: Ditto.
* tests/epoll_create1.test: Ditto.
* tests/epoll_ctl.test: Ditto.
* tests/epoll_pwait.test: Ditto.
* tests/epoll_wait.test: Ditto.
* tests/erestartsys.test: Ditto.
* tests/execveat-v.test: Ditto.
* tests/execveat.test: Ditto.
* tests/faccessat.test: Ditto.
* tests/fadvise64_64.test: Ditto.
* tests/fallocate.test: Ditto.
* tests/fanotify_init.test: Ditto.
* tests/fanotify_mark.test: Ditto.
* tests/fchdir.test: Ditto.
* tests/fchmod.test: Ditto.
* tests/fchmodat.test: Ditto.
* tests/fchown.test: Ditto.
* tests/fchown32.test: Ditto.
* tests/fchownat.test: Ditto.
* tests/fcntl.test: Ditto.
* tests/fcntl64.test: Ditto.
* tests/fdatasync.test: Ditto.
* tests/file_handle.test: Ditto.
* tests/file_ioctl.test: Ditto.
* tests/finit_module.test: Ditto.
* tests/flock.test: Ditto.
* tests/fork-f.test: Ditto.
* tests/fstat64.test: Ditto.
* tests/fstatat64.test: Ditto.
* tests/fstatfs.test: Ditto.
* tests/fstatfs64.test: Ditto.
* tests/fsync.test: Ditto.
* tests/ftruncate.test: Ditto.
* tests/ftruncate64.test: Ditto.
* tests/futimesat.test: Ditto.
* tests/get_mempolicy.test: Ditto.
* tests/getcpu.test: Ditto.
* tests/getcwd.test: Ditto.
* tests/getdents.test: Ditto.
* tests/getdents64.test: Ditto.
* tests/getegid.test: Ditto.
* tests/getegid32.test: Ditto.
* tests/geteuid.test: Ditto.
* tests/geteuid32.test: Ditto.
* tests/getgid.test: Ditto.
* tests/getgid32.test: Ditto.
* tests/getgroups.test: Ditto.
* tests/getgroups32.test: Ditto.
* tests/getpeername.test: Ditto.
* tests/getpgrp.test: Ditto.
* tests/getrandom.test: Ditto.
* tests/getresgid.test: Ditto.
* tests/getresgid32.test: Ditto.
* tests/getresuid.test: Ditto.
* tests/getresuid32.test: Ditto.
* tests/getrlimit.test: Ditto.
* tests/getrusage.test: Ditto.
* tests/getsid.test: Ditto.
* tests/getsockname.test: Ditto.
* tests/getuid32.test: Ditto.
* tests/getxxid.test: Ditto.
* tests/inet-cmsg.test: Ditto.
* tests/init_module.test: Ditto.
* tests/inotify.test: Ditto.
* tests/inotify_init1.test: Ditto.
* tests/int_0x80.test: Ditto.
* tests/ioctl_block.test: Ditto.
* tests/ioctl_evdev.test: Ditto.
* tests/ioctl_loop.test: Ditto.
* tests/ioctl_mtd.test: Ditto.
* tests/ioctl_rtc.test: Ditto.
* tests/ioctl_scsi.test: Ditto.
* tests/ioctl_sg_io_v3.test: Ditto.
* tests/ioctl_sg_io_v4.test: Ditto.
* tests/ioctl_uffdio.test: Ditto.
* tests/ioctl_v4l2.test: Ditto.
* tests/ioperm.test: Ditto.
* tests/iopl.test: Ditto.
* tests/ioprio.test: Ditto.
* tests/ip_mreq.test: Ditto.
* tests/ipc.test: Ditto.
* tests/ipc_msg.test: Ditto.
* tests/ipc_sem.test: Ditto.
* tests/ipc_shm.test: Ditto.
* tests/kcmp.test: Ditto.
* tests/kexec_file_load.test: Ditto.
* tests/kexec_load.test: Ditto.
* tests/keyctl.test: Ditto.
* tests/kill.test: Ditto.
* tests/lchown.test: Ditto.
* tests/lchown32.test: Ditto.
* tests/link.test: Ditto.
* tests/linkat.test: Ditto.
* tests/lookup_dcookie.test: Ditto.
* tests/lstat.test: Ditto.
* tests/lstat64.test: Ditto.
* tests/mbind.test: Ditto.
* tests/membarrier.test: Ditto.
* tests/memfd_create.test: Ditto.
* tests/migrate_pages.test: Ditto.
* tests/mincore.test: Ditto.
* tests/mkdir.test: Ditto.
* tests/mkdirat.test: Ditto.
* tests/mknod.test: Ditto.
* tests/mknodat.test: Ditto.
* tests/mlock.test: Ditto.
* tests/mlock2.test: Ditto.
* tests/mlockall.test: Ditto.
* tests/mmap64.test: Ditto.
* tests/mmsg-silent.test: Ditto.
* tests/mmsg.test: Ditto.
* tests/mmsg_name-v.test: Ditto.
* tests/mmsg_name.test: Ditto.
* tests/mount.test: Ditto.
* tests/move_pages.test: Ditto.
* tests/mq.test: Ditto.
* tests/mq_sendrecv-read.test: Ditto.
* tests/mq_sendrecv-write.test: Ditto.
* tests/mq_sendrecv.test: Ditto.
* tests/msg_control-v.test: Ditto.
* tests/msg_control.test: Ditto.
* tests/msg_name.test: Ditto.
* tests/munlockall.test: Ditto.
* tests/nanosleep.test: Ditto.
* tests/net-icmp_filter.test: Ditto.
* tests/net-sockaddr.test: Ditto.
* tests/newfstatat.test: Ditto.
* tests/old_mmap.test: Ditto.
* tests/oldfstat.test: Ditto.
* tests/oldlstat.test: Ditto.
* tests/oldstat.test: Ditto.
* tests/open.test: Ditto.
* tests/openat.test: Ditto.
* tests/pause.test: Ditto.
* tests/perf_event_open.test: Ditto.
* tests/perf_event_open_nonverbose.test: Ditto.
* tests/perf_event_open_unabbrev.test: Ditto.
* tests/pipe2.test: Ditto.
* tests/pkey_alloc.test: Ditto.
* tests/pkey_free.test: Ditto.
* tests/pkey_mprotect.test: Ditto.
* tests/ppoll-v.test: Ditto.
* tests/ppoll.test: Ditto.
* tests/preadv-pwritev.test: Ditto.
* tests/preadv.test: Ditto.
* tests/preadv2-pwritev2.test: Ditto.
* tests/printstr.test: Ditto.
* tests/prlimit64.test: Ditto.
* tests/process_vm_readv.test: Ditto.
* tests/process_vm_writev.test: Ditto.
* tests/pselect6.test: Ditto.
* tests/ptrace.test: Ditto.
* tests/pwritev.test: Ditto.
* tests/quotactl-v.test: Ditto.
* tests/quotactl-xfs-v.test: Ditto.
* tests/quotactl-xfs.test: Ditto.
* tests/quotactl.test: Ditto.
* tests/readahead.test: Ditto.
* tests/readdir.test: Ditto.
* tests/readlink.test: Ditto.
* tests/readlinkat.test: Ditto.
* tests/reboot.test: Ditto.
* tests/recvfrom.test: Ditto.
* tests/recvmmsg-timeout.test: Ditto.
* tests/recvmsg.test: Ditto.
* tests/remap_file_pages.test: Ditto.
* tests/rename.test: Ditto.
* tests/renameat.test: Ditto.
* tests/renameat2.test: Ditto.
* tests/request_key.test: Ditto.
* tests/rmdir.test: Ditto.
* tests/rt_sigpending.test: Ditto.
* tests/rt_sigprocmask.test: Ditto.
* tests/rt_sigqueueinfo.test: Ditto.
* tests/rt_sigreturn.test: Ditto.
* tests/rt_sigsuspend.test: Ditto.
* tests/rt_sigtimedwait.test: Ditto.
* tests/rt_tgsigqueueinfo.test: Ditto.
* tests/sched_get_priority_mxx.test: Ditto.
* tests/sched_rr_get_interval.test: Ditto.
* tests/sched_xetaffinity.test: Ditto.
* tests/sched_xetattr.test: Ditto.
* tests/sched_xetparam.test: Ditto.
* tests/sched_xetscheduler.test: Ditto.
* tests/sched_yield.test: Ditto.
* tests/seccomp-filter-v.test: Ditto.
* tests/seccomp-filter.test: Ditto.
* tests/select.test: Ditto.
* tests/semop.test: Ditto.
* tests/sendfile.test: Ditto.
* tests/sendfile64.test: Ditto.
* tests/set_mempolicy.test: Ditto.
* tests/setdomainname.test: Ditto.
* tests/setfsgid.test: Ditto.
* tests/setfsgid32.test: Ditto.
* tests/setfsuid.test: Ditto.
* tests/setfsuid32.test: Ditto.
* tests/setgid.test: Ditto.
* tests/setgid32.test: Ditto.
* tests/setgroups.test: Ditto.
* tests/setgroups32.test: Ditto.
* tests/sethostname.test: Ditto.
* tests/setns.test: Ditto.
* tests/setregid.test: Ditto.
* tests/setregid32.test: Ditto.
* tests/setresgid.test: Ditto.
* tests/setresgid32.test: Ditto.
* tests/setresuid.test: Ditto.
* tests/setresuid32.test: Ditto.
* tests/setreuid.test: Ditto.
* tests/setreuid32.test: Ditto.
* tests/setrlimit.test: Ditto.
* tests/setuid.test: Ditto.
* tests/setuid32.test: Ditto.
* tests/shutdown.test: Ditto.
* tests/siginfo.test: Ditto.
* tests/signal_receive.test: Ditto.
* tests/signalfd4.test: Ditto.
* tests/sigreturn.test: Ditto.
* tests/socketcall.test: Ditto.
* tests/splice.test: Ditto.
* tests/stat.test: Ditto.
* tests/stat64.test: Ditto.
* tests/statfs64.test: Ditto.
* tests/statx.sh: Ditto.
* tests/statx.test: Ditto.
* tests/swap.test: Ditto.
* tests/symlink.test: Ditto.
* tests/symlinkat.test: Ditto.
* tests/sync.test: Ditto.
* tests/sync_file_range.test: Ditto.
* tests/sync_file_range2.test: Ditto.
* tests/sysinfo.test: Ditto.
* tests/syslog.test: Ditto.
* tests/tee.test: Ditto.
* tests/time.test: Ditto.
* tests/timer_create.test: Ditto.
* tests/timer_xettime.test: Ditto.
* tests/timerfd_xettime.test: Ditto.
* tests/times-fail.test: Ditto.
* tests/times.test: Ditto.
* tests/truncate.test: Ditto.
* tests/truncate64.test: Ditto.
* tests/ugetrlimit.test: Ditto.
* tests/umask.test: Ditto.
* tests/umoven-illptr.test: Ditto.
* tests/umovestr-illptr.test: Ditto.
* tests/umovestr3.test: Ditto.
* tests/unlink.test: Ditto.
* tests/unlinkat.test: Ditto.
* tests/unshare.test: Ditto.
* tests/userfaultfd.test: Ditto.
* tests/ustat.test: Ditto.
* tests/utime.test: Ditto.
* tests/utimes.test: Ditto.
* tests/vfork-f.test: Ditto.
* tests/vhangup.test: Ditto.
* tests/vmsplice.test: Ditto.
* tests/wait4-v.test: Ditto.
* tests/wait4.test: Ditto.
* tests/waitid-v.test: Ditto.
* tests/waitid.test: Ditto.
* tests/waitpid.test: Ditto.
* tests/xattr-strings.test: Ditto.
* tests/xet_robust_list.test: Ditto.
* tests/xetitimer.test: Ditto.
* tests/xetpgid.test: Ditto.
* tests/xetpriority.test: Ditto.
* tests/xettimeofday.test: Ditto.
* tests/Makefile.am (DECODER_TESTS, MISC_TESTS): Remove them.
Include gen_tests.am.
(TESTS): Add $(GEN_TESTS).
(XFAIL_TESTS_x86_64, XFAIL_TESTS_x32): Rename int_0x80.test
to int_0x80.gen.test.
(EXTRA_DIST): Add gen_tests.in and gen_tests.sh, remove statx.sh.
(clean-local-check): Remove $(GEN_TESTS:.gen.test=.dir).
2017-04-05 00:44:30 +00:00

25 lines
458 B
Bash
Executable File

#!/bin/sh -eu
./generate_mpers_am.sh
./xlat/gen.sh
./tests/gen_tests.sh
for m in m32 mx32; do
tests=tests-$m
rm -rf $tests
mkdir $tests
s='[[:space:]]*'
sed "s/@arch@/@arch_$m@/;
s/^MPERS_NAME$s=.*/& $m/;
s/^ARCH_MFLAGS$s=.*/& -DMPERS_IS_\$(MPERS_NAME) -$m/" \
tests/Makefile.am > $tests/Makefile.am
for f in tests/*; do
case "${f##*/}" in
Makefile*) continue;;
esac
ln -s ../"$f" $tests/
done
done
exec autoreconf -f -i "$@"