1#!/bin/sh 2# perf all metrics test 3# SPDX-License-Identifier: GPL-2.0 4 5set -e 6 7err=0 8for m in $(perf list --raw-dump metrics); do 9 echo "Testing $m" 10 result=$(perf stat -M "$m" true 2>&1) 11 if [[ ! "$result" =~ "$m" ]] && [[ ! "$result" =~ "<not supported>" ]]; then 12 # We failed to see the metric and the events are support. Possibly the 13 # workload was too small so retry with something longer. 14 result=$(perf stat -M "$m" perf bench internals synthesize 2>&1) 15 if [[ ! "$result" =~ "$m" ]]; then 16 echo "Metric '$m' not printed in:" 17 echo "$result" 18 if [[ "$result" =~ "FP_ARITH" && "$err" != "1" ]]; then 19 echo "Skip, not fail, for FP issues" 20 err=2 21 else 22 err=1 23 fi 24 fi 25 fi 26done 27 28exit "$err" 29