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

TOMOYO Linux Cross Reference
Linux/tools/perf/tests/shell/common/init.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 ] ~

Diff markup

Differences between /tools/perf/tests/shell/common/init.sh (Version linux-6.12-rc7) and /tools/perf/tests/shell/common/init.sh (Version linux-6.9.12)


  1 # SPDX-License-Identifier: GPL-2.0                  1 # SPDX-License-Identifier: GPL-2.0
  2 #                                                   2 #
  3 #       init.sh                                     3 #       init.sh
  4 #       Author: Michael Petlan <mpetlan@redhat.      4 #       Author: Michael Petlan <mpetlan@redhat.com>
  5 #                                                   5 #
  6 #       Description:                                6 #       Description:
  7 #                                                   7 #
  8 #               This file should be used for i      8 #               This file should be used for initialization of basic functions
  9 #       for checking, reporting results etc.        9 #       for checking, reporting results etc.
 10 #                                                  10 #
 11 #                                                  11 #
 12                                                    12 
 13                                                    13 
 14 . ../common/settings.sh                            14 . ../common/settings.sh
 15 . ../common/patterns.sh                            15 . ../common/patterns.sh
 16                                                    16 
 17 THIS_TEST_NAME=`basename $0 .sh`                   17 THIS_TEST_NAME=`basename $0 .sh`
 18                                                    18 
 19 _echo()                                            19 _echo()
 20 {                                                  20 {
 21         test "$TESTLOG_VERBOSITY" -ne 0 && ech     21         test "$TESTLOG_VERBOSITY" -ne 0 && echo -e "$@"
 22 }                                                  22 }
 23                                                    23 
 24 print_results()                                    24 print_results()
 25 {                                                  25 {
 26         PERF_RETVAL="$1"; shift                    26         PERF_RETVAL="$1"; shift
 27         CHECK_RETVAL="$1"; shift                   27         CHECK_RETVAL="$1"; shift
 28         FAILURE_REASON=""                          28         FAILURE_REASON=""
 29         TASK_COMMENT="$*"                      !!  29         TASK_COMMENT="$@"
 30         if [ $PERF_RETVAL -eq 0 ] && [ $CHECK_ !!  30         if [ $PERF_RETVAL -eq 0 -a $CHECK_RETVAL -eq 0 ]; then
 31                 _echo "$MPASS-- [ PASS ] --$ME     31                 _echo "$MPASS-- [ PASS ] --$MEND $TEST_NAME :: $THIS_TEST_NAME :: $TASK_COMMENT"
 32                 return 0                           32                 return 0
 33         else                                       33         else
 34                 if [ $PERF_RETVAL -ne 0 ]; the     34                 if [ $PERF_RETVAL -ne 0 ]; then
 35                         FAILURE_REASON="comman     35                         FAILURE_REASON="command exitcode"
 36                 fi                                 36                 fi
 37                 if [ $CHECK_RETVAL -ne 0 ]; th     37                 if [ $CHECK_RETVAL -ne 0 ]; then
 38                         test -n "$FAILURE_REAS     38                         test -n "$FAILURE_REASON" && FAILURE_REASON="$FAILURE_REASON + "
 39                         FAILURE_REASON="$FAILU     39                         FAILURE_REASON="$FAILURE_REASON""output regexp parsing"
 40                 fi                                 40                 fi
 41                 _echo "$MFAIL-- [ FAIL ] --$ME     41                 _echo "$MFAIL-- [ FAIL ] --$MEND $TEST_NAME :: $THIS_TEST_NAME :: $TASK_COMMENT ($FAILURE_REASON)"
 42                 return 1                           42                 return 1
 43         fi                                         43         fi
 44 }                                                  44 }
 45                                                    45 
 46 print_overall_results()                            46 print_overall_results()
 47 {                                                  47 {
 48         RETVAL="$1"; shift                         48         RETVAL="$1"; shift
 49         if [ $RETVAL -eq 0 ]; then                 49         if [ $RETVAL -eq 0 ]; then
 50                 _echo "$MALLPASS## [ PASS ] ##     50                 _echo "$MALLPASS## [ PASS ] ##$MEND $TEST_NAME :: $THIS_TEST_NAME SUMMARY"
 51         else                                       51         else
 52                 _echo "$MALLFAIL## [ FAIL ] ##     52                 _echo "$MALLFAIL## [ FAIL ] ##$MEND $TEST_NAME :: $THIS_TEST_NAME SUMMARY :: $RETVAL failures found"
 53         fi                                         53         fi
 54         return $RETVAL                             54         return $RETVAL
 55 }                                                  55 }
 56                                                    56 
 57 print_testcase_skipped()                           57 print_testcase_skipped()
 58 {                                                  58 {
 59         TASK_COMMENT="$*"                      !!  59         TASK_COMMENT="$@"
 60         _echo "$MSKIP-- [ SKIP ] --$MEND $TEST     60         _echo "$MSKIP-- [ SKIP ] --$MEND $TEST_NAME :: $THIS_TEST_NAME :: $TASK_COMMENT :: testcase skipped"
 61         return 0                                   61         return 0
 62 }                                                  62 }
 63                                                    63 
 64 print_overall_skipped()                            64 print_overall_skipped()
 65 {                                                  65 {
 66         _echo "$MSKIP## [ SKIP ] ##$MEND $TEST     66         _echo "$MSKIP## [ SKIP ] ##$MEND $TEST_NAME :: $THIS_TEST_NAME :: testcase skipped"
 67         return 0                                   67         return 0
 68 }                                                  68 }
 69                                                    69 
 70 print_warning()                                    70 print_warning()
 71 {                                                  71 {
 72         WARN_COMMENT="$*"                      !!  72         WARN_COMMENT="$@"
 73         _echo "$MWARN-- [ WARN ] --$MEND $TEST     73         _echo "$MWARN-- [ WARN ] --$MEND $TEST_NAME :: $THIS_TEST_NAME :: $WARN_COMMENT"
 74         return 0                                   74         return 0
 75 }                                                  75 }
 76                                                    76 
 77 # this function should skip a testcase if the      77 # this function should skip a testcase if the testsuite is not run in
 78 # a runmode that fits the testcase --> if the      78 # a runmode that fits the testcase --> if the suite runs in BASIC mode
 79 # all STANDARD and EXPERIMENTAL testcases will     79 # all STANDARD and EXPERIMENTAL testcases will be skipped; if the suite
 80 # runs in STANDARD mode, all EXPERIMENTAL test     80 # runs in STANDARD mode, all EXPERIMENTAL testcases will be skipped and
 81 # if the suite runs in EXPERIMENTAL mode, noth     81 # if the suite runs in EXPERIMENTAL mode, nothing is skipped
 82 consider_skipping()                                82 consider_skipping()
 83 {                                                  83 {
 84         TESTCASE_RUNMODE="$1"                      84         TESTCASE_RUNMODE="$1"
 85         # the runmode of a testcase needs to b     85         # the runmode of a testcase needs to be at least the current suite's runmode
 86         if [ $PERFTOOL_TESTSUITE_RUNMODE -lt $     86         if [ $PERFTOOL_TESTSUITE_RUNMODE -lt $TESTCASE_RUNMODE ]; then
 87                 print_overall_skipped              87                 print_overall_skipped
 88                 exit 0                             88                 exit 0
 89         fi                                         89         fi
 90 }                                                  90 }
 91                                                    91 
 92 detect_baremetal()                                 92 detect_baremetal()
 93 {                                                  93 {
 94         # return values:                           94         # return values:
 95         # 0 = bare metal                           95         # 0 = bare metal
 96         # 1 = virtualization detected              96         # 1 = virtualization detected
 97         # 2 = unknown state                        97         # 2 = unknown state
 98         VIRT=`systemd-detect-virt 2>/dev/null`     98         VIRT=`systemd-detect-virt 2>/dev/null`
 99         test $? -eq 127 && return 2                99         test $? -eq 127 && return 2
100         test "$VIRT" = "none"                     100         test "$VIRT" = "none"
101 }                                                 101 }
102                                                   102 
103 detect_intel()                                    103 detect_intel()
104 {                                                 104 {
105         # return values:                          105         # return values:
106         # 0 = is Intel                            106         # 0 = is Intel
107         # 1 = is not Intel or unknown             107         # 1 = is not Intel or unknown
108         grep "vendor_id" < /proc/cpuinfo | gre    108         grep "vendor_id" < /proc/cpuinfo | grep -q "GenuineIntel"
109 }                                                 109 }
110                                                   110 
111 detect_amd()                                      111 detect_amd()
112 {                                                 112 {
113         # return values:                          113         # return values:
114         # 0 = is AMD                              114         # 0 = is AMD
115         # 1 = is not AMD or unknown               115         # 1 = is not AMD or unknown
116         grep "vendor_id" < /proc/cpuinfo | gre    116         grep "vendor_id" < /proc/cpuinfo | grep -q "AMD"
117 }                                              << 
118                                                << 
119 # base probe utility                           << 
120 check_kprobes_available()                      << 
121 {                                              << 
122         test -e /sys/kernel/debug/tracing/kpro << 
123 }                                              << 
124                                                << 
125 check_uprobes_available()                      << 
126 {                                              << 
127         test -e /sys/kernel/debug/tracing/upro << 
128 }                                              << 
129                                                << 
130 clear_all_probes()                             << 
131 {                                              << 
132         echo 0 > /sys/kernel/debug/tracing/eve << 
133         check_kprobes_available && echo > /sys << 
134         check_uprobes_available && echo > /sys << 
135 }                                              << 
136                                                << 
137 check_sdt_support()                            << 
138 {                                              << 
139         $CMD_PERF list sdt | grep sdt > /dev/n << 
140 }                                                 117 }
                                                      

~ [ 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