~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/tools/perf/tests/shell/diff.sh

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 #!/bin/sh
  2 # perf diff tests
  3 # SPDX-License-Identifier: GPL-2.0
  4 
  5 set -e
  6 
  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"
 12 
 13 shelldir=$(dirname "$0")
 14 # shellcheck source=lib/perf_has_symbol.sh
 15 . "${shelldir}"/lib/perf_has_symbol.sh
 16 
 17 testsym="test_loop"
 18 
 19 skip_test_missing_symbol ${testsym}
 20 
 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
 28 
 29   trap - EXIT TERM INT
 30 }
 31 
 32 trap_cleanup() {
 33   cleanup
 34   exit 1
 35 }
 36 trap trap_cleanup EXIT TERM INT
 37 
 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
 45   fi
 46   if ! perf report -i "${file}" -q | grep -q "${testsym}"
 47   then
 48     echo "Workload record [Failed missing output]"
 49     echo 1
 50     return
 51   fi
 52   echo 0
 53 }
 54 
 55 test_two_files() {
 56   echo "Basic two file diff test"
 57   err=$(make_data "${perfdata1}")
 58   if [ $err != 0 ]
 59   then
 60     return
 61   fi
 62   err=$(make_data "${perfdata2}")
 63   if [ $err != 0 ]
 64   then
 65     return
 66   fi
 67 
 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
 73   fi
 74   echo "Basic two file diff test [Success]"
 75 }
 76 
 77 test_three_files() {
 78   echo "Basic three file diff test"
 79   err=$(make_data "${perfdata1}")
 80   if [ $err != 0 ]
 81   then
 82     return
 83   fi
 84   err=$(make_data "${perfdata2}")
 85   if [ $err != 0 ]
 86   then
 87     return
 88   fi
 89   err=$(make_data "${perfdata3}")
 90   if [ $err != 0 ]
 91   then
 92     return
 93   fi
 94 
 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
100   fi
101   echo "Basic three file diff test [Success]"
102 }
103 
104 test_two_files
105 test_three_files
106 
107 cleanup
108 exit $err

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php