summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlasdair Armstrong2018-12-14 15:17:42 +0000
committerAlasdair Armstrong2018-12-14 15:17:42 +0000
commit2dfcbdeedb0ac40d4865aaf5c2202dfba95f4a38 (patch)
treee267b9d9166e3548f71508d9d68b8ea1f35a304d
parentbfb20a209d1b72c832b4376d6d3c51d39970ef2f (diff)
Add a few more tests for Jenkins
Some of the output from the tests scripts is odd on Jenkins, try to fix this by flushing stdout more regularly in the test scripts
-rw-r--r--src/ocaml_backend.ml2
-rw-r--r--src/parser.mly6
-rw-r--r--test/c/config.expect6
-rw-r--r--test/c/config.sail34
-rwxr-xr-xtest/run_tests.sh14
-rw-r--r--test/sailtest.py2
-rw-r--r--test/typecheck/pass/commentfix.sail7
7 files changed, 57 insertions, 14 deletions
diff --git a/src/ocaml_backend.ml b/src/ocaml_backend.ml
index cfd79290..d075e693 100644
--- a/src/ocaml_backend.ml
+++ b/src/ocaml_backend.ml
@@ -978,7 +978,7 @@ let ocaml_compile spec defs generator_types =
let tags_file = if !opt_ocaml_coverage then "_tags_coverage" else "_tags" in
let _ = Unix.system ("cp -r " ^ sail_dir ^ "/lib/" ^ tags_file ^ " _tags") in
let out_chan = open_out (spec ^ ".ml") in
- if !opt_ocaml_coverage then
+ if !opt_ocaml_coverage then
ignore(Unix.system ("cp -r " ^ sail_dir ^ "/lib/myocamlbuild_coverage.ml myocamlbuild.ml"));
ocaml_pp_defs out_chan defs generator_types;
close_out out_chan;
diff --git a/src/parser.mly b/src/parser.mly
index 6344db97..66902953 100644
--- a/src/parser.mly
+++ b/src/parser.mly
@@ -319,12 +319,6 @@ kid:
| TyVar
{ mk_kid $1 $startpos $endpos }
-kid_list:
- | kid
- { [$1] }
- | kid kid_list
- { $1 :: $2 }
-
num_list:
| Num
{ [$1] }
diff --git a/test/c/config.expect b/test/c/config.expect
new file mode 100644
index 00000000..059a413f
--- /dev/null
+++ b/test/c/config.expect
@@ -0,0 +1,6 @@
+x = 3
+Hello
+z = 0xFF
+x = 4
+World
+z = 0xAA
diff --git a/test/c/config.sail b/test/c/config.sail
new file mode 100644
index 00000000..2902d259
--- /dev/null
+++ b/test/c/config.sail
@@ -0,0 +1,34 @@
+default Order dec
+
+$include <arith.sail>
+$include <vector_dec.sail>
+
+val "print" : string -> unit
+
+register q : int
+
+register configuration x : int = 3
+
+register configuration y : string = "Hello\n"
+
+register configuration z : bits(8) = 0xFF
+
+val init : unit -> unit effect {configuration}
+
+function init() = {
+ x = 4;
+ y = "World\n";
+ z = 0xAA;
+}
+
+val main : unit -> unit effect {configuration}
+
+function main() = {
+ print_int("x = ", x);
+ print(y);
+ print_bits("z = ", z);
+ init();
+ print_int("x = ", x);
+ print(y);
+ print_bits("z = ", z);
+} \ No newline at end of file
diff --git a/test/run_tests.sh b/test/run_tests.sh
index 5e6fe691..ba0a2112 100755
--- a/test/run_tests.sh
+++ b/test/run_tests.sh
@@ -12,28 +12,28 @@ printf "==========================================\n"
./typecheck/run_tests.sh
printf "\n==========================================\n"
-printf "Ocaml tests\n"
+printf "Lem tests\n"
printf "==========================================\n"
-./ocaml/run_tests.sh
+./lem/run_tests.sh
printf "\n==========================================\n"
-printf "C tests\n"
+printf "Ocaml tests\n"
printf "==========================================\n"
-./c/run_tests.py
+./ocaml/run_tests.sh
printf "\n==========================================\n"
-printf "Lem tests\n"
+printf "C tests\n"
printf "==========================================\n"
-./lem/run_tests.sh
+TEST_PAR=8 ./c/run_tests.py
printf "\n==========================================\n"
printf "Builtins tests\n"
printf "==========================================\n"
-./builtins/run_tests.py
+TEST_PAR=4 ./builtins/run_tests.py
printf "\n==========================================\n"
printf "ARM spec tests\n"
diff --git a/test/sailtest.py b/test/sailtest.py
index 32d09aa9..5ee87b08 100644
--- a/test/sailtest.py
+++ b/test/sailtest.py
@@ -46,6 +46,7 @@ def banner(string):
print '-' * len(string)
print string
print '-' * len(string)
+ sys.stdout.flush()
class Results:
def __init__(self, name):
@@ -63,6 +64,7 @@ class Results:
else:
self.passes += 1
self.xml += ' <testcase name="{}"/>\n'.format(test)
+ sys.stdout.flush()
def finish(self):
print '{}{} passes and {} failures{}'.format(color.NOTICE, self.passes, self.failures, color.END)
diff --git a/test/typecheck/pass/commentfix.sail b/test/typecheck/pass/commentfix.sail
new file mode 100644
index 00000000..fd2cf0b2
--- /dev/null
+++ b/test/typecheck/pass/commentfix.sail
@@ -0,0 +1,7 @@
+/********/
+
+/*=====*/
+
+//////
+
+default Order inc