drm/rockchip: Don't change hdmi reference clock rate
[drm/drm-misc.git] / tools / perf / tests / shell / diff.sh
blob14b87af88703b09ab7eca336bf6314a0249d3beb
1 #!/bin/sh
2 # perf diff tests
3 # SPDX-License-Identifier: GPL-2.0
5 set -e
7 err=0
8 perfdata1=$(mktemp /tmp/__perf_test.perf.data.XXXXX)
9 perfdata2=$(mktemp /tmp/__perf_test.perf.data.XXXXX)
10 perfdata3=$(mktemp /tmp/__perf_test.perf.data.XXXXX)
11 testprog="perf test -w thloop"
13 shelldir=$(dirname "$0")
14 # shellcheck source=lib/perf_has_symbol.sh
15 . "${shelldir}"/lib/perf_has_symbol.sh
17 testsym="test_loop"
19 skip_test_missing_symbol ${testsym}
21 cleanup() {
22 rm -rf "${perfdata1}"
23 rm -rf "${perfdata1}".old
24 rm -rf "${perfdata2}"
25 rm -rf "${perfdata2}".old
26 rm -rf "${perfdata3}"
27 rm -rf "${perfdata3}".old
29 trap - EXIT TERM INT
32 trap_cleanup() {
33 cleanup
34 exit 1
36 trap trap_cleanup EXIT TERM INT
38 make_data() {
39 file="$1"
40 if ! perf record -o "${file}" ${testprog} 2> /dev/null
41 then
42 echo "Workload record [Failed record]"
43 echo 1
44 return
46 if ! perf report -i "${file}" -q | grep -q "${testsym}"
47 then
48 echo "Workload record [Failed missing output]"
49 echo 1
50 return
52 echo 0
55 test_two_files() {
56 echo "Basic two file diff test"
57 err=$(make_data "${perfdata1}")
58 if [ $err != 0 ]
59 then
60 return
62 err=$(make_data "${perfdata2}")
63 if [ $err != 0 ]
64 then
65 return
68 if ! perf diff "${perfdata1}" "${perfdata2}" | grep -q "${testsym}"
69 then
70 echo "Basic two file diff test [Failed diff]"
71 err=1
72 return
74 echo "Basic two file diff test [Success]"
77 test_three_files() {
78 echo "Basic three file diff test"
79 err=$(make_data "${perfdata1}")
80 if [ $err != 0 ]
81 then
82 return
84 err=$(make_data "${perfdata2}")
85 if [ $err != 0 ]
86 then
87 return
89 err=$(make_data "${perfdata3}")
90 if [ $err != 0 ]
91 then
92 return
95 if ! perf diff "${perfdata1}" "${perfdata2}" "${perfdata3}" | grep -q "${testsym}"
96 then
97 echo "Basic three file diff test [Failed diff]"
98 err=1
99 return
101 echo "Basic three file diff test [Success]"
104 test_two_files
105 test_three_files
107 cleanup
108 exit $err