1#!/bin/bash 2# perf metrics value validation 3# SPDX-License-Identifier: GPL-2.0 4 5shelldir=$(dirname "$0") 6# shellcheck source=lib/setup_python.sh 7. "${shelldir}"/lib/setup_python.sh 8 9grep -q GenuineIntel /proc/cpuinfo || { echo Skipping non-Intel; exit 2; } 10 11pythonvalidator=$(dirname $0)/lib/perf_metric_validation.py 12rulefile=$(dirname $0)/lib/perf_metric_validation_rules.json 13tmpdir=$(mktemp -d /tmp/__perf_test.program.XXXXX) 14workload="perf bench futex hash -r 2 -s" 15 16# Add -debug, save data file and full rule file 17echo "Launch python validation script $pythonvalidator" 18echo "Output will be stored in: $tmpdir" 19for cputype in /sys/bus/event_source/devices/cpu_*; do 20 cputype=$(basename "$cputype") 21 echo "Testing metrics for: $cputype" 22 $PYTHON $pythonvalidator -rule $rulefile -output_dir $tmpdir -wl "${workload}" \ 23 -cputype "${cputype}" 24 ret=$? 25 rm -rf $tmpdir 26 if [ $ret -ne 0 ]; then 27 echo "Metric validation return with errors. Please check metrics reported with errors." 28 fi 29done 30exit $ret 31 32