Skip to content

Commit

Permalink
tools: add scripts for automating tests of old tool revisions
Browse files Browse the repository at this point in the history
Signed-off-by: Piotr Binkowski <[email protected]>
  • Loading branch information
Piotr Binkowski committed Oct 22, 2019
1 parent aecd429 commit be45022
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 0 deletions.
30 changes: 30 additions & 0 deletions tools/compare.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash

rm -r ./tests/generated
make generate-tests

for i in $(seq 0 $1); do
DATE=$(date --date="`date` -$i week" '+%Y-%m-%d %H:%M')

rm -r ./out/
rm -rf ./third_party/tools
git submodule update

echo $DATE

for d in ./third_party/tools/*/ ; do
pushd $d
git checkout `git rev-list -n 1 --first-parent --before="$DATE" HEAD`
popd
done

make runners -j`nproc`

make -j`nproc`

DNAME=$(date --date="`date` -$i week" '+%Y-%m-%d')

cp ./out/report/report.csv $DNAME.csv
done

./tools/csv-analyzer *.csv
35 changes: 35 additions & 0 deletions tools/csv-analyzer
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env python3

import argparse
import csv
import os

parser = argparse.ArgumentParser()

parser.add_argument("files", metavar='N', type=str, nargs='+')

args = parser.parse_args()

results = {}

for f in args.files:
name = os.path.splitext(os.path.basename(f))[0]
results[name] = {}
with open(f, newline='') as csvfile:
reader = csv.DictReader(csvfile)
runners = reader.fieldnames[3:]
for runner in runners:
results[name][runner] = 0
for row in reader:
for runner in runners:
if row[runner] == 'True':
results[name][runner] += 1

with open('out.csv', 'w', newline='') as csvfile:
writer = csv.writer(csvfile)
writer.writerow(['date', *runners])
for d in results:
row = [d]
for runner in runners:
row.append(results[d][runner])
writer.writerow(row)

0 comments on commit be45022

Please sign in to comment.