162306a36Sopenharmony_ci#!/bin/sh 262306a36Sopenharmony_ci# perf all PMU test 362306a36Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0 462306a36Sopenharmony_ci 562306a36Sopenharmony_ciset -e 662306a36Sopenharmony_ci 762306a36Sopenharmony_ci# Test all PMU events; however exclude parametrized ones (name contains '?') 862306a36Sopenharmony_cifor p in $(perf list --raw-dump pmu | sed 's/[[:graph:]]\+?[[:graph:]]\+[[:space:]]//g'); do 962306a36Sopenharmony_ci echo "Testing $p" 1062306a36Sopenharmony_ci result=$(perf stat -e "$p" true 2>&1) 1162306a36Sopenharmony_ci if ! echo "$result" | grep -q "$p" && ! echo "$result" | grep -q "<not supported>" ; then 1262306a36Sopenharmony_ci # We failed to see the event and it is supported. Possibly the workload was 1362306a36Sopenharmony_ci # too small so retry with something longer. 1462306a36Sopenharmony_ci result=$(perf stat -e "$p" perf bench internals synthesize 2>&1) 1562306a36Sopenharmony_ci if ! echo "$result" | grep -q "$p" ; then 1662306a36Sopenharmony_ci echo "Event '$p' not printed in:" 1762306a36Sopenharmony_ci echo "$result" 1862306a36Sopenharmony_ci exit 1 1962306a36Sopenharmony_ci fi 2062306a36Sopenharmony_ci fi 2162306a36Sopenharmony_cidone 2262306a36Sopenharmony_ci 2362306a36Sopenharmony_ciexit 0 24