[CRIU] [RFC PATCHv2 00/32] zdtm: single-process group tests

Ivan Shapovalov intelfx at intelfx.name
Sat Mar 12 00:41:59 PST 2016


This patch series adds the "multi-test launcher" and related infrastructure
to start multiple tests in one process. There are (almost) no modifications
to the tests themselves; the ability to run tests standalone is also preserved
on binary level (except for tests which use TLS, which seem to break
when built with -pie for reasons that I do not completely understand).

Sorry for this taking too long -- the fork/wait management opened a can of
worms...

Significant changes since v1 (I've squashed new work into previous commits,
so a changelog is needed), in order of `git diff` between patchsets:

- zdtm.py: removed overengineered nsroot population logic, replacing it with
  setting $PATH to canonical string so that all our hardcoded pathes like
  /sbin/iptables will work
- zdtm.py: integrated single-process group tests (the multi-test launcher)
  via its own Makefile
- launcher: implemented interception of fork()/wait() in launcher to allow
  tests to wait() for their child processes only (per commentary of Andrey
  Vagin)
  NB: this is complicated, probably it would've been a lot easier to patch
      tests to use waitpid()... but we're going the road of not altering the
      tests :)

Insignificant changes since v1, in no particular order:
- zdtm.py: implemented writing checkskip and hook scripts for groups
- zdtm.py: implemented crlib flag support for group tests
- zdtm.py: split --keep-going and --list-failures into separate patches
- zdtm.py: allowed generating groups of size 1
- zdtm.py: implemented "exhaustive" group generation mode
- launcher: assorted bugfixes for corner cases in tests
- Makefile: fixed building of multi-process groups executable
- Makefile, tests: made tests tolerant to pathes in --filename/--dirname
  (as opposed to simply file names without any slashes)
- tests: made all argument variables static
  (my toolchain emits crap when it sees a non-static `dirname`... probably
   a clash with dirname(3))
- tests: fixed some tests to accept filenames of temporary files via args
  rather than use hardcoded files in cwd
- tests: fixed netns-nf to work on arch (added yet another path to
  libxt_standard.so)
- tests: swept noauto tests and removed that flag from those tests which
  complete successfully

Known problems:
- no ability to express explicit incompatibilities in test descriptors
  (e. g. static/mntns_shared_bind02 vs static/tempfs_subns,
   static/cgroup00 vs static/cgroup03)
- no ability to express ordering in test descriptors
  (e. g. static/sigpending must be last)
- transition/ptrace fails because ptracer must stay in the same thread
  (need to implement a possibility to run whole test in a separate thread,
   rather than just the busy loop)
- SIGCHLD hack in static/sigpending: test modified to ignore stray SIGCHLD
  coming from other tests
  Possible resolutions:
  - leave the hack as it is
  - add explicit incompatibilities to static/sigpending vs. everything else
    that uses SIGCHLD
- no checking for signal handler conflicts (when two tests set their own
  handlers for the same signal)
- no checking for cwd conflicts (when two tests change their cwds)
- there was no testing in exhaustive mode

