summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rwxr-xr-xtest/arm/run_tests.sh84
-rwxr-xr-xtest/arm/test.elfbin0 -> 1712 bytes
-rw-r--r--test/arm/test.expect1
-rwxr-xr-xtest/arm/test_O1.elfbin0 -> 1632 bytes
-rw-r--r--test/arm/test_O1.expect1
-rwxr-xr-xtest/arm/test_O2.elfbin0 -> 1688 bytes
-rw-r--r--test/arm/test_O2.expect1
-rwxr-xr-xtest/arm/test_Og.elfbin0 -> 1648 bytes
-rw-r--r--test/arm/test_Og.expect1
-rwxr-xr-xtest/run_tests.sh6
10 files changed, 94 insertions, 0 deletions
diff --git a/test/arm/run_tests.sh b/test/arm/run_tests.sh
new file mode 100755
index 00000000..21c1ce3d
--- /dev/null
+++ b/test/arm/run_tests.sh
@@ -0,0 +1,84 @@
+#!/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/aarch64
+
+printf "Compiling specification...\n"
+
+if $SAILDIR/sail -o aarch64_test -ocaml prelude.sail no_vector/spec.sail decode_start.sail no_vector/decode.sail decode_end.sail main.sail 1> /dev/null;
+then
+ green "compiled no_vector specification" "ok";
+ mv aarch64_test $DIR/;
+ cd $DIR;
+
+ for i in `ls *.elf`;
+ do
+ $DIR/aarch64_test $i 2> /dev/null 1> ${i%.elf}.result
+ if diff ${i%.elf}.result ${i%.elf}.expect;
+ then
+ green "ran $i" "ok"
+ else
+ red "failed $i" "fail"
+ fi;
+ rm -f *.result
+ done;
+
+ rm -f aarch64_test
+else
+ red "compiling no_vector specification" "fail";
+
+ for $i in `ls *.elf`;
+ do
+ red "failed $i" "fail"
+ done
+fi
+
+finish_suite "ARM generated spec tests"
+
+printf "</testsuites>\n" >> $DIR/tests.xml
diff --git a/test/arm/test.elf b/test/arm/test.elf
new file mode 100755
index 00000000..f44b1947
--- /dev/null
+++ b/test/arm/test.elf
Binary files differ
diff --git a/test/arm/test.expect b/test/arm/test.expect
new file mode 100644
index 00000000..345e6aef
--- /dev/null
+++ b/test/arm/test.expect
@@ -0,0 +1 @@
+Test
diff --git a/test/arm/test_O1.elf b/test/arm/test_O1.elf
new file mode 100755
index 00000000..dcfc3ccb
--- /dev/null
+++ b/test/arm/test_O1.elf
Binary files differ
diff --git a/test/arm/test_O1.expect b/test/arm/test_O1.expect
new file mode 100644
index 00000000..345e6aef
--- /dev/null
+++ b/test/arm/test_O1.expect
@@ -0,0 +1 @@
+Test
diff --git a/test/arm/test_O2.elf b/test/arm/test_O2.elf
new file mode 100755
index 00000000..1620ff43
--- /dev/null
+++ b/test/arm/test_O2.elf
Binary files differ
diff --git a/test/arm/test_O2.expect b/test/arm/test_O2.expect
new file mode 100644
index 00000000..345e6aef
--- /dev/null
+++ b/test/arm/test_O2.expect
@@ -0,0 +1 @@
+Test
diff --git a/test/arm/test_Og.elf b/test/arm/test_Og.elf
new file mode 100755
index 00000000..32664866
--- /dev/null
+++ b/test/arm/test_Og.elf
Binary files differ
diff --git a/test/arm/test_Og.expect b/test/arm/test_Og.expect
new file mode 100644
index 00000000..345e6aef
--- /dev/null
+++ b/test/arm/test_Og.expect
@@ -0,0 +1 @@
+Test
diff --git a/test/run_tests.sh b/test/run_tests.sh
index 669a420a..b31a05ff 100755
--- a/test/run_tests.sh
+++ b/test/run_tests.sh
@@ -16,3 +16,9 @@ printf "* Ocaml tests *\n"
printf "******************************************\n\n"
./test/ocaml/run_tests.sh
+
+printf "******************************************\n"
+printf "* ARM spec tests *\n"
+printf "******************************************\n\n"
+
+./test/arm/run_tests.sh