diff options
Diffstat (limited to 'test')
| -rwxr-xr-x | test/aarch64_small/run_tests.sh | 37 | ||||
| -rwxr-xr-x | test/arm/run_tests.sh | 37 | ||||
| -rwxr-xr-x | test/cheri/run_tests.sh | 32 | ||||
| -rwxr-xr-x | test/coq/run_tests.sh | 33 | ||||
| -rwxr-xr-x | test/isabelle/run_tests.sh | 32 | ||||
| -rwxr-xr-x | test/lem/run_tests.sh | 38 | ||||
| -rwxr-xr-x | test/mono/run_tests.sh | 38 | ||||
| -rwxr-xr-x | test/ocaml/run_tests.sh | 37 | ||||
| -rw-r--r-- | test/test_helpers.sh | 36 | ||||
| -rwxr-xr-x | test/typecheck/run_tests.sh | 38 |
10 files changed, 54 insertions, 304 deletions
diff --git a/test/aarch64_small/run_tests.sh b/test/aarch64_small/run_tests.sh index 416ad9f1..619ee8d2 100755 --- a/test/aarch64_small/run_tests.sh +++ b/test/aarch64_small/run_tests.sh @@ -5,43 +5,10 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" cd $DIR SAILDIR="$DIR/../.." -RED='\033[0;91m' -GREEN='\033[0;92m' -YELLOW='\033[0;93m' -NC='\033[0m' - rm -f $DIR/tests.xml -pass=0 -fail=0 -XML="" - -function green { - (( pass += 1 )) - printf "$1: ${GREEN}$2${NC}\n" - XML+=" <testcase name=\"$1\"/>\n" -} - -function yellow { - (( fail += 1 )) - printf "$1: ${YELLOW}$2${NC}\n" - XML+=" <testcase name=\"$1\">\n <error message=\"$2\">$2</error>\n </testcase>\n" -} - -function red { - (( fail += 1 )) - printf "$1: ${RED}$2${NC}\n" - XML+=" <testcase name=\"$1\">\n <error message=\"$2\">$2</error>\n </testcase>\n" -} - -function finish_suite { - printf "$1: Passed ${pass} out of $(( pass + fail ))\n\n" - XML=" <testsuite name=\"$1\" tests=\"$(( pass + fail ))\" failures=\"${fail}\" timestamp=\"$(date)\">\n$XML </testsuite>\n" - printf "$XML" >> $DIR/tests.xml - XML="" - pass=0 - fail=0 -} +# shellcheck source=../test_helpers.sh +source "$SAILDIR/test/test_helpers.sh" printf "<testsuites>\n" >> $DIR/tests.xml diff --git a/test/arm/run_tests.sh b/test/arm/run_tests.sh index 9d7af14f..83839417 100755 --- a/test/arm/run_tests.sh +++ b/test/arm/run_tests.sh @@ -5,43 +5,10 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" cd $DIR SAILDIR="$DIR/../.." -RED='\033[0;91m' -GREEN='\033[0;92m' -YELLOW='\033[0;93m' -NC='\033[0m' - rm -f $DIR/tests.xml -pass=0 -fail=0 -XML="" - -function green { - (( pass += 1 )) - printf "$1: ${GREEN}$2${NC}\n" - XML+=" <testcase name=\"$1\"/>\n" -} - -function yellow { - (( fail += 1 )) - printf "$1: ${YELLOW}$2${NC}\n" - XML+=" <testcase name=\"$1\">\n <error message=\"$2\">$2</error>\n </testcase>\n" -} - -function red { - (( fail += 1 )) - printf "$1: ${RED}$2${NC}\n" - XML+=" <testcase name=\"$1\">\n <error message=\"$2\">$2</error>\n </testcase>\n" -} - -function finish_suite { - printf "$1: Passed ${pass} out of $(( pass + fail ))\n\n" - XML=" <testsuite name=\"$1\" tests=\"$(( pass + fail ))\" failures=\"${fail}\" timestamp=\"$(date)\">\n$XML </testsuite>\n" - printf "$XML" >> $DIR/tests.xml - XML="" - pass=0 - fail=0 -} +# shellcheck source=../test_helpers.sh +source "$SAILDIR/test/test_helpers.sh" SAILLIBDIR="$DIR/../../lib/" diff --git a/test/cheri/run_tests.sh b/test/cheri/run_tests.sh index 337974d7..5fa0cdcd 100755 --- a/test/cheri/run_tests.sh +++ b/test/cheri/run_tests.sh @@ -12,36 +12,8 @@ NC='\033[0m' rm -f $DIR/tests.xml -pass=0 -fail=0 -XML="" - -function green { - (( pass += 1 )) - printf "$1: ${GREEN}$2${NC}\n" - XML+=" <testcase name=\"$1\"/>\n" -} - -function yellow { - (( fail += 1 )) - printf "$1: ${YELLOW}$2${NC}\n" - XML+=" <testcase name=\"$1\">\n <error message=\"$2\">$2</error>\n </testcase>\n" -} - -function red { - (( fail += 1 )) - printf "$1: ${RED}$2${NC}\n" - XML+=" <testcase name=\"$1\">\n <error message=\"$2\">$2</error>\n </testcase>\n" -} - -function finish_suite { - printf "$1: Passed ${pass} out of $(( pass + fail ))\n\n" - XML=" <testsuite name=\"$1\" tests=\"$(( pass + fail ))\" failures=\"${fail}\" timestamp=\"$(date)\">\n$XML </testsuite>\n" - printf "$XML" >> $DIR/tests.xml - XML="" - pass=0 - fail=0 -} +# shellcheck source=../test_helpers.sh +source "$SAILDIR/test/test_helpers.sh" SAILLIBDIR="$DIR/../../lib/" diff --git a/test/coq/run_tests.sh b/test/coq/run_tests.sh index 2d1a1318..24978c4f 100755 --- a/test/coq/run_tests.sh +++ b/test/coq/run_tests.sh @@ -22,37 +22,8 @@ NC='\033[0m' rm -f $DIR/tests.xml -pass=0 -fail=0 - -XML="" - -function green { - (( pass += 1 )) - printf "$1: ${GREEN}$2${NC}\n" - XML+=" <testcase name=\"$1\"/>\n" -} - -function yellow { - (( fail += 1 )) - printf "$1: ${YELLOW}$2${NC}\n" - XML+=" <testcase name=\"$1\">\n <error message=\"$2\">$2</error>\n </testcase>\n" -} - -function red { - (( fail += 1 )) - printf "$1: ${RED}$2${NC}\n" - XML+=" <testcase name=\"$1\">\n <error message=\"$2\">$2</error>\n </testcase>\n" -} - -function finish_suite { - printf "$1: Passed ${pass} out of $(( pass + fail ))\n\n" - XML=" <testsuite name=\"$1\" tests=\"$(( pass + fail ))\" failures=\"${fail}\" timestamp=\"$(date)\">\n$XML </testsuite>\n" - printf "$XML" >> $DIR/tests.xml - XML="" - pass=0 - fail=0 -} +# shellcheck source=../test_helpers.sh +source "$SAILDIR/test/test_helpers.sh" printf "<testsuites>\n" >> $DIR/tests.xml diff --git a/test/isabelle/run_tests.sh b/test/isabelle/run_tests.sh index 7b3f7bc1..ebc3472c 100755 --- a/test/isabelle/run_tests.sh +++ b/test/isabelle/run_tests.sh @@ -13,36 +13,8 @@ NC='\033[0m' rm -f $DIR/tests.xml -pass=0 -fail=0 -XML="" - -function green { - (( pass += 1 )) - printf "$1: ${GREEN}$2${NC}\n" - XML+=" <testcase name=\"$1\"/>\n" -} - -function yellow { - (( fail += 1 )) - printf "$1: ${YELLOW}$2${NC}\n" - XML+=" <testcase name=\"$1\">\n <error message=\"$2\">$2</error>\n </testcase>\n" -} - -function red { - (( fail += 1 )) - printf "$1: ${RED}$2${NC}\n" - XML+=" <testcase name=\"$1\">\n <error message=\"$2\">$2</error>\n </testcase>\n" -} - -function finish_suite { - printf "$1: Passed ${pass} out of $(( pass + fail ))\n\n" - XML=" <testsuite name=\"$1\" tests=\"$(( pass + fail ))\" failures=\"${fail}\" timestamp=\"$(date)\">\n$XML </testsuite>\n" - printf "$XML" >> $DIR/tests.xml - XML="" - pass=0 - fail=0 -} +# shellcheck source=../test_helpers.sh +source "$SAILDIR/test/test_helpers.sh" SAILLIBDIR="$DIR/../../lib/" diff --git a/test/lem/run_tests.sh b/test/lem/run_tests.sh index 7660b250..7d344ee0 100755 --- a/test/lem/run_tests.sh +++ b/test/lem/run_tests.sh @@ -5,44 +5,10 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" SAILDIR="$DIR/../.." TESTSDIR="$DIR/../typecheck/pass" -RED='\033[0;91m' -GREEN='\033[0;92m' -YELLOW='\033[0;93m' -NC='\033[0m' - rm -f $DIR/tests.xml -pass=0 -fail=0 - -XML="" - -function green { - (( pass += 1 )) - printf "$1: ${GREEN}$2${NC}\n" - XML+=" <testcase name=\"$1\"/>\n" -} - -function yellow { - (( fail += 1 )) - printf "$1: ${YELLOW}$2${NC}\n" - XML+=" <testcase name=\"$1\">\n <error message=\"$2\">$2</error>\n </testcase>\n" -} - -function red { - (( fail += 1 )) - printf "$1: ${RED}$2${NC}\n" - XML+=" <testcase name=\"$1\">\n <error message=\"$2\">$2</error>\n </testcase>\n" -} - -function finish_suite { - printf "$1: Passed ${pass} out of $(( pass + fail ))\n\n" - XML=" <testsuite name=\"$1\" tests=\"$(( pass + fail ))\" failures=\"${fail}\" timestamp=\"$(date)\">\n$XML </testsuite>\n" - printf "$XML" >> $DIR/tests.xml - XML="" - pass=0 - fail=0 -} +# shellcheck source=../test_helpers.sh +source "$SAILDIR/test/test_helpers.sh" printf "<testsuites>\n" >> $DIR/tests.xml diff --git a/test/mono/run_tests.sh b/test/mono/run_tests.sh index f95dc7d5..2bf41dff 100755 --- a/test/mono/run_tests.sh +++ b/test/mono/run_tests.sh @@ -6,44 +6,10 @@ SAILDIR=${SAIL_DIR:-"$DIR/../.."} TESTSDIR="$DIR" OUTPUTDIR="$DIR/test-output" -RED='\033[0;91m' -GREEN='\033[0;92m' -YELLOW='\033[0;93m' -NC='\033[0m' - rm -f $DIR/tests.xml -pass=0 -fail=0 - -XML="" - -function green { - (( pass += 1 )) - printf "$1: ${GREEN}$2${NC}\n" - XML+=" <testcase name=\"$1\"/>\n" -} - -function yellow { - (( fail += 1 )) - printf "$1: ${YELLOW}$2${NC}\n" - XML+=" <testcase name=\"$1\">\n <error message=\"$2\">$2</error>\n </testcase>\n" -} - -function red { - (( fail += 1 )) - printf "$1: ${RED}$2${NC}\n" - XML+=" <testcase name=\"$1\">\n <error message=\"$2\">$2</error>\n </testcase>\n" -} - -function finish_suite { - printf "$1: Passed ${pass} out of $(( pass + fail ))\n\n" - XML=" <testsuite name=\"$1\" tests=\"$(( pass + fail ))\" failures=\"${fail}\" timestamp=\"$(date)\">\n$XML </testsuite>\n" - printf "$XML" >> "$DIR/tests.xml" - XML="" - pass=0 - fail=0 -} +# shellcheck source=../test_helpers.sh +source "$SAILDIR/test/test_helpers.sh" printf "<testsuites>\n" >> "$DIR/tests.xml" diff --git a/test/ocaml/run_tests.sh b/test/ocaml/run_tests.sh index f9328394..9dab7d75 100755 --- a/test/ocaml/run_tests.sh +++ b/test/ocaml/run_tests.sh @@ -5,43 +5,10 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" cd $DIR SAILDIR="$DIR/../.." -RED='\033[0;91m' -GREEN='\033[0;92m' -YELLOW='\033[0;93m' -NC='\033[0m' - rm -f $DIR/tests.xml -pass=0 -fail=0 -XML="" - -function green { - (( pass += 1 )) - printf "$1: ${GREEN}$2${NC}\n" - XML+=" <testcase name=\"$1\"/>\n" -} - -function yellow { - (( fail += 1 )) - printf "$1: ${YELLOW}$2${NC}\n" - XML+=" <testcase name=\"$1\">\n <error message=\"$2\">$2</error>\n </testcase>\n" -} - -function red { - (( fail += 1 )) - printf "$1: ${RED}$2${NC}\n" - XML+=" <testcase name=\"$1\">\n <error message=\"$2\">$2</error>\n </testcase>\n" -} - -function finish_suite { - printf "$1: Passed ${pass} out of $(( pass + fail ))\n\n" - XML=" <testsuite name=\"$1\" tests=\"$(( pass + fail ))\" failures=\"${fail}\" timestamp=\"$(date)\">\n$XML </testsuite>\n" - printf "$XML" >> $DIR/tests.xml - XML="" - pass=0 - fail=0 -} +# shellcheck source=../test_helpers.sh +source "$SAILDIR/test/test_helpers.sh" printf "<testsuites>\n" >> $DIR/tests.xml diff --git a/test/test_helpers.sh b/test/test_helpers.sh new file mode 100644 index 00000000..40d66f10 --- /dev/null +++ b/test/test_helpers.sh @@ -0,0 +1,36 @@ +RED='\033[0;91m' +GREEN='\033[0;92m' +YELLOW='\033[0;93m' +NC='\033[0m' + +pass=0 +fail=0 +XML="" + +function green { + (( pass += 1 )) + printf "%s: ${GREEN}$2${NC}\n" "$1" + XML+=" <testcase name=\"$1\"/>\n" +} + +function yellow { + (( fail += 1 )) + printf "%s: ${YELLOW}$2${NC}\n" "$1" + XML+=" <testcase name=\"$1\">\n <error message=\"$2\">$2</error>\n </testcase>\n" +} + +function red { + (( fail += 1 )) + printf "%s: ${RED}$2${NC}\n" "$1" + XML+=" <testcase name=\"$1\">\n <error message=\"$2\">$2</error>\n </testcase>\n" +} + +function finish_suite { + printf "%s: Passed ${pass} out of $(( pass + fail ))\n\n" "$1" + XML=" <testsuite name=\"$1\" tests=\"$(( pass + fail ))\" failures=\"${fail}\" timestamp=\"$(date)\">\n$XML </testsuite>\n" + # Note: we use echo -e to escape \n characters + echo -e "$XML" >> "$DIR/tests.xml" + XML="" + pass=0 + fail=0 +} diff --git a/test/typecheck/run_tests.sh b/test/typecheck/run_tests.sh index e0720baf..bfc77899 100755 --- a/test/typecheck/run_tests.sh +++ b/test/typecheck/run_tests.sh @@ -4,47 +4,13 @@ set -e DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" SAILDIR="$DIR/../.." -RED='\033[0;91m' -GREEN='\033[0;92m' -YELLOW='\033[0;93m' -NC='\033[0m' - mkdir -p $DIR/rtpass mkdir -p $DIR/rtpass2 rm -f $DIR/tests.xml -pass=0 -fail=0 - -XML="" - -function green { - (( pass += 1 )) - printf "$1: ${GREEN}$2${NC}\n" - XML+=" <testcase name=\"$1\"/>\n" -} - -function yellow { - (( fail += 1 )) - printf "$1: ${YELLOW}$2${NC}\n" - XML+=" <testcase name=\"$1\">\n <error message=\"$2\">$2</error>\n </testcase>\n" -} - -function red { - (( fail += 1 )) - printf "$1: ${RED}$2${NC}\n" - XML+=" <testcase name=\"$1\">\n <error message=\"$2\">$2</error>\n </testcase>\n" -} - -function finish_suite { - printf "$1: Passed ${pass} out of $(( pass + fail ))\n\n" - XML=" <testsuite name=\"$1\" tests=\"$(( pass + fail ))\" failures=\"${fail}\" timestamp=\"$(date)\">\n$XML </testsuite>\n" - printf "$XML" >> $DIR/tests.xml - XML="" - pass=0 - fail=0 -} +# shellcheck source=../test_helpers.sh +source "$SAILDIR/test/test_helpers.sh" printf "<testsuites>\n" >> $DIR/tests.xml |
