meta-qt6/recipes-qt/qt6/qt6-ptest.inc
Samuli Piippo ed785a25d1 ptest: remove references to destination directory
Tests are build against the destination directory where qt module was
just installed. This causes extra files to be taken into source package
and adds references to the TMPDIR, which produces QA warnings from
buildpaths QA test. Use DEBUG_PREFIX_MAP to get rid of those paths.

Task-number: QTBUG-105913
Change-Id: I01ed9261004410db307f2cd809a181377b734c9e
Reviewed-by: Ari Parkkila <ari.parkkila@qt.io>
(cherry picked from commit 497624e967)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-01 14:35:00 +00:00

75 lines
2.3 KiB
PHP

FILESEXTRAPATHS:append := ":${THISDIR}/ptest"
SRC_URI += "file://run-ptest"
inherit ptest
QT_PTEST_ENABLED ?= "${@bb.utils.contains('DISTRO_FEATURES', 'ptest', '1', '0', d)}"
PTEST_ENABLED = "${QT_PTEST_ENABLED}"
DEBUG_PREFIX_MAP += "\
-fmacro-prefix-map=${D}= \
"
fakeroot do_install_ptest() {
cat >${WORKDIR}/toolchain-ptest.cmake <<EOF
include(${WORKDIR}/toolchain.cmake)
list(PREPEND CMAKE_FIND_ROOT_PATH ${D})
EOF
if [ -n "${OE_QMAKE_QMAKE}" ]; then
# qmake project
B_PTEST=${B}
mkdir -p ${B_PTEST}/tests
cd ${B_PTEST}/tests
${OE_QMAKE_QMAKE} -o Makefile ${S}/tests
oe_runmake
else
# cmake project
B_PTEST=${WORKDIR}/build-ptest
mkdir -p ${B_PTEST}
cd ${B_PTEST}
cmake \
${OECMAKE_GENERATOR_ARGS} \
-DCMAKE_TOOLCHAIN_FILE=${WORKDIR}/toolchain-ptest.cmake \
-DPython3_EXECUTABLE=${PYTHON} \
${EXTRA_OECMAKE} \
-DQT_BUILD_STANDALONE_TESTS=ON \
-DCMAKE_STAGING_PREFIX=${D}${prefix} \
-DCMAKE_SKIP_RPATH=ON \
-DQT_DISABLE_NO_DEFAULT_PATH_IN_QT_PACKAGES=ON \
${S} \
-Wno-dev
${CMAKE_VERBOSE} cmake --build ${B_PTEST} --target all
fi
# if any auto tests were build
if [ -e "${B_PTEST}/tests/auto" ]; then
install -d ${D}${PTEST_PATH}/tests
cp -r ${B_PTEST}/tests/auto ${D}${PTEST_PATH}/tests
# remove build files
find ${D}${PTEST_PATH}/tests \
\( -wholename "*/.*" -o -wholename "*autogen*" -o -iwholename "*cmake*" -o -name Makefile \) \
-delete
for f in $(find ${D}${PTEST_PATH} -name tst_* -executable); do
test=${f##${D}${PTEST_PATH}/}
testdir=$(dirname ${test})
# tests may depend on files from sources
if [ -e ${S}/${testdir} ]; then
cp -r ${S}/${testdir}/* ${D}${PTEST_PATH}/${testdir}
fi
echo ${test} >> ${D}${PTEST_PATH}/tst_list
done
fi
}
INSANE_SKIP:${PN}-ptest += "file-rdeps"
PACKAGESPLITFUNCS =+ "remove_ptest_debug"
remove_ptest_debug() {
if [ -e ${PKGD}${QT6_INSTALL_LIBDIR}/${BPN}/ptest/tests/auto ]; then
find ${PKGD}${QT6_INSTALL_LIBDIR}/${BPN}/ptest/tests/auto -depth -type d -name .debug -exec rm -rf '{}' \;
fi
}