Skip to content
Snippets Groups Projects
Commit 89c64e76 authored by Dmitri Naumov's avatar Dmitri Naumov
Browse files

Merge branch 'fix-ci-xvfb-run' into 'master'

Work around xvfb-run quirks

See merge request ogs/ogs!4577
parents 27895043 0f819f9f
No related branches found
No related tags found
No related merge requests found
......@@ -18,6 +18,25 @@
# Activate .venv
- test -f $build_dir_full/.venv/bin/activate && source $build_dir_full/.venv/bin/activate
- |
function maybe_run_with_xvfb()
{
if [[ "$OSTYPE" == "darwin"* ]]; then
"$@"
elif command -v xvfb-run &> /dev/null ; then
local ctest_status_file="$build_dir_full/ctest_status"
rm -f "$ctest_status_file"
# status file and sh -c to workaround xvfb-run problems:
# /usr/bin/xvfb-run: line 186: kill: (<PID>) - No such process"
xvfb-run -a \
sh -c 'statf="$1"; shift; "$@"; echo "$?" >"$statf"' \
-- "$ctest_status_file" "$@" \
|| true
[ 0 = "`cat "$ctest_status_file"`" ]
else
"$@"
fi
}
if [[ -z "$TARGETS" ]]; then
if [ "$BUILD_PACKAGE" = false ]; then
......@@ -41,11 +60,8 @@
preset_postfix="-large"
fi
xvfb_run_cmd=""
if [[ "$OSTYPE" == "darwin"* ]]; then
alias date=gdate
elif command -v xvfb-run &> /dev/null ; then
xvfb_run_cmd="xvfb-run -a"
fi
ctest_arguments=""
......@@ -68,7 +84,13 @@
if [[ "$CI_MERGE_REQUEST_LABELS" =~ .*unit_tests.* ]]; then
echo "Skipping ctests because of unit_tests-label."
else
eval ${xvfb_run_cmd} ctest -M Experimental --group ${ctest_group} ${regex_argument} --test-dir ${build_dir_full} -T Start -T Test -T Submit ${ctest_arguments} --output-junit Tests/ctest.xml --stop-time `date -d "today + ${ctest_timeout} minutes" +'%H:%M:%S'`
maybe_run_with_xvfb ctest \
-M Experimental --group "${ctest_group}" "${regex_argument}" \
--test-dir "${build_dir_full}" -T Start -T Test -T Submit \
${ctest_arguments} \
--output-junit Tests/ctest.xml \
--stop-time "`date -d "today + ${ctest_timeout} minutes" +'%H:%M:%S'`" \
--no-tests=error
fi
fi
......
......@@ -27,9 +27,12 @@
- $ctest_group = "Experimental"
- if($env:CI_COMMIT_BRANCH -eq "master") { $ctest_group = "master" }
- |
if($env:BUILD_CTEST -eq "true" -And -Not $env:CI_MERGE_REQUEST_LABELS -contains "unit_tests" )
$ctest_condition = $false
if ($null -eq $env:CI_MERGE_REQUEST_LABELS) { $ctest_condition = $true }
elseif (-Not ($env:CI_MERGE_REQUEST_LABELS -match "unit_tests")) { $ctest_condition = $true }
if($env:BUILD_CTEST -eq "true" -And $ctest_condition -eq $true)
{
ctest --preset=$env:CMAKE_PRESET --output-junit Tests/ctest.xml -M Experimental --group $ctest_group --test-dir $build_directory_full -T Test -T Submit
ctest --preset=$env:CMAKE_PRESET --output-junit Tests/ctest.xml -M Experimental --group $ctest_group --test-dir $build_directory_full -T Test -T Submit --no-tests=error
}
- |
if($env:CHECK_WARNINGS -eq "true" -and (cat $log_file | Select-String -Pattern ': warning') )
......
......@@ -11,4 +11,4 @@ build linux arch:
CMAKE_ARGS: >-
-DBUILD_SHARED_LIBS=ON
-DOGS_USE_MKL=ON
CTEST_ARGS: -L 'default|Notebook'
CTEST_ARGS: -L default|Notebook
......@@ -12,4 +12,4 @@ build linux petsc:
CMAKE_PRESET: release-petsc
CMAKE_ARGS: >-
-DOGS_USE_PIP=ON
CTEST_ARGS: -L 'default|Notebook'
CTEST_ARGS: -L default|Notebook
......@@ -11,7 +11,21 @@ test notebooks via wheel:
# TODO:
# - better timeout
# - run in parallel
- find . -type f -iname '*.ipynb' | grep -vP '\.ipynb_checkpoints|\.ci-skip.ipynb$|_out|.venv|PhaseField' | xargs xvfb-run -a python Notebooks/testrunner.py --out _out
- |
status_file="`mktemp --tmpdir`"
echo 0 >"$status_file" # success if no Notebooks are found
# status file and sh -c to workaround xvfb-run problems:
# /usr/bin/xvfb-run: line 186: kill: (<PID>) - No such process"
find . -type f -iname '*.ipynb' \
| grep -vP '\.ipynb_checkpoints|\.ci-skip\.ipynb$|_out|\.venv|PhaseField' \
| xargs xvfb-run -a \
sh -c 'statf="$1"; shift; "$@" || echo "$?" >"$statf"' \
-- "$status_file" \
python Notebooks/testrunner.py --out _out \
|| true
status="`cat "$status_file"`"
rm "$status_file"
[ 0 = "$status" ]
artifacts:
when: always
paths:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment