From 96346b77e5e39ece565fc19f9b404f62c352488d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org>
Date: Fri, 15 Apr 2022 14:33:02 +0200
Subject: [PATCH] Octave 7 compatibility fix: in testsuite, replace
 --no-window-system option by xvfb-run

This is a workaround for Octave bug 62101, which affects
tests/shock_decomposition/ls2003_plot.mod, but is unlikely to be fixed.
---
 tests/Makefile.am | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tests/Makefile.am b/tests/Makefile.am
index 726fefc02a..21bfa3c5b3 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1444,7 +1444,7 @@ check-matlab-ols: $(M_OLS_TRS_FILES)
 %.o.trs %.o.log: %.mod
 	@echo "`tput bold``tput setaf 8`OCTAVE: $(CURDIR)/$*... `tput sgr0`"
 	@DYNARE_VERSION="$(PACKAGE_VERSION)" TOP_TEST_DIR="$(CURDIR)" FILESTEM="$*" \
-		$(OCTAVE) --no-window-system --no-init-file --silent --no-history --path "$*.mod" run_test_octave.m > $*.o.log 2>&1 || \
+		xvfb-run -a $(OCTAVE) --no-init-file --silent --no-history --path "$*.mod" 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:elapsed-time: 0.0\n" > $*.o.trs
 	@if test -z "$(filter $*.o.trs,$(O_XFAIL_TRS_FILES))"; then pass_color=2; fail_color=1; else pass_color=1; fail_color=2; fi; \
 	if grep -q ":test-result: PASS" $*.o.trs; then \
@@ -1459,7 +1459,7 @@ check-matlab-ols: $(M_OLS_TRS_FILES)
 %.o.trs %.o.log : %.m
 	@echo "`tput bold``tput setaf 8`OCTAVE: $(CURDIR)/$*... `tput sgr0`"
 	@DYNARE_VERSION="$(PACKAGE_VERSION)" TOP_TEST_DIR="$(CURDIR)" \
-		$(OCTAVE) --no-window-system --no-init-file --silent --no-history $< > $*.o.log 2>&1 || \
+		xvfb-run -a $(OCTAVE) --no-init-file --silent --no-history $< > $*.o.log 2>&1 || \
 		printf ":test-result: FAIL\n:number-tests: 1\n:number-failed-tests: 1\n:list-of-failed-tests: $*.m\n:elapsed-time: 0.0\n" > $*.o.trs
 	@echo "`tput bold``tput setaf 8`OCTAVE: $(CURDIR)/$* Done!`tput sgr0`"
 
@@ -1473,7 +1473,7 @@ check-matlab-ols: $(M_OLS_TRS_FILES)
 %.o.tls : %.m
 	@echo "`tput bold``tput setaf 8`OCTAVE: $(CURDIR)/$*... `tput sgr0`"
 	@TOP_TEST_DIR="$(CURDIR)"  FILESTEM="$*" \
-		$(OCTAVE) --no-window-system --no-init-file --silent --no-history run_o_script.m 2>&1
+		xvfb-run -a $(OCTAVE) --no-init-file --silent --no-history run_o_script.m 2>&1
 	@touch $*.o.tls
 	@echo "`tput bold``tput setaf 8`OCTAVE: $(CURDIR)/$* Done!`tput sgr0`"
 
-- 
GitLab