Created
November 19, 2012 11:14
Revisions
-
niflostancu revised this gist
Nov 19, 2012 . 1 changed file with 4 additions and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -24,19 +24,21 @@ function test_correct { STDERR=$(cat __stderr) DIFF_CMD="diff -w -u <(grep -vE '^\s*(#[0-9]+|$)' __stdout) <(grep -vE '^\s*(#[0-9]+|$)' $2) " if [ -n "$STDERR" ]; then fail "compilation errors" echo "-- First lines of stderr below --" cat __stderr | head -n 3 echo "-----" echo else if [ -z "$( eval $DIFF_CMD )" ]; then pass else fail "differences found" echo "-- First lines of the diff below --" eval $DIFF_CMD | head -n 20 echo "-----" echo fi -
niflostancu created this gist
Nov 19, 2012 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,59 @@ #!/bin/bash TESTS_DIR="_tests" export CLASSPATH="$CLASSPATH:./bin:antlr-3.4.jar:java-cup-11a-runtime.jar" PARSER="java Semant" function fail { printf "FAIL (%s)\n" "$1" } function pass { printf "PASS\n" } function test_correct { printf "%-50s" "Testing file $1... " rm -f __stdout rm -f __stderr $PARSER -tail_recursive < $1 1>__stdout 2>__stderr STDERR=$(cat __stderr) if [ -n "$STDERR" ]; then fail "compilation errors" echo "-- First lines of stderr below --" cat __stderr | head -n 3 echo "-----" echo else if [ -z "$(diff -w -u <(grep -vE '^\s*(#[0-9]+|$)' __stdout) <(grep -vE '^\s*(#[0-9]+|$)' $2) )" ]; then pass else fail "differences found" echo "-- First lines of the diff below --" diff -w -u <(grep -vE '^\s*(#[0-9]+|$)' __stdout) <(grep -vE '^\s*(#[0-9]+|$)' $2) | head -n 20 echo "-----" echo fi fi } echo "******************************" echo "**** Running bonus tests ****" echo "******************************" echo for CL_SRC in $TESTS_DIR/bonus/*.in.ast; do test_correct $CL_SRC ${CL_SRC/%in.ast/ast} done echo echo rm -f __stdout rm -f __stderr