commit 7d7f0d06e0979317d0c93cad370c877ba77d6cc9 parent 60abbb27336ad81f9e96f3b285d9f4e2a8e7bc98 Author: Martin Mitas <mity@morous.org> Date: Thu, 6 Oct 2016 21:15:23 +0200 scripts/run-commonmark-tests.sh: Make the script more robust. Diffstat:
| M | scripts/run-commonmark-tests.sh | | | 16 | +++++++++++++++- |
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/scripts/run-commonmark-tests.sh b/scripts/run-commonmark-tests.sh @@ -2,9 +2,23 @@ set -e +PROGRAM="md2html/md2html" +if [ ! -x "$PROGRAM" ]; then + echo "Cannot find the $PROGRAM." >&2 + echo "You have to run this script from the build directory." >&2 + exit 1 +fi + if [ ! -d commonmark ]; then git clone https://github.com/jgm/commonmark.git fi -commonmark/test/spec_tests.py -s commonmark/spec.txt -p md2html/md2html +if which python3 2>/dev/null; then + PYTHON=python3 +elif which python 2>/dev/null; then + if [ `python --version | awk '{print $2}' | cut -d. -f1` -ge 3 ]; then + PYTHON=python + fi +fi +$PYTHON commonmark/test/spec_tests.py -s commonmark/spec.txt -p "$PROGRAM" "$@"