[PATCH v2 7/7] Implement testing framework for pidns

Dmitry V. Levin ldv at altlinux.org
Wed Jul 22 19:06:59 UTC 2020


On Tue, Jul 21, 2020 at 11:19:25PM +0200, Ákos Uzonyi wrote:
> * tests/pidns.c: New file.
> * tests/pidns.h: New file.
> * tests/Makefile.am (libtests_a_SOURCES): Add pidns.c.
> * tests/init.sh (test_pidns, test_pidns_run_strace): New functions.
> ---
>  tests/.gitignore                              |  31 ++++
>  tests/Makefile.am                             |  37 ++++
>  tests/fcntl--pidns-translation.c              |   2 +
>  tests/fcntl-common.c                          |  88 +++++++---
>  tests/fcntl.c                                 |   1 +
>  tests/fcntl64--pidns-translation.c            |   2 +
>  tests/fcntl64.c                               |   3 +
>  tests/fork--pidns-translation.awk             |   8 +
>  tests/fork--pidns-translation.c               |  62 +++++++
>  tests/fork--pidns-translation.test            |  14 ++
>  tests/gen_tests.in                            |  28 +++
>  tests/getpgrp--pidns-translation.c            |   2 +
>  tests/getpgrp.c                               |  10 +-
>  tests/getpid--pidns-translation.c             |   2 +
>  tests/getpid.c                                |  10 +-
>  tests/getsid--pidns-translation.c             |   2 +
>  tests/getsid.c                                |  11 +-
>  tests/gettid--pidns-translation.c             |   2 +
>  tests/gettid.c                                |  10 +-
>  tests/init.sh                                 |  30 ++++
>  tests/ioctl_block--pidns-translation.c        |   2 +
>  tests/ioctl_block--pidns-translation.test     |  20 +++
>  tests/ioctl_block.c                           |  26 ++-
>  tests/ioprio--pidns-translation.c             |   2 +
>  tests/ioprio.c                                |  56 ++++--
>  tests/kcmp-yY.c                               |   2 +
>  tests/kcmp.c                                  |  13 +-
>  tests/kill--pidns-translation.c               |   2 +
>  tests/kill.c                                  |  14 +-
>  tests/migrate_pages--pidns-translation.c      |   2 +
>  tests/migrate_pages.c                         |  13 +-
>  tests/move_pages--pidns-translation.c         |   2 +
>  tests/move_pages.c                            |  53 ++++--
>  tests/net-sockaddr--pidns-translation.c       |   2 +
>  tests/net-sockaddr.c                          |  68 +++++++-
>  tests/netlink_audit--pidns-translation.c      |   2 +
>  tests/netlink_audit--pidns-translation.test   |  13 ++
>  tests/netlink_audit.c                         |  13 +-
>  tests/pidfd_open--pidns-translation.c         |   2 +
>  tests/pidfd_open.c                            |  23 ++-
>  tests/pidfd_send_signal--pidns-translation.c  |   2 +
>  tests/pidfd_send_signal.c                     |  15 +-
>  tests/pidns.c                                 | 162 ++++++++++++++++++
>  tests/pidns.h                                 |  41 +++++
>  tests/prlimit64--pidns-translation.c          |   2 +
>  tests/prlimit64.c                             |  19 +-
>  tests/process_vm_readv--pidns-translation.c   |   2 +
>  tests/process_vm_readv_writev.c               |  29 ++--
>  tests/process_vm_writev--pidns-translation.c  |   2 +
>  tests/rt_sigqueueinfo--pidns-translation.c    |   2 +
>  tests/rt_sigqueueinfo.c                       |  17 +-
>  tests/rt_tgsigqueueinfo--pidns-translation.c  |   2 +
>  tests/rt_tgsigqueueinfo.c                     |  28 ++-
>  tests/sched_xetaffinity--pidns-translation.c  |   2 +
>  tests/sched_xetaffinity.c                     |  33 ++--
>  tests/sched_xetattr--pidns-translation.c      |   2 +
>  tests/sched_xetattr.c                         |  49 +++++-
>  tests/sched_xetparam--pidns-translation.c     |   2 +
>  tests/sched_xetparam.c                        |  22 ++-
>  tests/sched_xetscheduler--pidns-translation.c |   2 +
>  tests/sched_xetscheduler.c                    |  46 +++--
>  tests/signal_receive--pidns-translation.c     |   2 +
>  tests/signal_receive.c                        |  24 ++-
>  tests/so_peercred--pidns-translation.c        |   2 +
>  tests/so_peercred.c                           |  24 +++
>  tests/xet_robust_list--pidns-translation.c    |   2 +
>  tests/xet_robust_list.c                       |  20 ++-
>  tests/xetpgid--pidns-translation.c            |   2 +
>  tests/xetpgid.c                               |  23 ++-
>  tests/xetpriority--pidns-translation.c        |   2 +
>  tests/xetpriority.c                           |  22 ++-
>  71 files changed, 1122 insertions(+), 167 deletions(-)
>  create mode 100644 tests/fcntl--pidns-translation.c
>  create mode 100644 tests/fcntl64--pidns-translation.c
>  create mode 100644 tests/fork--pidns-translation.awk
>  create mode 100644 tests/fork--pidns-translation.c
>  create mode 100755 tests/fork--pidns-translation.test
>  create mode 100644 tests/getpgrp--pidns-translation.c
>  create mode 100644 tests/getpid--pidns-translation.c
>  create mode 100644 tests/getsid--pidns-translation.c
>  create mode 100644 tests/gettid--pidns-translation.c
>  create mode 100644 tests/ioctl_block--pidns-translation.c
>  create mode 100755 tests/ioctl_block--pidns-translation.test
>  create mode 100644 tests/ioprio--pidns-translation.c
>  create mode 100644 tests/kcmp-yY.c
>  create mode 100644 tests/kill--pidns-translation.c
>  create mode 100644 tests/migrate_pages--pidns-translation.c
>  create mode 100644 tests/move_pages--pidns-translation.c
>  create mode 100644 tests/net-sockaddr--pidns-translation.c
>  create mode 100644 tests/netlink_audit--pidns-translation.c
>  create mode 100755 tests/netlink_audit--pidns-translation.test
>  create mode 100644 tests/pidfd_open--pidns-translation.c
>  create mode 100644 tests/pidfd_send_signal--pidns-translation.c
>  create mode 100644 tests/pidns.c
>  create mode 100644 tests/pidns.h
>  create mode 100644 tests/prlimit64--pidns-translation.c
>  create mode 100644 tests/process_vm_readv--pidns-translation.c
>  create mode 100644 tests/process_vm_writev--pidns-translation.c
>  create mode 100644 tests/rt_sigqueueinfo--pidns-translation.c
>  create mode 100644 tests/rt_tgsigqueueinfo--pidns-translation.c
>  create mode 100644 tests/sched_xetaffinity--pidns-translation.c
>  create mode 100644 tests/sched_xetattr--pidns-translation.c
>  create mode 100644 tests/sched_xetparam--pidns-translation.c
>  create mode 100644 tests/sched_xetscheduler--pidns-translation.c
>  create mode 100644 tests/signal_receive--pidns-translation.c
>  create mode 100644 tests/so_peercred--pidns-translation.c
>  create mode 100644 tests/xet_robust_list--pidns-translation.c
>  create mode 100644 tests/xetpgid--pidns-translation.c
>  create mode 100644 tests/xetpriority--pidns-translation.c

For me all these new tests are failing with the following diagnostics:
../../tests/pidns.c:122: unshare: Operation not permitted

This is most likely due to the following restrictions in that system:
$ cat /proc/sys/kernel/userns_restrict 
1


-- 
ldv


More information about the Strace-devel mailing list