File: strace-DDD.test

package info (click to toggle)
strace 6.1-0.1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 64,424 kB
  • sloc: ansic: 160,349; sh: 9,223; makefile: 3,817; cpp: 944; awk: 353; perl: 267; exp: 62; sed: 9
file content (93 lines) | stat: -rwxr-xr-x 2,227 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#!/bin/sh -efu
#
# Check -DDD option.
#
# Copyright (c) 2019-2020 Dmitry V. Levin <ldv@strace.io>
# All rights reserved.
#
# SPDX-License-Identifier: GPL-2.0-or-later

. "${srcdir=.}/init.sh"

check_prog sed
run_prog_skip_if_failed \
	kill -0 $$

status_file=/proc/self/status
[ -f "$status_file" ] ||
	framework_skip_ "$status_file is not available"

stat_file=/proc/self/stat
[ -f "$stat_file" ] ||
	framework_skip_ "$stat_file is not available"

reapid="$(../get_process_reaper)" && [ "$reapid" -ge 1 ] ||
	fail_ 'get_process_reaper failed'

set -- -enone -esignal=none ../tracer_ppid_pgid_sid
run_strace "$@" > "$OUT"
read -r tracer_pid ppid pgid sid < "$OUT" &&
[ "$tracer_pid" -gt 1 ] &&
[ "$tracer_pid" -ne "$reapid" ] &&
[ "$ppid" -gt 1 ] &&
[ "$ppid" -ne "$reapid" ] &&
[ "$pgid" -ge 0 ] &&
[ "$sid" -ge 0 ] || {
	cat < "$OUT" > "$LOG"
	dump_log_and_fail_with "$STRACE $args: unexpected output"
}
match_diff

pgid0="$pgid"
sid0="$sid"

run_strace -D "$@" > "$OUT"
read -r tracer_pid ppid pgid sid < "$OUT" &&
[ "$tracer_pid" -gt 1 ] &&
[ "$tracer_pid" -ne "$reapid" ] &&
[ "$ppid" -eq "$reapid" ] &&
[ "$pgid" = "$pgid0" ] &&
[ "$sid" = "$sid0" ] || {
	cat < "$OUT" > "$LOG"
	dump_log_and_fail_with "$STRACE $args: unexpected output"
}
while kill -0 "$tracer_pid" 2> /dev/null; do
	$SLEEP_A_BIT
done
match_diff

run_strace -DD "$@" > "$OUT"
read -r tracer_pid ppid pgid sid < "$OUT" &&
[ "$tracer_pid" -gt 1 ] &&
[ "$tracer_pid" -ne "$reapid" ] &&
[ "$ppid" -eq "$reapid" ] &&
[ "$pgid" -gt 1 ] &&
[ "$pgid" -ne "$reapid" ] &&
[ "$pgid" != "$pgid0" ] &&
[ "$pgid" != "$sid" ] &&
[ "$sid" = "$sid0" ] || {
	cat < "$OUT" > "$LOG"
	dump_log_and_fail_with "$STRACE $args: unexpected output"
}
while kill -0 "$tracer_pid" 2> /dev/null; do
	$SLEEP_A_BIT
done
match_diff

run_strace -DDD "$@" > "$OUT"
read -r tracer_pid ppid pgid sid < "$OUT" &&
[ "$tracer_pid" -gt 1 ] &&
[ "$tracer_pid" -ne "$reapid" ] &&
[ "$ppid" -eq "$reapid" ] &&
[ "$pgid" -gt 1 ] &&
[ "$pgid" -ne "$reapid" ] &&
[ "$pgid" != "$pgid0" ] &&
[ "$sid" = "$pgid" ] &&
[ "$sid" != "$sid0" ] || {
	cat < "$OUT" > "$LOG"
	dump_log_and_fail_with "$STRACE $args: unexpected output"
}
while kill -0 "$tracer_pid" 2> /dev/null; do
	$SLEEP_A_BIT
done
match_diff