For those wanting to test but haven't made a script yet, here's what I used to test project 4 (I put it in a shell file in the project directory):
PYDESUGAR=./pydesugar # change me if needed
PYCPS=./pycps # change me if needed
OUTPUT_FOLDER=output
rm -rf ${OUTPUT_FOLDER}
mkdir ${OUTPUT_FOLDER}
RACKET=racket
for i in /pub/p4/inputs.hir/*.py.hir; do
base=`basename $i .hir`
expected=/pub/p4/outputs/${base}.out
out=${OUTPUT_FOLDER}/${base}.out
echo Testing $i
${PYDESUGAR} < $i | ${PYCPS} > ${out}.cps
cat cps-header.rkt ${out}.cps > ${out}.crkt
${RACKET} ${out}.crkt > ${out}
diff -q ${expected} ${out}
done
For project 3:
PYTRANS=./pytrans-stub # change me to your executable file
OUTPUT_FOLDER=output
rm -rf ${OUTPUT_FOLDER}
mkdir ${OUTPUT_FOLDER}
RACKET=racket
for i in /pub/p3/inputs.ast/*.py.ast; do
base=`basename $i .ast`
expected=/pub/p3/outputs/${base}.out
out=${OUTPUT_FOLDER}/${base}.out
echo Testing $i
${PYTRANS} < $i > ${out}.hir
cat hir-header.rkt ${out}.hir > ${out}.hrkt
${RACKET} ${out}.hrkt > ${out}
diff -q ${expected} ${out}
done