diff options
| author | Alasdair Armstrong | 2018-01-19 19:32:29 +0000 |
|---|---|---|
| committer | Alasdair Armstrong | 2018-01-19 19:32:29 +0000 |
| commit | 392e8ada16f0c05e928527d20f7cc8b521b6a53f (patch) | |
| tree | 8c735c57f8293a7a5c45acd71a001da0dcfd824c /test/riscv/run_tests.sh | |
| parent | 2dac693e02c7f467f4faf5d95cd3017002beb060 (diff) | |
Added RISCV test case to test suite
Diffstat (limited to 'test/riscv/run_tests.sh')
| -rwxr-xr-x | test/riscv/run_tests.sh | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/test/riscv/run_tests.sh b/test/riscv/run_tests.sh new file mode 100755 index 00000000..9430efec --- /dev/null +++ b/test/riscv/run_tests.sh @@ -0,0 +1,65 @@ + +#!/usr/bin/env bash +set -e + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +cd $DIR +SAILDIR="$DIR/../.." + +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[0;33m' +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 +} + +SAILLIBDIR="$DIR/../../lib/" + +printf "<testsuites>\n" >> $DIR/tests.xml + +cd $SAILDIR/riscv + +printf "Checking specification...\n" + +if $SAILDIR/sail prelude.sail riscv_types.sail riscv.sail 1> /dev/null; +then + green "checked RISCV specification" "ok" +else + red "checking RISCV specification" "fail" +fi + +finish_suite "RISCV tests" + +prinf "</testsuites>\n" >> $DIR/tests.xml + |
