blob: ee53b411a5d7ae7be97f90d568c0f6ef0acc1248 (
plain)
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
|
#!/bin/sh
# Check how strace -e abbrev=set, -e raw=set, -e trace=set,
# and -e verbose=set work.
#
# Copyright (c) 2014-2022 The strace developers.
# All rights reserved.
#
# SPDX-License-Identifier: GPL-2.0-or-later
. "${srcdir=.}/init.sh"
run_prog ../umovestr
pattern_abbrev_verbose='execve("\.\./umovestr", \["\.\./umovestr"\], 0x[[:xdigit:]]* /\* [[:digit:]]* vars \*/) = 0'
pattern_nonabbrev_verbose='execve("\.\./umovestr", \["\.\./umovestr"\], \[".*\"\(\.\.\.\)\?\]) = 0'
pattern_nonverbose='execve("\.\./umovestr", 0x[[:xdigit:]]*, 0x[[:xdigit:]]*) = 0'
pattern_raw='execve(0x[[:xdigit:]]*, 0x[[:xdigit:]]*, 0x[[:xdigit:]]*) = 0'
case "$STRACE_ARCH" in
ia64) valid_scno=1068 ;;
*) valid_scno=42 ;;
esac
check_output_mismatch()
{
local pattern
pattern="$1"; shift
run_strace "$@" ../umovestr
LC_ALL=C grep -x "$pattern" "$LOG" > /dev/null || {
printf '%s\n%s\n' \
'Failed patterns of expected output:' "$pattern"
dump_log_and_fail_with "$STRACE $args output mismatch"
}
}
check_execve_output_mismatch()
{
local what how
what="$1"; shift
how="$1"; shift
check_output_mismatch "$@" -e "$what=$how" -e execve
check_output_mismatch "$@" "--$what=$how" --trace=execve
}
check_output_mismatch "$pattern_abbrev_verbose" -e execve
LC_ALL=C grep -v -x "$pattern_abbrev_verbose" "$LOG" |
LC_ALL=C grep '^[[:alnum:]_]*(' > /dev/null &&
dump_log_and_fail_with "$STRACE $args unexpected output"
check_output_mismatch "$pattern_abbrev_verbose" -e trace=%process
LC_ALL=C grep '^chdir' "$LOG" > /dev/null &&
dump_log_and_fail_with "$STRACE $args unexpected output"
run_strace -e $valid_scno ../umovestr
LC_ALL=C grep '^[[:alnum:]_]*(' "$LOG" > /dev/null &&
dump_log_and_fail_with "$STRACE $args unexpected output"
run_strace -e/ -e$valid_scno ../umovestr
LC_ALL=C grep '^[[:alnum:]_]*(' "$LOG" > /dev/null &&
dump_log_and_fail_with "$STRACE $args unexpected output"
for a in execve \!chdir /. all \!none \
file process \!desc \!ipc \!memory \!network \!signal; do
check_execve_output_mismatch abbrev "$a" "$pattern_abbrev_verbose"
check_execve_output_mismatch raw "$a" "$pattern_raw"
check_execve_output_mismatch verbose "$a" "$pattern_abbrev_verbose"
done
for a in \!execve chdir $valid_scno \!all none \
\!file \!process desc ipc memory network signal; do
check_execve_output_mismatch abbrev "$a" "$pattern_nonabbrev_verbose"
check_execve_output_mismatch raw "$a" "$pattern_abbrev_verbose"
check_execve_output_mismatch verbose "$a" "$pattern_nonverbose" --columns=31
done
exit 0
|