Skip to content

Instantly share code, notes, and snippets.

@julianhyde
Created December 7, 2012 17:58
Show Gist options
  • Save julianhyde/4235092 to your computer and use it in GitHub Desktop.
Save julianhyde/4235092 to your computer and use it in GitHub Desktop.
Script to compare runs of Mondrian's test suite, to see which test failures have been fixed or introduced
#!/bin/bash
#
# megex - Archives megatest.log (the output from a run of
# mondrian/bin/megatest) to megatest.n.log, and generates
# megatest.n.summary.log, which contains one line for each test
# error/failure.
#
# Determines 'n' to be after all other megatest.n.log files in the
# current directory.
#
# You can compare runs using diff:
#
# diff megatest.{23,25}.log
function testExceptions() {
awk '
/^ \[java\] [0-9]+) / {
s = $0;
gsub(/[^)]*) /, "", s);
gsub(/).*$/, "", s);
split(s, a, /\(/)
print a[2] "." a[1]
}
' |
LC_ALL=C sort -t .
}
function main() {
if [ ! -f megatest.log ]; then
echo "megex: No megatest.log. Aborting."
exit 1
fi
n=1
while [ -f megatest.${n}.log ]; do
n=$(expr $n + 1)
done
mv megatest.log megatest.${n}.log
testExceptions < megatest.${n}.log > megatest.${n}.summary.log
echo Created megatest.${n}.log and megatest.${n}.summary.log
grep 'Tests run' megatest.${n}.log
diff megatest.$(expr $n - 1).summary.log megatest.${n}.summary.log
}
main "$@"
# End megex
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment