3 # SPDX-License-Identifier: GPL-2.0
5 # Check that the last events of a perf trace'd subprocess are not
6 # lost. Specifically, trace the exiting syscall of "true" 10 times and ensure
7 # the output contains 10 correct lines.
9 # shellcheck source=lib/probe.sh
10 .
"$(dirname $0)"/lib
/probe.sh
12 skip_if_no_perf_trace ||
exit 2
14 if [ "$1" = "-v" ]; then
19 regexp
=" +[0-9]+\.[0-9]+ [0-9]+ syscalls:sys_enter_exit_group\(\)$"
21 trace_shutdown_race
() {
22 for _
in $
(seq $iter); do
23 perf trace
--no-comm -e syscalls
:sys_enter_exit_group true
2>>$file
25 result
="$(grep -c -E "$regexp" $file)"
30 file=$
(mktemp
/tmp
/temporary_file.XXXXX
)
32 # Do not use whatever ~/.perfconfig file, it may change the output
33 # via trace.{show_timestamp,show_prefix,etc}
34 export PERF_CONFIG
=/dev
/null
39 if [ $err != 0 ] && [ "${verbose}" = "1" ]; then
40 lines_not_matching
=$
(mktemp
/tmp
/temporary_file.XXXXX
)
41 if grep -v -E "$regexp" $file > $lines_not_matching ; then
42 echo "Lines not matching the expected regexp: '$regexp':"
43 cat $lines_not_matching
45 echo "Missing output, expected $iter but only got $result"
47 rm -f $lines_not_matching