1 # SPDX-License-Identifier: GPL-2.0
4 # Author: Michael Petlan <mpetlan@redhat.com>
8 # This file should be used for initialization of basic functions
9 # for checking, reporting results etc.
14 . ..
/common
/settings.sh
15 . ..
/common
/patterns.sh
17 THIS_TEST_NAME
=`basename $0 .sh`
21 test "$TESTLOG_VERBOSITY" -ne 0 && echo -e "$@"
26 PERF_RETVAL
="$1"; shift
27 CHECK_RETVAL
="$1"; shift
30 if [ $PERF_RETVAL -eq 0 ] && [ $CHECK_RETVAL -eq 0 ]; then
31 _echo
"$MPASS-- [ PASS ] --$MEND $TEST_NAME :: $THIS_TEST_NAME :: $TASK_COMMENT"
34 if [ $PERF_RETVAL -ne 0 ]; then
35 FAILURE_REASON
="command exitcode"
37 if [ $CHECK_RETVAL -ne 0 ]; then
38 test -n "$FAILURE_REASON" && FAILURE_REASON
="$FAILURE_REASON + "
39 FAILURE_REASON
="$FAILURE_REASON""output regexp parsing"
41 _echo
"$MFAIL-- [ FAIL ] --$MEND $TEST_NAME :: $THIS_TEST_NAME :: $TASK_COMMENT ($FAILURE_REASON)"
46 print_overall_results
()
49 if [ $RETVAL -eq 0 ]; then
50 _echo
"$MALLPASS## [ PASS ] ##$MEND $TEST_NAME :: $THIS_TEST_NAME SUMMARY"
52 _echo
"$MALLFAIL## [ FAIL ] ##$MEND $TEST_NAME :: $THIS_TEST_NAME SUMMARY :: $RETVAL failures found"
57 print_testcase_skipped
()
60 _echo
"$MSKIP-- [ SKIP ] --$MEND $TEST_NAME :: $THIS_TEST_NAME :: $TASK_COMMENT :: testcase skipped"
64 print_overall_skipped
()
66 _echo
"$MSKIP## [ SKIP ] ##$MEND $TEST_NAME :: $THIS_TEST_NAME :: testcase skipped"
73 _echo
"$MWARN-- [ WARN ] --$MEND $TEST_NAME :: $THIS_TEST_NAME :: $WARN_COMMENT"
77 # this function should skip a testcase if the testsuite is not run in
78 # a runmode that fits the testcase --> if the suite runs in BASIC mode
79 # all STANDARD and EXPERIMENTAL testcases will be skipped; if the suite
80 # runs in STANDARD mode, all EXPERIMENTAL testcases will be skipped and
81 # if the suite runs in EXPERIMENTAL mode, nothing is skipped
85 # the runmode of a testcase needs to be at least the current suite's runmode
86 if [ $PERFTOOL_TESTSUITE_RUNMODE -lt $TESTCASE_RUNMODE ]; then
96 # 1 = virtualization detected
98 VIRT
=`systemd-detect-virt 2>/dev/null`
99 test $?
-eq 127 && return 2
100 test "$VIRT" = "none"
107 # 1 = is not Intel or unknown
108 grep "vendor_id" < /proc
/cpuinfo |
grep -q "GenuineIntel"
115 # 1 = is not AMD or unknown
116 grep "vendor_id" < /proc
/cpuinfo |
grep -q "AMD"
120 check_kprobes_available
()
122 test -e /sys
/kernel
/debug
/tracing
/kprobe_events
125 check_uprobes_available
()
127 test -e /sys
/kernel
/debug
/tracing
/uprobe_events
132 echo 0 > /sys
/kernel
/debug
/tracing
/events
/enable
133 check_kprobes_available
&& echo > /sys
/kernel
/debug
/tracing
/kprobe_events
134 check_uprobes_available
&& echo > /sys
/kernel
/debug
/tracing
/uprobe_events
139 $CMD_PERF list sdt |
grep sdt
> /dev
/null
2> /dev
/null