diff options
author | Ákos Uzonyi <uzonyi.akos@gmail.com> | 2020-07-11 17:29:58 +0200 |
---|---|---|
committer | Dmitry V. Levin <ldv@altlinux.org> | 2020-08-25 14:29:30 +0000 |
commit | f350ce0ffa5e25179c8c782045a8462b2946ead4 (patch) | |
tree | 3dc7be840d264c14c9ade7dc76d60d51206bc91e /tests/prlimit64.c | |
parent | 7ecee07bbcdc54e97a6ff8e8ea84e440f2872bea (diff) | |
download | strace-f350ce0ffa5e25179c8c782045a8462b2946ead4.tar.gz |
Add tests for PID namespace translationAkosUzonyi/pidns
* Makefile.am (CODE_COVERAGE_IGNORE_PATTERN): Add test directories.
* tests/.gitignore: Add new test executables.
* tests/Makefile.am (check_PROGRAMS): Add new test executables.
(DECODER_TESTS) Add new test files.
(libtests_a_SOURCES): Add trie_for_tests.c, xmalloc_for_tests.c.
* tests/gen_tests.in: Add new tests.
* tests/trie_test.c: New file.
* tests/trie_for_tests.c: New file.
* tests/xmalloc_for_tests.c: New file.
* tests/pidns-cache.c: New file.
* tests/pidns-cache.test: New file.
* tests/fcntl--pidns-translation.c: New file.
* tests/fcntl64--pidns-translation.c: New file.
* tests/fork--pidns-translation.awk: New file.
* tests/fork--pidns-translation.c: New file.
* tests/fork--pidns-translation.test: New file.
* tests/getpgrp--pidns-translation.c: New file.
* tests/getpid--pidns-translation.c: New file.
* tests/getsid--pidns-translation.c: New file.
* tests/gettid--pidns-translation.c: New file.
* tests/gettid--pidns-translation.test: New file.
* tests/ioctl_block--pidns-translation.c: New file.
* tests/ioctl_block--pidns-translation.test: New file.
* tests/ioprio--pidns-translation.c: New file.
* tests/kill--pidns-translation.c: New file.
* tests/migrate_pages--pidns-translation.c: New file.
* tests/move_pages--pidns-translation.c: New file.
* tests/net-sockaddr--pidns-translation.c: New file.
* tests/netlink_audit--pidns-translation.c: New file.
* tests/netlink_audit--pidns-translation.test: New file.
* tests/pidfd_open--pidns-translation.c: New file.
* tests/pidfd_send_signal--pidns-translation.c: New file.
* tests/prlimit64--pidns-translation.c: New file.
* tests/process_vm_readv--pidns-translation.c: New file.
* tests/process_vm_writev--pidns-translation.c: New file.
* tests/rt_sigqueueinfo--pidns-translation.c: New file.
* tests/rt_tgsigqueueinfo--pidns-translation.c: New file.
* tests/sched_xetaffinity--pidns-translation.c: New file.
* tests/sched_xetattr--pidns-translation.c: New file.
* tests/sched_xetparam--pidns-translation.c: New file.
* tests/sched_xetscheduler--pidns-translation.c: New file.
* tests/signal_receive--pidns-translation.c: New file.
* tests/so_peercred--pidns-translation.c: New file.
* tests/tkill--pidns-translation.c: New file.
* tests/tgkill--pidns-translation.c: New file.
* tests/xet_robust_list--pidns-translation.c: New file.
* tests/xetpgid--pidns-translation.c: New file.
* tests/xetpriority--pidns-translation.c: New file.
* tests/fcntl-common.c: Print PID translation string after PIDs.
* tests/fcntl.c: Likewise.
* tests/fcntl64.c: Likewise.
* tests/getpgrp.c: Likewise.
* tests/getpid.c: Likewise.
* tests/getsid.c: Likewise.
* tests/gettid.c: Likewise.
* tests/ioctl_block.c: Likewise.
* tests/ioprio.c: Likewise.
* tests/kcmp.c: Likewise.
* tests/kill.c: Likewise.
* tests/migrate_pages.c: Likewise.
* tests/move_pages.c: Likewise.
* tests/net-sockaddr.c: Likewise.
* tests/netlink_audit.c: Likewise.
* tests/pidfd_open.c: Likewise.
* tests/pidfd_send_signal.c: Likewise.
* tests/prlimit64.c: Likewise.
* tests/process_vm_readv_writev.c: Likewise.
* tests/rt_sigqueueinfo.c: Likewise.
* tests/rt_tgsigqueueinfo.c: Likewise.
* tests/sched_xetaffinity.c: Likewise.
* tests/sched_xetattr.c: Likewise.
* tests/sched_xetparam.c: Likewise.
* tests/sched_xetscheduler.c: Likewise.
* tests/signal_receive.c: Likewise.
* tests/so_peercred.c: Likewise.
* tests/tgkill.c: Likewise.
* tests/tkill.c: Likewise.
* tests/xet_robust_list.c: Likewise.
* tests/xetpgid.c: Likewise.
* tests/xetpriority.c: Likewise.
Diffstat (limited to 'tests/prlimit64.c')
-rw-r--r-- | tests/prlimit64.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/tests/prlimit64.c b/tests/prlimit64.c index 34201a2b8..bc1a80b36 100644 --- a/tests/prlimit64.c +++ b/tests/prlimit64.c @@ -19,6 +19,7 @@ # include <sys/resource.h> # include <unistd.h> +# include "pidns.h" # include "xlat.h" # include "xlat/resources.h" @@ -42,8 +43,11 @@ sprint_rlim(uint64_t lim) int main(void) { + PIDNS_TEST_INIT; + unsigned long pid = (unsigned long) 0xdefaced00000000ULL | (unsigned) getpid(); + const char *pid_str = pidns_pid2str(PT_TGID); uint64_t *const rlimit = tail_alloc(sizeof(*rlimit) * 2); const struct xlat_data *xlat; size_t i = 0; @@ -54,18 +58,23 @@ main(void) unsigned long res = 0xfacefeed00000000ULL | xlat->val; long rc = syscall(__NR_prlimit64, pid, res, 0, rlimit); + pidns_print_leader(); if (rc) - printf("prlimit64(%d, %s, NULL, %p) = %ld %s (%m)\n", - (unsigned) pid, xlat->str, rlimit, + printf("prlimit64(%d%s, %s, NULL, %p) =" + " %ld %s (%m)\n", + (unsigned) pid, pid_str, + xlat->str, rlimit, rc, errno2name()); else - printf("prlimit64(%d, %s, NULL" + printf("prlimit64(%d%s, %s, NULL" ", {rlim_cur=%s, rlim_max=%s}) = 0\n", - (unsigned) pid, xlat->str, + (unsigned) pid, pid_str, + xlat->str, sprint_rlim(rlimit[0]), sprint_rlim(rlimit[1])); } + pidns_print_leader(); puts("+++ exited with 0 +++"); return 0; } |