]> ocean-lang.org Git - ocean/commitdiff
oceani-tests: delay valgrind tests
authorNeilBrown <neil@brown.name>
Sat, 18 May 2019 02:21:55 +0000 (12:21 +1000)
committerNeilBrown <neil@brown.name>
Sat, 18 May 2019 02:23:30 +0000 (12:23 +1000)
As valgrind can be slow, separate the valgrind tests out to
after the main tests.  That was failing that can be found quickly
are found quickly.

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

index 1b85ad45a757ee761e79570df0623f995ad26ad2..42505ce0fbe6957fbb9a89f0a9c7142745f4563d 100644 (file)
@@ -49,14 +49,6 @@ arguments separated from the name by commas.  For each test, there is a section
                    ./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 "valgrind.. "; \
-                   if ! valgrind --error-exitcode=1 --log-file=.tmp.valg ./oceani --section "test: $$t" oceani-tests.mdc $${1+"$$@"} \
-                        > /dev/null 2>&1 ; then \
-                      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 "printing.. "; \
                    echo '``````' > .tmp.code1; echo '``````' > .tmp.code2 ;\
                    ./oceani --noexec --print --section "test: $$t" oceani-tests.mdc >> .tmp.code1; \
@@ -82,6 +74,19 @@ arguments separated from the name by commas.  For each test, there is a section
                        coverage/oceani.mdc.gcov
                @rm -f .tmp*
 
+               @for T in $(oceani_tests); do \
+                   echo -n "Valgrind $$T.. "; \
+                   i="$$IFS"; IFS=,; set $$T; IFS="$$i"; t=$$1; shift; \
+                   if ! valgrind --error-exitcode=1 --log-file=.tmp.valg ./oceani --section "test: $$t" oceani-tests.mdc $${1+"$$@"} \
+                        > /dev/null 2>&1 ; then \
+                      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 " passed"; \
+               done
+
        coverage_oceani: oceani.c
                $(CC) $(CFLAGS) --coverage -fprofile-dir=coverage -o coverage_oceani oceani.c $(LDLIBS)