blob: e1628ac0a61401a73980f80a6f6ae2ed51d81b98 (
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
|
#!/bin/bash
# perf header tests
# SPDX-License-Identifier: GPL-2.0
set -e
err=0
perfdata=$(mktemp /tmp/__perf_test_header.perf.data.XXXXX)
script_output=$(mktemp /tmp/__perf_test_header.perf.data.XXXXX.script)
cleanup() {
rm -f "${perfdata}"
rm -f "${perfdata}".old
rm -f "${script_output}"
trap - EXIT TERM INT
}
trap_cleanup() {
echo "Unexpected signal in ${FUNCNAME[1]}"
cleanup
exit 1
}
trap trap_cleanup EXIT TERM INT
check_header_output() {
declare -a fields=(
"captured"
"hostname"
"os release"
"arch"
"cpuid"
"nrcpus"
"event"
"cmdline"
"perf version"
"sibling (cores|dies|threads)"
"sibling threads"
"total memory"
)
for i in "${fields[@]}"
do
if ! grep -q -E "$i" "${script_output}"
then
echo "Failed to find expected $i in output"
err=1
fi
done
}
test_file() {
echo "Test perf header file"
perf record -o "${perfdata}" -- perf test -w noploop
perf report --header-only -I -i "${perfdata}" > "${script_output}"
check_header_output
echo "Test perf header file [Done]"
}
test_pipe() {
echo "Test perf header pipe"
perf record -o - -- perf test -w noploop | perf report --header-only -I -i - > "${script_output}"
check_header_output
echo "Test perf header pipe [Done]"
}
test_file
test_pipe
cleanup
exit $err
|