From fd9c81f0efa509da58cb743e22cb285de104371d Mon Sep 17 00:00:00 2001
From: Houtan Bastani <houtan@dynare.org>
Date: Tue, 20 Sep 2016 17:17:25 +0200
Subject: [PATCH] test suite: ensure test suite keeps on running even when
 Octave or Matlab crash. Closes #1069

---
 tests/Makefile.am | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tests/Makefile.am b/tests/Makefile.am
index 9a44c43d96..3b88e717fb 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -616,7 +616,8 @@ check-octave: $(O_XFAIL_TRS_FILES) $(O_TRS_FILES)
 %.m.trs %.m.log: %.mod
 	@echo "`tput bold``tput setaf 8`MATLAB: $(PWD)/$*... `tput sgr0`"
 	@DYNARE_VERSION="$(PACKAGE_VERSION)" TOP_TEST_DIR="$(PWD)" FILESTEM="$*" \
-	$(MATLAB)/bin/matlab -nosplash -nodisplay -r run_test_matlab > $*.m.log  2> /dev/null
+		$(MATLAB)/bin/matlab -nosplash -nodisplay -r run_test_matlab > $*.m.log  2> /dev/null || \
+	printf ":test-result: FAIL\n:number-tests: 1\n:number-failed-tests: 1\n:list-of-failed-tests: $*.mod\n:cputime: 0.0\n" > $*.m.trs
 	@if grep -q ":test-result: PASS" $*.m.trs; then \
 	echo "`tput bold``tput setaf 2`MATLAB: $(PWD)/$* PASSED!`tput sgr0`" ; \
 	else \
@@ -635,7 +636,8 @@ check-octave: $(O_XFAIL_TRS_FILES) $(O_TRS_FILES)
 %.o.trs %.o.log: %.mod
 	@echo "`tput bold``tput setaf 8`OCTAVE: $(PWD)/$*... `tput sgr0`"
 	@DYNARE_VERSION="$(PACKAGE_VERSION)" TOP_TEST_DIR="$(PWD)" FILESTEM="$*" \
-		$(OCTAVE) --no-init-file --silent --no-history run_test_octave.m > $*.o.log 2>&1
+		$(OCTAVE) --no-init-file --silent --no-history run_test_octave.m > $*.o.log 2>&1 || \
+	printf ":test-result: FAIL\n:number-tests: 1\n:number-failed-tests: 1\n:list-of-failed-tests: $*.mod\n:cputime: 0.0\n" > $*.o.trs
 	@if grep -q ":test-result: PASS" $*.o.trs; then \
 	echo "`tput bold``tput setaf 2`OCTAVE: $(PWD)/$* PASSED!`tput sgr0`" ; \
 	else \
-- 
GitLab