summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGabriel Kerneis2014-05-30 15:50:34 +0100
committerGabriel Kerneis2014-05-30 15:50:34 +0100
commit80e22fcc5825200667cb79f46498fbdb1d8fe15d (patch)
treec9a1ef159adb652cab33088979dcf2a26b618c81 /src
parent4007e0eb5328b6ed73c045822da09d1aa73faa3c (diff)
Add pretty-printer test (idempotence)
Fails in most cases because of "fresh" variables in type annotations that cannot be parsed again.
Diffstat (limited to 'src')
-rw-r--r--src/Makefile7
-rwxr-xr-xsrc/test/idempotence.sh14
2 files changed, 20 insertions, 1 deletions
diff --git a/src/Makefile b/src/Makefile
index a1ce3583..b4265016 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -1,4 +1,4 @@
-.PHONY: all test clean doc lib test_power
+.PHONY: all test clean doc lib test_power test_idempotence
all: lib doc
ocamlbuild -classic-display sail.native test/run_tests.native
@@ -11,6 +11,11 @@ test_power:
SAIL_OPTS=-skip_constraints ocamlbuild -classic-display sail.native test/run_power.native
./run_power.native --file ../../../rsem/idl/power/binary/main.bin
+test_idempotence:
+ @cd test; for file in *.sail; do \
+ ./idempotence.sh $$file; echo ;\
+ done
+
clean:
-ocamlbuild -clean
-rm -rf _build
diff --git a/src/test/idempotence.sh b/src/test/idempotence.sh
new file mode 100755
index 00000000..5527680d
--- /dev/null
+++ b/src/test/idempotence.sh
@@ -0,0 +1,14 @@
+#!/bin/sh -e
+input=$1
+sail=../sail.native
+
+output1=`mktemp --suffix=.sail`
+echo Pretty-printing $input
+$sail -verbose $input > $output1
+
+output2=`mktemp --suffix=.sail`
+echo Pretty-printing pretty-printed
+$sail -verbose $output1 > $output2
+
+diff -u $output1 $output2 && \
+ (rm -f $output1 $output2; echo Idempotence: ok)