2012-05-25 14:19:46 +00:00
|
|
|
#!/bin/sh
|
2012-05-25 12:28:53 +00:00
|
|
|
# Simple test runner with result archival in results git repository
|
|
|
|
# Usage:
|
|
|
|
# ./runtests.sh -c # wikitext -> HTML DOM tests and commit results
|
|
|
|
# ./runtests.sh -r -c # round-trip tests; commit
|
|
|
|
# ./runtests.sh # wikitext -> HTML DOM; only show diff (no commit)
|
|
|
|
# ./runtests.sh -r # round-trip tests; only show diff (no commit)
|
|
|
|
|
|
|
|
if [ ! -d results ];then
|
|
|
|
git init results
|
|
|
|
touch results/html.txt
|
|
|
|
touch results/roundtrip.txt
|
|
|
|
( cd results;
|
|
|
|
git add html.txt
|
|
|
|
git add roundtrip.txt
|
|
|
|
git commit -a -m 'init to empty test output' )
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$1" = "-r" ];then
|
|
|
|
time node parserTests.js --cache --roundtrip \
|
|
|
|
> results/roundtrip.txt 2>&1 || exit 1
|
|
|
|
|
|
|
|
else
|
|
|
|
time node parserTests.js --cache --printwhitelist \
|
|
|
|
> results/html.txt 2>&1 || exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
cd results || exit 1
|
|
|
|
if [ "$1" != '-c' -a "$2" != '-c' ];then
|
|
|
|
git diff | less -r
|
|
|
|
else
|
|
|
|
if [ "$1" = '-r' ];then
|
2012-05-25 14:36:14 +00:00
|
|
|
git commit -a -m "rt: `tail -4 roundtrip.txt`" || exit 1
|
2012-05-25 12:28:53 +00:00
|
|
|
else
|
2012-05-25 14:36:14 +00:00
|
|
|
git commit -a -m "html: `tail -4 html.txt`" || exit 1
|
2012-05-25 12:28:53 +00:00
|
|
|
fi
|
|
|
|
git diff HEAD~1 | less -r || exit 1
|
|
|
|
fi
|