diff --git a/README.md b/README.md index 609a16de..22582032 100644 --- a/README.md +++ b/README.md @@ -472,6 +472,10 @@ trace points in modules. It works with later and earlier kernels. event-rmap [cpu] prints the currently running events. This provides an easier answer to question Q2j in Vince Weaver's perf events FAQ. +# Testing + +The all-tester script runs all test suites. + # Mailing list Please post to the linux-perf-users@vger.kernel.org mailing list. diff --git a/all-tester b/all-tester new file mode 100755 index 00000000..3eb86033 --- /dev/null +++ b/all-tester @@ -0,0 +1,28 @@ +#!/bin/sh +# one stop shop to test all pmu-tools test suites + +set -e +set -x +PATH=$PATH:. + +# test ocperf +tester + +# test toplev +tl-tester + +# test other tools +other-tester + +# test jevents +make -C jevents +cd jevents +tester +cd .. + +# test perf.data parser +# this requires construct and pandas and some other libraries +# XXX check for missing dependencies +#cd parser +#tester +#cd .. diff --git a/other-tester b/other-tester new file mode 100755 index 00000000..90782a2d --- /dev/null +++ b/other-tester @@ -0,0 +1,66 @@ +#!/bin/sh +# tester for other programs in pmu-tools + +. ./cpumap.sh +set -e +PERF=${PERF:-perf} +failed() { + echo FAILED +} +PATH=$PATH:. +trap failed ERR 0 +set -x + +# XXX cgroup untested +for args in "" "-A" "--per-socket" "--per-core" "-r2" ; do + +# interval-normalize.py + +${PERF} stat -I100 $args -a -x, -o x.csv sleep 1 + +interval-normalize.py < x.csv +interval-normalize.py < x.csv > y.csv + +grep -q branch-misses,branches,context-switches,cpu-migrations,cycles,instructions,page-faults,stalled-cycles-backend,stalled-cycles-frontend,task-clock y.csv + +# XXX output to file + +# plot-normalized.py +#plot-normalized.py y.csv + +# interval-plot.py +#interval-plot.py < x.csv + +done + +# cputop.py + +cputop.py "socket == 0" +cputop.py "thread == 0 and socket == 0" +cputop.py "thread == 1" offline +cputop.py offline online +[ $(cputop.py True | wc -l | cut -d ' ' -f 1) -eq $(getconf _NPROCESSORS_ONLN) ] + +# list-events.py + +EVENTMAP=${cpus[hsw]} list-events.py > x.lst +[ $(wc -l x.lst | cut -d ' ' -f 1) -gt 20 ] +grep -qi rtm_retired.aborted x.lst +rm x.lst + +# event-translate.py +EVENTMAP=${cpus[hsw]} event-translate.py r4c9 | grep -q rtm_retired.aborted + +# untested: counterdiff.py + +# may need network: +# untested: event_download.py + +# need root: +# untested: msr.py +# untested: pci.py +# untested: event-rmap.py + +trap "" ERR 0 + +echo SUCCEEDED diff --git a/parser/tester b/parser/tester index 07a734c4..a8b2d11a 100755 --- a/parser/tester +++ b/parser/tester @@ -1,6 +1,11 @@ #!/bin/bash # test different variants of the perf format +failed() { + echo FAILED +} +trap failed ERR 0 + set -e set -x @@ -48,3 +53,6 @@ check -e cycles,branches,branch-misses -c 1000 # XXX sw trace points +trap "" ERR 0 + +echo SUCCEEDED diff --git a/tl-tester b/tl-tester index 55bd73d8..3b03cce2 100755 --- a/tl-tester +++ b/tl-tester @@ -5,7 +5,6 @@ # for non root set kernel.perf_event_paranoid = -1 set -e -set -x WRAP=${WRAP:-} @@ -24,6 +23,8 @@ int main() { } EOL +set -x + LOAD="-- gcc -o /dev/null hello.c" LOAD0="-- taskset -c 0 gcc -o /dev/null hello.c"