brintos

brintos / linux-shallow public Read only

0
0
Text · 1.2 KiB · 4d004f7 Raw
52 lines · bash
1#!/bin/sh2# perf all libpfm4 events test3# SPDX-License-Identifier: GPL-2.04 5if perf version --build-options | grep HAVE_LIBPFM | grep -q OFF6then7  echo "Skipping, no libpfm4 support"8  exit 29fi10 11err=012for p in $(perf list --raw-dump pfm)13do14  if echo "$p" | grep -q unc_15  then16    echo "Skipping uncore event '$p' that may require additional options."17    continue18  fi19  echo "Testing $p"20  result=$(perf stat --pfm-events "$p" true 2>&1)21  x=$?22  if echo "$result" | grep -q "failed to parse event $p : invalid or missing unit mask"23  then24    continue25  fi26  if test "$x" -ne "0"27  then28    echo "Unexpected exit code '$x'"29    err=130  fi31  if ! echo "$result" | grep -q "$p" && ! echo "$result" | grep -q "<not supported>"32  then33    # We failed to see the event and it is supported. Possibly the workload was34    # too small so retry with something longer.35    result=$(perf stat --pfm-events "$p" perf bench internals synthesize 2>&1)36    x=$?37    if test "$x" -ne "0"38    then39      echo "Unexpected exit code '$x'"40      err=141    fi42    if ! echo "$result" | grep -q "$p"43    then44      echo "Event '$p' not printed in:"45      echo "$result"46      err=147    fi48  fi49done50 51exit "$err"52