Created
December 3, 2017 17:28
-
-
Save eliasdorneles/c7277e895d816a0b8ff7a0241ad1bd11 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This script assumes you're using the directory layout described in the | |
# documentation at: https://voc.readthedocs.io/en/latest/tutorials/tutorial-0.html | |
set -e | |
#set -x | |
abort() { | |
echo "$*"; exit 1; | |
} | |
usage() { | |
abort "Usage: $(basename $0) [-h|--help] PY_SCRIPT_FILE" | |
} | |
require() { | |
type $1 >/dev/null 2>/dev/null | |
} | |
classpath=. | |
while [ "${1#-}" != "$1" ]; do | |
case "$1" in | |
-h|--help) usage;; | |
-cp|--classpath) classpath="$2:."; shift;; | |
*) usage;; | |
esac | |
shift | |
done | |
pyfile="$1" | |
basefile=$(basename $pyfile .py) | |
(cd ../voc && ant java) | |
voc -v $pyfile | |
java_output=$(java -cp ../voc/dist/python-java-support.jar:$classpath python.${basefile}) | |
python_output=$(python $pyfile) | |
diff -y <(echo PYTHON) <(echo JAVA) || true | |
diff -y <(echo "$python_output") <(echo "$java_output") && echo PASS || echo FAILED |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment