[oe] [meta-qt5][PATCH] qt5: refactor ptest

Samuli Piippo samuli.piippo at qt.io
Thu Feb 1 06:39:32 UTC 2018


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 at qt.io>
---
 recipes-qt/qt5/{qtbase => ptest}/run-ptest |  0
 recipes-qt/qt5/qt5-ptest.inc               | 51 +++---------------------------
 recipes-qt/qt5/qtbase_git.bb               | 15 +--------
 recipes-qt/qt5/qtdeclarative/run-ptest     |  5 ---
 recipes-qt/qt5/qtquick1/run-ptest          |  6 ----
 recipes-qt/qt5/qttools_git.bb              | 15 ++-------
 recipes-qt/qt5/qtxmlpatterns/run-ptest     |  6 ----
 7 files changed, 9 insertions(+), 89 deletions(-)
 rename recipes-qt/qt5/{qtbase => ptest}/run-ptest (100%)
 delete mode 100644 recipes-qt/qt5/qtdeclarative/run-ptest
 delete mode 100644 recipes-qt/qt5/qtquick1/run-ptest
 delete mode 100644 recipes-qt/qt5/qtxmlpatterns/run-ptest

diff --git a/recipes-qt/qt5/qtbase/run-ptest b/recipes-qt/qt5/ptest/run-ptest
similarity index 100%
rename from recipes-qt/qt5/qtbase/run-ptest
rename to recipes-qt/qt5/ptest/run-ptest
diff --git a/recipes-qt/qt5/qt5-ptest.inc b/recipes-qt/qt5/qt5-ptest.inc
index 97bce88..56efe10 100644
--- a/recipes-qt/qt5/qt5-ptest.inc
+++ b/recipes-qt/qt5/qt5-ptest.inc
@@ -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
 }
-
diff --git a/recipes-qt/qt5/qtbase_git.bb b/recipes-qt/qt5/qtbase_git.bb
index 4f3ade2..f586409 100644
--- a/recipes-qt/qt5/qtbase_git.bb
+++ b/recipes-qt/qt5/qtbase_git.bb
@@ -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
diff --git a/recipes-qt/qt5/qtdeclarative/run-ptest b/recipes-qt/qt5/qtdeclarative/run-ptest
deleted file mode 100644
index 6c3f522..0000000
--- a/recipes-qt/qt5/qtdeclarative/run-ptest
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/sh
-
-for x in ` awk '{print $1}' tst_list `;do
-    ./${x};
-done
diff --git a/recipes-qt/qt5/qtquick1/run-ptest b/recipes-qt/qt5/qtquick1/run-ptest
deleted file mode 100644
index 044f834..0000000
--- a/recipes-qt/qt5/qtquick1/run-ptest
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/bin/sh
-
-for x in ` awk '{print $1}' tst_list `;do
-    ./${x};
-done
-
diff --git a/recipes-qt/qt5/qttools_git.bb b/recipes-qt/qt5/qttools_git.bb
index 2187f9c..dad5ba8 100644
--- a/recipes-qt/qt5/qttools_git.bb
+++ b/recipes-qt/qt5/qttools_git.bb
@@ -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
 }
diff --git a/recipes-qt/qt5/qtxmlpatterns/run-ptest b/recipes-qt/qt5/qtxmlpatterns/run-ptest
deleted file mode 100644
index 044f834..0000000
--- a/recipes-qt/qt5/qtxmlpatterns/run-ptest
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/bin/sh
-
-for x in ` awk '{print $1}' tst_list `;do
-    ./${x};
-done
-
-- 
2.16.1




More information about the Openembedded-devel mailing list