Ivan Shapovalov (32):
  zdtm: zdtm.py: add --keep-going option
  zdtm: zdtm.py: reset $PATH to canonical in ns tests
  zdtm: zdtm.py: add --list-failures option
  zdtm: zdtm.py: implement exhaustive group generation (still subject to test compatibility screening)
  zdtm: zdtm.py: allow deliberately generating test groups of size 1
  zdtm: zdtm.py: write "meta" checkskip/hook scripts for group tests
  zdtm: zdtm.py: properly handle 'crlib' in group tests
  compiler.h: add basic attribute cleanup machinery
  zdtm: reuse criu's compiler.h
  zdtm: lib: make libzdtmtst a shared object
  zdtm: ignore helper binaries and when searching for all tests
  zdtm: Makefile: sanitize building of groups executable
  zdtm: Makefile: cleanup and deduplicate Makefiles
  zdtm: Makefile: separate test launch and cmdline generation phases
  zdtm: Makefile: use different launcher arguments for tests which do busy-loops
  zdtm: Makefile: support passing various path prefixes to test Makefiles
  zdtm: tests: make all command-line arguments variables static
  zdtm: tests: make tests tolerant to slashes in filename arguments
  zdtm: static/{bridge,netns}: support running from another cwd
  zdtm: static/file_locks00: report pass/fail in parent process
  zdtm: static/write_read02: support longer pathes passed as --filename
  zdtm: static/netns-nf: add yet another path for libxt_standard.so (as in Arch)
  zdtm: static/sigpending: ignore foreign SIGCHLD events (for single-process group tests)
  zdtm: tests: sweep noauto tests and remove noauto status from those which run correctly
  zdtm: lib: export some internals of libzdtmtst
  zdtm: lib: add pr_debug() macro in line with other pr_*
  zdtm: lib: include tid in debug messages
  zdtm: lib: write our own assert()
  zdtm: add the multi-test launcher
  zdtm: launcher: initial implementation of fork()+wait() management
  zdtm: Makefile: build TLS-using tests with -shared rather than -pie
  zdtm: zdtm.py: hook up the multi-test launcher to existing group tests infrastructure

 criu/include/compiler.h                    |   10 +
 test/zdtm.desc                             |    2 +-
 test/zdtm.py                               |  150 +++-
 test/zdtm/.gitignore                       |    4 +-
 test/zdtm/Makefile                         |   16 +-
 test/zdtm/Makefile.inc                     |    6 +-
 test/zdtm/Makefile.live                    |  124 +++
 test/zdtm/Makefile.multi                   |   54 ++
 test/zdtm/launcher/Makefile                |   32 +
 test/zdtm/launcher/launcher.c              | 1331 ++++++++++++++++++++++++++++
 test/zdtm/lib/Makefile                     |   18 +-
 test/zdtm/lib/include/compiler.h           |    1 +
 test/zdtm/lib/lock.h                       |    7 +-
 test/zdtm/lib/msg.c                        |    7 +
 test/zdtm/lib/parseargs.c                  |    6 +-
 test/zdtm/lib/test.c                       |   73 +-
 test/zdtm/lib/zdtmtst.h                    |   58 +-
 test/zdtm/lib/zdtmtst_internal.h           |   41 +
 test/zdtm/static/Makefile                  |  148 +---
 test/zdtm/static/bind-mount.c              |    2 +-
 test/zdtm/static/binfmt_misc.c             |    2 +-
 test/zdtm/static/bridge.c                  |   14 +-
 test/zdtm/static/cgroup00.c                |    2 +-
 test/zdtm/static/cgroup01.c                |    2 +-
 test/zdtm/static/cgroup02.c                |    2 +-
 test/zdtm/static/cgroup03.c                |    2 +-
 test/zdtm/static/cgroup_stray.c            |    2 +-
 test/zdtm/static/cgroupns.c                |    2 +-
 test/zdtm/static/chroot-file.c             |    4 +-
 test/zdtm/static/chroot.c                  |    4 +-
 test/zdtm/static/console.c                 |    2 +-
 test/zdtm/static/cow00.desc                |    1 -
 test/zdtm/static/cow01.c                   |    2 +-
 test/zdtm/static/cwd00.c                   |    2 +-
 test/zdtm/static/cwd01.c                   |    2 +-
 test/zdtm/static/cwd02.c                   |    2 +-
 test/zdtm/static/deleted_dev.c             |    2 +-
 test/zdtm/static/deleted_unix_sock.c       |    2 +-
 test/zdtm/static/env00.c                   |    2 +-
 test/zdtm/static/fd.desc                   |    1 -
 test/zdtm/static/fdt_shared.c              |    2 +-
 test/zdtm/static/fifo-ghost.c              |    2 +-
 test/zdtm/static/fifo-rowo-pair.c          |    4 +-
 test/zdtm/static/fifo.c                    |    2 +-
 test/zdtm/static/fifo_ro.c                 |    2 +-
 test/zdtm/static/fifo_wronly.c             |    2 +-
 test/zdtm/static/file_append.c             |    2 +-
 test/zdtm/static/file_attr.c               |    6 +-
 test/zdtm/static/file_locks00.c            |   13 +-
 test/zdtm/static/file_locks01.c            |    2 +-
 test/zdtm/static/file_locks02.c            |    2 +-
 test/zdtm/static/file_locks03.c            |    2 +-
 test/zdtm/static/file_locks04.c            |    2 +-
 test/zdtm/static/file_locks05.c            |    2 +-
 test/zdtm/static/file_shared.c             |    2 +-
 test/zdtm/static/fpu01.c                   |   10 +-
 test/zdtm/static/futex.c                   |    2 +-
 test/zdtm/static/inotify00.c               |    2 +-
 test/zdtm/static/inotify02.c               |    2 +-
 test/zdtm/static/inotify02.desc            |    1 -
 test/zdtm/static/jobctl00.c                |    4 +-
 test/zdtm/static/link10.c                  |    2 +-
 test/zdtm/static/maps00.c                  |    2 +-
 test/zdtm/static/maps03.desc               |    1 -
 test/zdtm/static/maps_file_prot.c          |    2 +-
 test/zdtm/static/mem-touch.desc            |    1 -
 test/zdtm/static/mnt_ext_auto.c            |    2 +-
 test/zdtm/static/mnt_ext_master.c          |    2 +-
 test/zdtm/static/mnt_ro_bind.c             |    2 +-
 test/zdtm/static/mntns_deleted.c           |    2 +-
 test/zdtm/static/mntns_link_remap.c        |    2 +-
 test/zdtm/static/mntns_open.c              |    2 +-
 test/zdtm/static/mntns_root_bind.c         |    2 +-
 test/zdtm/static/mntns_shared_bind.c       |    2 +-
 test/zdtm/static/mntns_shared_vs_private.c |    2 +-
 test/zdtm/static/mount_paths.c             |    2 +-
 test/zdtm/static/mtime_mmap.c              |    2 +-
 test/zdtm/static/netns-nf.c                |    8 +-
 test/zdtm/static/netns-nf.desc             |    2 +-
 test/zdtm/static/netns.c                   |   15 +-
 test/zdtm/static/overmount_dev.c           |    2 +-
 test/zdtm/static/overmount_fifo.c          |    2 +-
 test/zdtm/static/overmount_file.c          |    2 +-
 test/zdtm/static/overmount_sock.c          |    2 +-
 test/zdtm/static/rmdir_open.c              |    2 +-
 test/zdtm/static/session02.c               |    2 +-
 test/zdtm/static/shm.c                     |    2 +-
 test/zdtm/static/sigpending.c              |    2 +-
 test/zdtm/static/sk-unix-rel.c             |    2 +-
 test/zdtm/static/socket_close_data01.c     |    2 +-
 test/zdtm/static/sockets00.c               |    2 +-
 test/zdtm/static/sockets_dgram.c           |    2 +-
 test/zdtm/static/tempfs.c                  |    2 +-
 test/zdtm/static/tempfs_ro.c               |    2 +-
 test/zdtm/static/tempfs_subns.c            |    2 +-
 test/zdtm/static/tty00.desc                |    1 -
 test/zdtm/static/umask00.c                 |    2 +-
 test/zdtm/static/unhashed_proc.c           |   12 +-
 test/zdtm/static/unlink_fifo.c             |    2 +-
 test/zdtm/static/unlink_fifo_wronly.c      |    2 +-
 test/zdtm/static/unlink_fstat00.c          |    2 +-
 test/zdtm/static/unlink_fstat01.c          |    2 +-
 test/zdtm/static/unlink_fstat02.c          |    2 +-
 test/zdtm/static/unlink_fstat03.c          |    2 +-
 test/zdtm/static/unlink_largefile.c        |    2 +-
 test/zdtm/static/unlink_mmap00.c           |    2 +-
 test/zdtm/static/unlink_mmap01.c           |    2 +-
 test/zdtm/static/unlink_mmap02.c           |    2 +-
 test/zdtm/static/unlink_regular00.c        |    2 +-
 test/zdtm/static/uptime_grow.desc          |    1 -
 test/zdtm/static/vfork00.desc              |    2 +-
 test/zdtm/static/vt.c                      |    2 +-
 test/zdtm/static/write_read00.c            |    2 +-
 test/zdtm/static/write_read01.c            |    2 +-
 test/zdtm/static/write_read02.c            |    7 +-
 test/zdtm/static/write_read10.c            |    2 +-
 test/zdtm/transition/Makefile              |   90 +-
 test/zdtm/transition/epoll.c               |    2 +-
 test/zdtm/transition/epoll.desc            |    1 -
 test/zdtm/transition/fifo_dyn.c            |    2 +-
 test/zdtm/transition/fifo_dyn.desc         |    1 -
 test/zdtm/transition/fifo_loop.c           |    4 +-
 test/zdtm/transition/fifo_loop.desc        |    1 -
 test/zdtm/transition/file_aio.desc         |    1 -
 test/zdtm/transition/file_read.c           |    8 +-
 test/zdtm/transition/ipc.c                 |    2 +-
 test/zdtm/transition/pipe_loop00.c         |    2 +-
 test/zdtm/transition/pipe_shared00.c       |    2 +-
 test/zdtm/transition/ptrace.c              |    2 +-
 test/zdtm/transition/ptrace.desc           |    1 -
 test/zdtm/transition/socket_loop00.c       |    2 +-
 test/zdtm/transition/socket_loop00.desc    |    1 -
 test/zdtm/transition/unix_sock.c           |    4 +-
 test/zdtm/transition/unix_sock.desc        |    1 -
 134 files changed, 2076 insertions(+), 403 deletions(-)
 create mode 100644 test/zdtm/Makefile.live
 create mode 100644 test/zdtm/Makefile.multi
 create mode 100644 test/zdtm/launcher/Makefile
 create mode 100644 test/zdtm/launcher/launcher.c
 create mode 120000 test/zdtm/lib/include/compiler.h
 create mode 100644 test/zdtm/lib/zdtmtst_internal.h
 delete mode 100644 test/zdtm/static/cow00.desc
 delete mode 100644 test/zdtm/static/fd.desc
 delete mode 100644 test/zdtm/static/inotify02.desc
 delete mode 100644 test/zdtm/static/maps03.desc
 delete mode 100644 test/zdtm/static/mem-touch.desc
 delete mode 100644 test/zdtm/static/tty00.desc
 delete mode 100644 test/zdtm/static/uptime_grow.desc
 delete mode 100644 test/zdtm/transition/epoll.desc
 delete mode 100644 test/zdtm/transition/fifo_dyn.desc
 delete mode 100644 test/zdtm/transition/fifo_loop.desc
 delete mode 100644 test/zdtm/transition/file_aio.desc
 delete mode 100644 test/zdtm/transition/ptrace.desc
 delete mode 100644 test/zdtm/transition/socket_loop00.desc
 delete mode 100644 test/zdtm/transition/unix_sock.desc

-- 
2.7.2



More information about the CRIU mailing list