]> ocean-lang.org Git - ocean/commitdiff
oceani-tests: test code that has been printed
authorNeilBrown <neil@brown.name>
Sat, 18 May 2019 00:11:43 +0000 (10:11 +1000)
committerNeilBrown <neil@brown.name>
Sat, 18 May 2019 00:46:11 +0000 (10:46 +1000)
Test that the printed code actually works, as well as being re-printable.
Also simplify the messages so they don't use as much space
and fix a typo "exit1" -> "exit 1"

Signed-off-by: NeilBrown <neil@brown.name>
csrc/oceani-tests.mdc

index 10a3b709daa49c5bc92122ee1d3eb0820561b285..1b85ad45a757ee761e79570df0623f995ad26ad2 100644 (file)
@@ -43,27 +43,31 @@ arguments separated from the name by commas.  For each test, there is a section
                @rm -rf coverage; mkdir -p coverage
                @cp *.gcno coverage
                @for T in $(oceani_tests); do \
-                   echo -n "Test $$T ... "; \
+                   echo -n "Test $$T.. "; \
                    i="$$IFS"; IFS=,; set $$T; IFS="$$i"; t=$$1; shift; \
                    ./md2c oceani-tests.mdc "output: $$T" | grep -v '^#' > .tmp.want; \
                    ./oceani --section "test: $$t" oceani-tests.mdc $${1+"$$@"} > .tmp.have; \
                    if ! cmp -s .tmp.want .tmp.have; then \
                       echo "FAILED"; diff -u .tmp.want .tmp.have ; exit 1; fi ;\
-                   echo -n "passed ... "; \
+                   echo -n "valgrind.. "; \
                    if ! valgrind --error-exitcode=1 --log-file=.tmp.valg ./oceani --section "test: $$t" oceani-tests.mdc $${1+"$$@"} \
                         > /dev/null 2>&1 ; then \
-                      echo "valgrind FAILED"; cat .tmp.valg; exit 1; fi ; \
+                      echo "FAILED"; cat .tmp.valg; exit 1; fi ; \
                    if grep 'LEAK SUMMARY' .tmp.valg > /dev/null; then \
                       echo "valgrind found LEAKS"; cat .tmp.valg ; exit 1 ; fi; \
                    if grep 'in use at exit [1-9]' .tmp.valg > /dev/null; then \
                       echo "valgrind found memory in use at exit"; cat .tmp.valg ; exit 1 ; fi; \
-                   echo -n "valgrind passed ... "; \
+                   echo -n "printing.. "; \
                    echo '``````' > .tmp.code1; echo '``````' > .tmp.code2 ;\
                    ./oceani --noexec --print --section "test: $$t" oceani-tests.mdc >> .tmp.code1; \
                    ./oceani --noexec --print .tmp.code1 >> .tmp.code2 ;\
                    if ! cmp -s .tmp.code1 .tmp.code2; then \
-                      echo "Printing Failed"; diff -u .tmp.code1 .tmp.code2; exit1 ; fi ; \
-                   echo "Printing passed"; \
+                      echo " Failed"; diff -u .tmp.code1 .tmp.code2; exit 1 ; fi ; \
+                   echo -n "exec-after-print.. "; \
+                   ./oceani .tmp.code1 $${1+"$$@"} > .tmp.have ; \
+                   if ! cmp -s .tmp.want .tmp.have; then \
+                      echo " FAILED"; diff -u .tmp.want .tmp.have; exit 1;fi; \
+                   echo " all passed"; \
                    ./coverage_oceani --print --section "test: $$t" oceani-tests.mdc $${1+"$$@"} > /dev/null ; \
                    ./coverage_oceani -tpbn --section "test: $$t" oceani-tests.mdc > /dev/null 2>&1; \
                done