qt5: refactor ptest

Current implementation was causing build issues as it cluttered source
directories and modified recipe sysroot content. Tests are now build
in the separate build directory ${B} where we don't need to worry about
moving files to the recipe sysroot, and if tests are enabled in
PACKAGECONFIG, they have been already built during do_compile task.

Signed-off-by: Samuli Piippo <samuli.piippo@qt.io>
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
This commit is contained in:
Samuli Piippo
2018-02-01 08:39:32 +02:00
committed by Martin Jansa
parent 3f2f3a014e
commit 5250890a9f
7 changed files with 9 additions and 89 deletions

View File

@@ -1,63 +1,22 @@
FILESEXTRAPATHS_append := ":${THISDIR}/ptest"
SRC_URI += "file://run-ptest"
inherit ptest
addtask do_populate_sysroot after do_install before do_compile_ptest_base
deltask do_compile_ptest_base
addtask do_compile_ptest_base after do_populate_sysroot before do_install_ptest_base
deltask do_install_ptest_base
addtask do_install_ptest_base after do_compile_ptest_base before do_package
do_compile_ptest() {
cd ${S}/tests
qmake -o Makefile tests.pro
mkdir -p ${B}/tests
cd ${B}/tests
${OE_QMAKE_QMAKE} -o Makefile ${S}/tests/tests.pro
oe_runmake
}
do_populate_sysroot_append_class-target() {
workdir = d.getVar('WORKDIR', True)
srcdir = workdir + '/sysroot-destdir/usr/'
destdir = workdir + '/recipe-sysroot/usr/'
def copyFiles(sourceDir, targetDir, filelist):
for file in os.listdir(sourceDir):
sourceFile = os.path.join(sourceDir, file)
targetFile = os.path.join(targetDir, file)
filelist.append(targetFile) #record the file list
if os.path.isfile(sourceFile):
if not os.path.exists(targetDir):
os.makedirs(targetDir)
if not os.path.exists(targetFile) or(os.path.exists(targetFile) and (os.path.getsize(targetFile) != os.path.getsize(sourceFile))):
open(targetFile, "wb").write(open(sourceFile, "rb").read())
if os.path.isdir(sourceFile):
First_Directory = False
copyFiles(sourceFile, targetFile, filelist)
if os.path.exists(destdir):
Tmpfilelist = []
copyFiles(srcdir, destdir, Tmpfilelist)
fp=open(workdir + '/filelist', 'w')
for i in Tmpfilelist:
fp.write(i)
fp.write("\n")
fp.close()
}
fakeroot do_install_ptest() {
mkdir -p ${D}${PTEST_PATH}
t=${D}${PTEST_PATH}
for var in ` find ${S}/tests/auto/ -name tst_*`; do
for var in ` find ${B}/tests/auto/ -name tst_*`; do
if [ -z ` echo ${var##*/} | grep '\.'` ]; then
echo ${var##*/} >> ${t}/tst_list
install -m 0644 ${var} ${t}
fi
done
for file in `cat ${WORKDIR}/filelist`; do
if [ -f $file ]; then
rm -f $file
fi
done
rm -f ${WORKDIR}/filelist
}

View File

@@ -1,5 +1,6 @@
require qt5.inc
require qt5-git.inc
require qt5-ptest.inc
LICENSE = "GFDL-1.3 & BSD & ( GPL-3.0 & The-Qt-Company-GPL-Exception-1.0 | The-Qt-Company-Commercial ) & ( GPL-2.0+ | LGPL-3.0 | The-Qt-Company-Commercial )"
LIC_FILES_CHKSUM = " \
@@ -29,11 +30,8 @@ SRC_URI += "\
file://0009-Add-OE-specific-specs-for-clang-compiler.patch \
file://0010-linux-clang-Invert-conditional-for-defining-QT_SOCKL.patch \
file://0011-tst_qlocale-Enable-QT_USE_FENV-only-on-glibc.patch \
file://run-ptest \
"
inherit ptest
# LGPL-3.0 is used only in src/plugins/platforms/android/extract.cpp
# for syncqt
@@ -203,17 +201,6 @@ do_configure() {
${QT_CONFIG_FLAGS}
}
fakeroot do_install_ptest() {
mkdir -p ${D}${PTEST_PATH}
t=${D}${PTEST_PATH}
for var in ` find ${B}/tests/auto/ -name tst_*`; do
if [ not ` echo ${var##*/} | grep '\.'` ]; then
echo ${var##*/} >> ${t}/tst_list
install -m 0644 ${var} ${t}
fi
done
}
do_install_append() {
# Avoid qmake error "Cannot read [...]/usr/lib/qt5/mkspecs/oe-device-extra.pri: No such file or directory"
touch ${D}/${OE_QMAKE_PATH_QT_ARCHDATA}/mkspecs/oe-device-extra.pri

View File

@@ -1,5 +0,0 @@
#!/bin/sh
for x in ` awk '{print $1}' tst_list `;do
./${x};
done

View File

@@ -1,6 +0,0 @@
#!/bin/sh
for x in ` awk '{print $1}' tst_list `;do
./${x};
done

View File

@@ -1,5 +1,6 @@
require qt5.inc
require qt5-git.inc
require qt5-ptest.inc
HOMEPAGE = "http://www.qt.io"
LICENSE = "GFDL-1.3 & BSD & ( GPL-3.0 & The-Qt-Company-GPL-Exception-1.0 | The-Qt-Company-Commercial ) & ( GPL-2.0+ | LGPL-3.0 | The-Qt-Company-Commercial )"
@@ -11,14 +12,11 @@ LIC_FILES_CHKSUM = " \
file://LICENSE.FDL;md5=6d9f2a9af4c8b8c3c769f6cc1b6aaf7e \
"
inherit ptest
DEPENDS += "qtbase qtdeclarative qtxmlpatterns"
# Patches from https://github.com/meta-qt5/qttools/commits/b5.10
# 5.10.meta-qt5.1
SRC_URI += " \
file://run-ptest \
file://0001-add-noqtwebkit-configuration.patch \
file://0002-linguist-tools-cmake-allow-overriding-the-location-f.patch \
"
@@ -35,16 +33,9 @@ SRCREV = "3ce89dc37d3c73033c18dcec9e4710afd747ce01"
BBCLASSEXTEND = "native nativesdk"
do_compile_ptest() {
export PATH=${STAGING_DIR_NATIVE}/usr/include/qt5:$PATH
cd ${S}/tests
qmake -o Makefile tests.pro
oe_runmake
}
do_install_ptest() {
mkdir -p ${D}${PTEST_PATH}
t=${D}${PTEST_PATH}
cp ${S}/tests/auto/qtdiag/tst_tdiag $t
cp ${S}/tests/auto/qtattributionsscanner/tst_qtattributionsscanner $t
cp ${B}/tests/auto/qtdiag/tst_tdiag $t
cp ${B}/tests/auto/qtattributionsscanner/tst_qtattributionsscanner $t
}

View File

@@ -1,6 +0,0 @@
#!/bin/sh
for x in ` awk '{print $1}' tst_list `;do
./${x};
done