1#!/bin/sh
2# perf all PMU test
3# SPDX-License-Identifier: GPL-2.0
4
5set -e
6
7for p in $(perf list --raw-dump pmu); do
8  echo "Testing $p"
9  result=$(perf stat -e "$p" true 2>&1)
10  if ! echo "$result" | grep -q "$p" && ! echo "$result" | grep -q "<not supported>" ; then
11    # We failed to see the event and it is supported. Possibly the workload was
12    # too small so retry with something longer.
13    result=$(perf stat -e "$p" perf bench internals synthesize 2>&1)
14    if ! echo "$result" | grep -q "$p" ; then
15      echo "Event '$p' not printed in:"
16      echo "$result"
17      exit 1
18    fi
19  fi
20done
21
22exit 0
23