Skip to content

Instantly share code, notes, and snippets.

@eliasdorneles
Created December 3, 2017 17:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eliasdorneles/c7277e895d816a0b8ff7a0241ad1bd11 to your computer and use it in GitHub Desktop.
Save eliasdorneles/c7277e895d816a0b8ff7a0241ad1bd11 to your computer and use it in GitHub Desktop.
#!/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