sp-02/test/test.sh

20 lines
684 B
Bash
Executable File

#!/bin/sh
echo Testing...
# Remove actual output from prior run (if any)
rm -f asm-6.2.1.jar-actual.output.txt
# There should be only one build folder, with the name of this IntelliJ project. Get that name.
OUT=`ls ../out/production`
# Run the program, storing stdout in a file
java -cp ../out/production/${OUT}:../lib/asm-7.1.jar:../lib/asm-tree-7.1.jar:../lib/asm-util-7.1.jar Analyzer asm-6.2.1.jar > asm-6.2.1.jar-actual.output.txt
# Compare actual to expected output
diff asm-6.2.1.jar-actual.output.txt asm-6.2.1.jar-expected.output.txt
RESULT=$?
# If actual output differs from expected output, print "failed"
if [ ${RESULT} -eq 0 ]; then
echo passed
else
echo failed
fi