summaryrefslogtreecommitdiff
path: root/tests/init.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tests/init.sh')
-rw-r--r--tests/init.sh30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/init.sh b/tests/init.sh
index d78e697bc..524170514 100644
--- a/tests/init.sh
+++ b/tests/init.sh
@@ -387,6 +387,36 @@ test_prog_set()
test_pure_prog_set "$@" < "$srcdir/$NAME.in"
}
+test_pidns_run_strace()
+{
+ local parent_pid init_pid
+
+ check_prog tail
+ check_prog cut
+ check_prog grep
+
+ run_prog > /dev/null
+ run_strace --pidns-translation -f $@ $args > "$EXP"
+
+ # filter out logs made by the parent or init process of the pidns test
+ parent_pid="$(tail -n 2 $LOG | head -n 1 | cut -d' ' -f1)"
+ init_pid="$(tail -n 1 $LOG | cut -d' ' -f1)"
+ grep -E -v "^($parent_pid|$init_pid) " "$LOG" > "$OUT"
+ match_diff "$OUT" "$EXP"
+}
+
+test_pidns()
+{
+ check_prog unshare
+ unshare -Urpf true || framework_skip_ "unshare -Urpf true failed"
+
+ test_pidns_run_strace "$@"
+
+ # test PID translation when /proc is mounted from an other namespace
+ STRACE="unshare -Urpf $STRACE"
+ test_pidns_run_strace "$@"
+}
+
check_prog cat
check_prog rm