Build system: make xvfb-run optional for running the Octave testsuite

xvfb-run is a Debian-specific program.

Closes: #1892
covariance-quadratic-approximation
Sébastien Villemot 2023-12-21 13:45:49 +01:00
parent 5216cec249
commit 368c93214e
No known key found for this signature in database
GPG Key ID: 2CECE9350ECEBE4A
2 changed files with 18 additions and 9 deletions

View File

@ -1,6 +1,3 @@
# TODO:
# - See what to do with xvfb-run (see #1892). Maybe try to detect it from meson.build, and pass it optionally to the test driver script
project('dynare',
'cpp', 'fortran', 'c',
version : '6-unstable',
@ -1837,9 +1834,15 @@ mod_and_m_tests = [
base_test_driver_args = [ get_option('build_for') ]
if get_option('build_for') == 'matlab'
base_test_driver_args += [ matlab_exe.full_path(), matlab_version, matlab_arch ]
base_test_driver_args += [ matlab_exe.full_path(), matlab_version, matlab_arch, '' ]
else
base_test_driver_args += [ octave_exe.full_path(), octave_version, '' ]
xvfb_run_exe = find_program('xvfb-run', required : false) # Debian-specific utility
if xvfb_run_exe.found()
base_test_driver_args += xvfb_run_exe.full_path()
else
base_test_driver_args += ''
endif
endif
base_test_driver_args += [ meson.current_source_dir(), meson.current_build_dir() ]

View File

@ -6,7 +6,7 @@ set -e
shopt -s extglob
if (($# < 7 )); then
echo "Usage: $0 build_for matlab_octave_exe matlab_octave_version matlab_arch source_root build_root test_file(s) [-- extra_file(s)]" 2>&1
echo "Usage: $0 build_for matlab_octave_exe matlab_octave_version matlab_arch xvfb_run_exe source_root build_root test_file(s) [-- extra_file(s)]" 2>&1
exit 1
fi
@ -14,9 +14,10 @@ build_for=$1
matlab_octave_exe=$2
matlab_octave_version=$3
matlab_arch=$4
source_root=$5
build_root=$6
shift 6
xvfb_run_exe=$5
source_root=$6
build_root=$7
shift 7
test_files=()
while (($# > 0)); do
@ -111,6 +112,11 @@ for test_file in "${test_files[@]}"; do
# We cannot use the --no-window-system option, and we have to use xvfb
# See the following Octave bug: https://savannah.gnu.org/bugs/?62101
# (this affects at least tests/shock_decomposition/ls2003_plot.mod)
xvfb-run -a "$matlab_octave_exe" --no-init-file --silent --no-history "$test_arg"
test_cmd=("$matlab_octave_exe" --no-init-file --silent --no-history "$test_arg")
if [[ -n $xvfb_run_exe ]]; then
"$xvfb_run_exe" -a "${test_cmd[@]}"
else
"${test_cmd[@]}"
fi
fi
done