From 37ab539a10d0efc0f1ef8eec3426ea91c2a2351d Mon Sep 17 00:00:00 2001
From: Johannes Pfeifer <jpfeifer@gmx.de>
Date: Thu, 30 Nov 2023 16:51:36 +0100
Subject: [PATCH] testsuite: provide meaningful output in case of LaTeX errors

---
 tests/TeX/fs2000_corr_ME.mod                              | 4 +++-
 tests/gsa/ls2003.mod                                      | 4 +++-
 tests/identification/as2007/as2007.mod                    | 4 +++-
 tests/identification/correlated_errors/fs2000_corr.mod    | 4 +++-
 tests/optimal_policy/Ramsey/Ramsey_Example_estimation.mod | 6 ++++--
 tests/shock_decomposition/ls2003_plot.mod                 | 4 +++-
 6 files changed, 19 insertions(+), 7 deletions(-)

diff --git a/tests/TeX/fs2000_corr_ME.mod b/tests/TeX/fs2000_corr_ME.mod
index b0ebe70fd2..d2b1dc4de3 100644
--- a/tests/TeX/fs2000_corr_ME.mod
+++ b/tests/TeX/fs2000_corr_ME.mod
@@ -185,6 +185,8 @@ stoch_simul(order=1,irf=20,graph_format=eps,periods=0,contemporaneous_correlatio
 collect_latex_files;
 
 //identification(advanced=1,max_dim_cova_group=3,prior_mc=250);
-if system(['pdflatex -halt-on-error -interaction=batchmode ' M_.fname '_TeX_binder.tex'])
+[status, cmdout]=system(['pdflatex -halt-on-error -interaction=nonstopmode ' M_.fname '_TeX_binder.tex']);
+if status
+    cmdout
     error('TeX-File did not compile.')
 end
diff --git a/tests/gsa/ls2003.mod b/tests/gsa/ls2003.mod
index 9443b535f1..038ee90209 100644
--- a/tests/gsa/ls2003.mod
+++ b/tests/gsa/ls2003.mod
@@ -179,6 +179,8 @@ alpha2_rmse=0, // no correlation analysis
 rmse=1,ppost=1,Nsam=512);
 
 collect_latex_files;
-if system(['pdflatex -halt-on-error -interaction=batchmode ' M_.fname '_TeX_binder.tex'])
+[status, cmdout]=system(['pdflatex -halt-on-error -interaction=nonstopmode ' M_.fname '_TeX_binder.tex']);
+if status
+    cmdout
     error('TeX-File did not compile.')
 end
diff --git a/tests/identification/as2007/as2007.mod b/tests/identification/as2007/as2007.mod
index 8b073460eb..1591a7308c 100644
--- a/tests/identification/as2007/as2007.mod
+++ b/tests/identification/as2007/as2007.mod
@@ -96,7 +96,9 @@ identification(tex);
 identification(tex,advanced=1,max_dim_cova_group=3,prior_mc=250,no_identification_spectrum, no_identification_minimal);
 
 collect_latex_files;
-if system(['pdflatex -halt-on-error -interaction=batchmode ' M_.fname '_TeX_binder.tex'])
+[status, cmdout]=system(['pdflatex -halt-on-error -interaction=nonstopmode ' M_.fname '_TeX_binder.tex']);
+if status
+    cmdout
     error('TeX-File did not compile.')
 end
 close all;
diff --git a/tests/identification/correlated_errors/fs2000_corr.mod b/tests/identification/correlated_errors/fs2000_corr.mod
index c03bb17c1e..c8fb124ce0 100644
--- a/tests/identification/correlated_errors/fs2000_corr.mod
+++ b/tests/identification/correlated_errors/fs2000_corr.mod
@@ -134,6 +134,8 @@ identification(advanced=1,max_dim_cova_group=3,prior_mc=250,tex);
 
 collect_latex_files;
 
-if system(['pdflatex -halt-on-error -interaction=batchmode ' M_.fname '_TeX_binder.tex'])
+[status, cmdout]=system(['pdflatex -halt-on-error -interaction=nonstopmode ' M_.fname '_TeX_binder.tex']);
+if status
+    cmdout
     error('TeX-File did not compile.')
 end
diff --git a/tests/optimal_policy/Ramsey/Ramsey_Example_estimation.mod b/tests/optimal_policy/Ramsey/Ramsey_Example_estimation.mod
index ffd76cff63..57912ea45a 100644
--- a/tests/optimal_policy/Ramsey/Ramsey_Example_estimation.mod
+++ b/tests/optimal_policy/Ramsey/Ramsey_Example_estimation.mod
@@ -245,6 +245,8 @@ write_latex_original_model(write_equation_tags);
 write_latex_steady_state_model;
 
 collect_latex_files;
-if system(['pdflatex -halt-on-error -interaction=batchmode ' M_.fname '_TeX_binder.tex'])
+[status, cmdout]=system(['pdflatex -halt-on-error -interaction=nonstopmode ' M_.fname '_TeX_binder.tex']);
+if status
+    cmdout
     error('TeX-File did not compile.')
-end
\ No newline at end of file
+end
diff --git a/tests/shock_decomposition/ls2003_plot.mod b/tests/shock_decomposition/ls2003_plot.mod
index 2d15d01837..7852a08c9e 100644
--- a/tests/shock_decomposition/ls2003_plot.mod
+++ b/tests/shock_decomposition/ls2003_plot.mod
@@ -165,6 +165,8 @@ realtime_shock_decomposition(fast_realtime=75) y_obs R_obs pie_obs dq de;
 squeeze_shock_decomposition;
 
 collect_latex_files;
-if system(['pdflatex -halt-on-error -interaction=batchmode ' M_.fname '_TeX_binder.tex'])
+[status, cmdout]=system(['pdflatex -halt-on-error -interaction=nonstopmode ' M_.fname '_TeX_binder.tex']);
+if status
+    cmdout
     error('TeX-File did not compile.')
 end
-- 
GitLab