times.sh: create a variable which can be changed to alter the iterations/how often we run cppcheck on one commit (default: 4).

This commit is contained in:
Matthias Krüger 2014-08-31 11:10:55 +02:00
parent 862b18e0e2
commit 7784bbfa86
1 changed files with 3 additions and 3 deletions

View File

@ -6,7 +6,7 @@ mkdir -p src || exit 1
cp lib/* src/ || exit 2 # fill src/ with some source code
#NOTE: also try with some files other then from cppcheck!
iterations=4
# if "old" already exists for some reason, do NOT work on current branch but bail out
git checkout -b old || exit
@ -20,10 +20,10 @@ for i in `seq 1 50`; do
# if build fails, make clean and try again
make SRCDIR=build CXXFLAGS=-O2 -j4 || make clean ; make SRCDIR=build CXXFLAGS=-O2 -j4
echo "Run number $i"
for j in `seq 1 4`; do
for j in `seq 1 ${iterations}`; do
./cppcheck --quiet --showtime=summary --enable=all --inconclusive src 2> /dev/null | tee -a times.log
done
grep "Overall" times.log | tail -4 | sed s/s// | awk -v "i=$i" -v "git_head=$git_head" '{ sum+=$3} END {print "Run " i", "git_head " Average: " sum/4}' | tee -a times.log
grep "Overall" times.log | tail -${iterations} | sed s/s// | awk -v "i=$i" -v "iterations=$iterations" -v "git_head=$git_head" '{ sum+=$3} END {print "Run " i", "git_head " Average: " sum/iterations}' | tee -a times.log
git reset --hard HEAD^1 | tee -a times.log
done