Parametrize both source and build dir via env for docker/ci tests

CTEST_SOURCE_DIR defaulting to /root/QGIS
CTEST_BUILD_DIR defaulting to /root/QGIS/build
This commit is contained in:
Sandro Santilli 2022-05-18 23:58:48 +02:00
parent 2d8e4e591e
commit 9f917167af
4 changed files with 30 additions and 23 deletions

View File

@ -1,5 +1,5 @@
SET (CTEST_SOURCE_DIRECTORY $ENV{CTEST_BUILD_DIR})
SET (CTEST_BINARY_DIRECTORY $ENV{CTEST_BUILD_DIR}/build)
SET (CTEST_SOURCE_DIRECTORY $ENV{CTEST_SOURCE_DIR})
SET (CTEST_BINARY_DIRECTORY $ENV{CTEST_BUILD_DIR})
#SET (CTEST_SOURCE_DIRECTORY /usr/src/QGIS)
#SET (CTEST_BINARY_DIRECTORY /usr/src/qgis-build)

View File

@ -2,6 +2,9 @@
set -e
CTEST_SOURCE_DIR=${CTEST_SOURCE_DIR-/root/QGIS}
CTEST_BUILD_DIR=${CTEST_BUILD_DIR-/root/QGIS/build}
##############
# Setup ccache
##############
@ -23,9 +26,9 @@ endbold=$(tput sgr0)
###########
# Configure
###########
pushd /root/QGIS > /dev/null
mkdir -p build
pushd build > /dev/null
pushd ${CTEST_SOURCE_DIR} > /dev/null
mkdir -p ${CTEST_BUILD_DIR}
pushd ${CTEST_BUILD_DIR} > /dev/null
echo "${bold}Running cmake...${endbold}"
echo "::group::cmake"
@ -57,9 +60,9 @@ CMAKE_EXTRA_ARGS=()
if [[ ${PATCH_QT_3D} == "true" ]]; then
CMAKE_EXTRA_ARGS+=(
"-DQT5_3DEXTRA_LIBRARY=/usr/lib/x86_64-linux-gnu/libQt53DExtras.so"
"-DQT5_3DEXTRA_INCLUDE_DIR=/root/QGIS/external/qt3dextra-headers"
"-DCMAKE_PREFIX_PATH=/root/QGIS/external/qt3dextra-headers/cmake"
"-DQt53DExtras_DIR=/root/QGIS/external/qt3dextra-headers/cmake/Qt53DExtras"
"-DQT5_3DEXTRA_INCLUDE_DIR=${CTEST_SOURCE_DIR}/external/qt3dextra-headers"
"-DCMAKE_PREFIX_PATH=${CTEST_SOURCE_DIR}/external/qt3dextra-headers/cmake"
"-DQt53DExtras_DIR=${CTEST_SOURCE_DIR}/external/qt3dextra-headers/cmake/Qt53DExtras"
)
fi
@ -116,14 +119,15 @@ cmake \
echo "::endgroup::"
# Workaround https://github.com/actions/checkout/issues/760
git config --global --add safe.directory /root/QGIS
git config --global --add safe.directory ${CTEST_SOURCE_DIR}
git config --global --add safe.directory ${CTEST_BUILD_DIR}
#######
# Build
#######
echo "${bold}Building QGIS...${endbold}"
echo "::group::build"
ctest -VV -S /root/QGIS/.ci/config_build.ctest
ctest -VV -S ${CTEST_SOURCE_DIR}/.ci/config_build.ctest
echo "::endgroup::"
########################
@ -132,7 +136,7 @@ echo "::endgroup::"
echo "ccache statistics"
ccache -s
popd > /dev/null # build
popd > /dev/null # /root/QGIS
popd > /dev/null # ${CTEST_BUILD_DIR}
popd > /dev/null # ${CTEST_SOURCE_DIR}
[ -r /tmp/ctest-important.log ] && cat /tmp/ctest-important.log || true

View File

