1#!/bin/bash
2# perf metrics value validation
3# SPDX-License-Identifier: GPL-2.0
4if [ "x$PYTHON" == "x" ]
5then
6	if which python3 > /dev/null
7	then
8		PYTHON=python3
9	else
10		echo Skipping test, python3 not detected please set environment variable PYTHON.
11		exit 2
12	fi
13fi
14
15grep -q GenuineIntel /proc/cpuinfo || { echo Skipping non-Intel; exit 2; }
16
17pythonvalidator=$(dirname $0)/lib/perf_metric_validation.py
18rulefile=$(dirname $0)/lib/perf_metric_validation_rules.json
19tmpdir=$(mktemp -d /tmp/__perf_test.program.XXXXX)
20workload="perf bench futex hash -r 2 -s"
21
22# Add -debug, save data file and full rule file
23echo "Launch python validation script $pythonvalidator"
24echo "Output will be stored in: $tmpdir"
25$PYTHON $pythonvalidator -rule $rulefile -output_dir $tmpdir -wl "${workload}"
26ret=$?
27rm -rf $tmpdir
28
29exit $ret
30
31