Skip to content

Commit

Permalink
Improve test suites
Browse files Browse the repository at this point in the history
Add all-tester script to call all testers (except the parser tester for
now)

Add other-tester for testing interval-normalize and cputop and
list-events

Make test scripts slightly less verbose
  • Loading branch information
Andi Kleen committed Oct 10, 2015
1 parent b532d64 commit 6e66f83
Show file tree
Hide file tree
Showing 5 changed files with 108 additions and 1 deletion.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
28 changes: 28 additions & 0 deletions all-tester
Original file line number Diff line number Diff line change
@@ -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 ..
66 changes: 66 additions & 0 deletions other-tester
Original file line number Diff line number Diff line change
@@ -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
8 changes: 8 additions & 0 deletions parser/tester
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
#!/bin/bash
# test different variants of the perf format

failed() {
echo FAILED
}
trap failed ERR 0

set -e
set -x

Expand Down Expand Up @@ -48,3 +53,6 @@ check -e cycles,branches,branch-misses -c 1000

# XXX sw trace points

trap "" ERR 0

echo SUCCEEDED
3 changes: 2 additions & 1 deletion tl-tester
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
# for non root set kernel.perf_event_paranoid = -1

set -e
set -x

WRAP=${WRAP:-}

Expand All @@ -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"

Expand Down

0 comments on commit 6e66f83

Please sign in to comment.