@ -2,6 +2,8 @@
set -e
SRCDIR=${CTEST_SOURCE_DIR-/root/QGIS}
# Debug env
echo "::group::Print env"
env
@ -100,9 +102,9 @@ if [ ${RUN_POSTGRES:-"NO"} == "YES" ]; then
done
echo " done 🥩"
pushd /root/QGIS > /dev/null
pushd ${SRCDIR} > /dev/null
echo "Restoring postgres test data ..."
/root/QGIS/tests/testdata/provider/testdata_pg.sh
${SRCDIR}/tests/testdata/provider/testdata_pg.sh
echo "Postgres test data restored ..."
popd > /dev/null # /root/QGIS
@ -135,8 +137,8 @@ if [ ${RUN_ORACLE:-"NO"} == "YES" ]; then
echo "timeout, no oracle, no 🙏"
else
echo " done 👀"
pushd /root/QGIS > /dev/null
/root/QGIS/tests/testdata/provider/testdata_oracle.sh $ORACLE_HOST
pushd ${SRCDIR} > /dev/null
${SRCDIR}/tests/testdata/provider/testdata_oracle.sh $ORACLE_HOST
popd > /dev/null # /root/QGIS
fi
@ -158,9 +160,9 @@ if [ ${RUN_SQLSERVER:-"NO"} == "YES" ]; then
export PATH=$PATH:/opt/mssql-tools/bin
pushd /root/QGIS > /dev/null
/root/QGIS/tests/testdata/provider/testdata_mssql.sh
popd > /dev/null # /root/QGIS
pushd ${SRCDIR} > /dev/null
${SRCDIR}/tests/testdata/provider/testdata_mssql.sh
popd > /dev/null # ${SRCDIR}
echo "Setting up DSN for test SQL Server"
@ -202,10 +204,10 @@ fi
###########
# Run tests
###########
EXCLUDE_TESTS=$(cat /root/QGIS/.ci/test_blocklist_qt${QT_VERSION}.txt | sed -r '/^(#.*?)?$/d' | paste -sd '|' -)
EXCLUDE_TESTS=$(cat ${SRCDIR}/.ci/test_blocklist_qt${QT_VERSION}.txt | sed -r '/^(#.*?)?$/d' | paste -sd '|' -)
if ! [[ ${RUN_FLAKY_TESTS} == true ]]; then
echo "Flaky tests are skipped!"
EXCLUDE_TESTS=${EXCLUDE_TESTS}"|"$(cat /root/QGIS/.ci/test_flaky.txt | sed -r '/^(#.*?)?$/d' | paste -sd '|' -)
EXCLUDE_TESTS=${EXCLUDE_TESTS}"|"$(cat ${SRCDIR}/.ci/test_flaky.txt | sed -r '/^(#.*?)?$/d' | paste -sd '|' -)
else
echo "Flaky tests are run!"
fi
@ -214,7 +216,7 @@ echo "List of skipped tests: $EXCLUDE_TESTS"
echo "Print disk space"
df -h
python3 /root/QGIS/.ci/ctest2ci.py xvfb-run ctest -V $CTEST_OPTIONS -E "${EXCLUDE_TESTS}" -S /root/QGIS/.ci/config_test.ctest --output-on-failure
python3 ${SRCDIR}/.ci/ctest2ci.py xvfb-run ctest -V $CTEST_OPTIONS -E "${EXCLUDE_TESTS}" -S ${SRCDIR}/.ci/config_test.ctest --output-on-failure
echo "Print disk space"
df -h

View File

@ -3,7 +3,8 @@
SEGFAULT_SIGNALS="abrt segv"
CTEST_BUILD_COMMAND=/usr/bin/ninja
CTEST_PARALLEL_LEVEL=1
CTEST_BUILD_DIR=/root/QGIS
CTEST_SOURCE_DIR=/root/QGIS
CTEST_BUILD_DIR=/root/QGIS/build
# CTEST vars defined in workflow
CTEST_BUILD_NAME