summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/mimetypes
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2019-07-26 18:59:53 +0200
committerAlexandru Croitor <alexandru.croitor@qt.io>2019-07-29 13:16:14 +0000
commita285bcba26498f3a03da3891a253213e05dba621 (patch)
tree40207dc653fa5774fce080f72b403231d663e808 /tests/auto/corelib/mimetypes
parentc75dcc6875af90635df252f529b5722b9d4a5bd0 (diff)
Ugly fix for handling QT_SOURCE_TREE
QT_SOURCE_TREE is a variable that is set in qtbase/.qmake.conf. In qtbase, it's used throughout various projects to find cpp sources when building standalone tests (among other things). Everything works fine with qmake, because even if qmake is invoked on the tests subfolder, qmake searches up the source directory tree until it finds a .qmake.conf file, and uses that. When building qttools with qmake, the qdoc project expects to have a QT_SOURCE_TREE value, but it's not actually set in the qttools/.qmake.conf file, so the generated include paths that use that value are incorrect. Curiously the build still succeeds. Now in CMake land we replaced QT_SOURCE_TREE with CMAKE_SOURCE_DIR, but that does not work properly when doing a standalone tests build, because the project in that case is the tests one, and not the qtbase one, so configuration fails in a developer build when trying to configure some private tests. So far I've found that only qtbase actively uses this value. A temporary fix is to save the qtbase source directory into a QT_SOURCE_TREE variable inside the generated BuildInternalsExtra.cmake file. The pro2cmake script is changed to handle presence of QT_SOURCE_TREE in a qrc file path. This is handled by finding the location of a .qmake.conf file starting from the project file absolute path. This is needed to stop the script from crashing when handling the mimedatabase test projects for example. The change also regenerates the relevant failing test projects, and thus standalone tests (when doing developer builds aka private_tests enabled) now configure and build successfully. Change-Id: I15adc6f4ab6e3056c43ed850196204e2229c4d98 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'tests/auto/corelib/mimetypes')
-rw-r--r--tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-cache/.prev_CMakeLists.txt22
-rw-r--r--tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-cache/CMakeLists.txt3
-rw-r--r--tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-xml/.prev_CMakeLists.txt78
-rw-r--r--tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-xml/CMakeLists.txt8
4 files changed, 101 insertions, 10 deletions
diff --git a/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-cache/.prev_CMakeLists.txt b/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-cache/.prev_CMakeLists.txt
index 4a3d150123..99709d7731 100644
--- a/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-cache/.prev_CMakeLists.txt
+++ b/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-cache/.prev_CMakeLists.txt
@@ -5,6 +5,7 @@
#####################################################################
add_qt_test(tst_qmimedatabase-cache
+ GUI
SOURCES
../tst_qmimedatabase.h
tst_qmimedatabase-cache.cpp
@@ -13,17 +14,28 @@ add_qt_test(tst_qmimedatabase-cache
)
# Resources:
+set_source_files_properties("/Volumes/T3/Dev/qt/qt5_cmake/qtbase/src/corelib/mimetypes/mime/packages/freedesktop.org.xml"
+ PROPERTIES alias "freedesktop.org.xml"
+)
+add_qt_resource(tst_qmimedatabase-cache "mimetypes"
+ PREFIX
+ "/qt-project.org/qmime/packages"
+ BASE
+ "/Volumes/T3/Dev/qt/qt5_cmake/qtbase/src/corelib/mimetypes"
+ FILES
+ mime/packages/freedesktop.org.xml
+)
set_source_files_properties("../qml-again.xml"
- PROPERTIES alias "qml-again.xml"]
+ PROPERTIES alias "qml-again.xml"
)
set_source_files_properties("../test.qml"
- PROPERTIES alias "test.qml"]
+ PROPERTIES alias "test.qml"
)
set_source_files_properties("../text-x-objcsrc.xml"
- PROPERTIES alias "text-x-objcsrc.xml"]
+ PROPERTIES alias "text-x-objcsrc.xml"
)
set_source_files_properties("../yast2-metapackage-handler-mimetypes.xml"
- PROPERTIES alias "yast2-metapackage-handler-mimetypes.xml"]
+ PROPERTIES alias "yast2-metapackage-handler-mimetypes.xml"
)
add_qt_resource(tst_qmimedatabase-cache "testdata"
PREFIX
@@ -60,7 +72,7 @@ extend_target(tst_qmimedatabase-cache CONDITION 2*_x_ - g
-Wshadow
)
-extend_target(tst_qmimedatabase-cache CONDITION UNIX AND NOT APPLE_OSX AND NOT QNX
+extend_target(tst_qmimedatabase-cache CONDITION UNIX AND NOT APPLE AND NOT QNX
DEFINES
USE_XDG_DATA_DIRS
)
diff --git a/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-cache/CMakeLists.txt b/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-cache/CMakeLists.txt
index c7e3f9613d..0bbb6ee81f 100644
--- a/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-cache/CMakeLists.txt
+++ b/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-cache/CMakeLists.txt
@@ -5,6 +5,7 @@
#####################################################################
add_qt_test(tst_qmimedatabase-cache
+ GUI
SOURCES
../tst_qmimedatabase.h
tst_qmimedatabase-cache.cpp
@@ -66,7 +67,7 @@ extend_target(tst_qmimedatabase-cache CONDITION CMAKE_COMPILER_IS_GNUCXX
-Wshadow
)
-extend_target(tst_qmimedatabase-cache CONDITION UNIX AND NOT APPLE_OSX AND NOT QNX
+extend_target(tst_qmimedatabase-cache CONDITION UNIX AND NOT APPLE AND NOT QNX
DEFINES
USE_XDG_DATA_DIRS
)
diff --git a/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-xml/.prev_CMakeLists.txt b/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-xml/.prev_CMakeLists.txt
new file mode 100644
index 0000000000..a33b6c4dcf
--- /dev/null
+++ b/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-xml/.prev_CMakeLists.txt
@@ -0,0 +1,78 @@
+# Generated from qmimedatabase-xml.pro.
+
+#####################################################################
+## tst_qmimedatabase-xml Test:
+#####################################################################
+
+add_qt_test(tst_qmimedatabase-xml
+ GUI
+ SOURCES
+ ../tst_qmimedatabase.h
+ tst_qmimedatabase-xml.cpp
+ PUBLIC_LIBRARIES
+ Qt::Concurrent
+)
+
+# Resources:
+set_source_files_properties("/Volumes/T3/Dev/qt/qt5_cmake/qtbase/src/corelib/mimetypes/mime/packages/freedesktop.org.xml"
+ PROPERTIES alias "freedesktop.org.xml"
+)
+add_qt_resource(tst_qmimedatabase-xml "mimetypes"
+ PREFIX
+ "/qt-project.org/qmime/packages"
+ BASE
+ "/Volumes/T3/Dev/qt/qt5_cmake/qtbase/src/corelib/mimetypes"
+ FILES
+ mime/packages/freedesktop.org.xml
+)
+set_source_files_properties("../qml-again.xml"
+ PROPERTIES alias "qml-again.xml"
+)
+set_source_files_properties("../test.qml"
+ PROPERTIES alias "test.qml"
+)
+set_source_files_properties("../text-x-objcsrc.xml"
+ PROPERTIES alias "text-x-objcsrc.xml"
+)
+set_source_files_properties("../yast2-metapackage-handler-mimetypes.xml"
+ PROPERTIES alias "yast2-metapackage-handler-mimetypes.xml"
+)
+add_qt_resource(tst_qmimedatabase-xml "testdata"
+ PREFIX
+ "/qt-project.org/qmime"
+ BASE
+ ".."
+ FILES
+ invalid-magic1.xml
+ invalid-magic2.xml
+ invalid-magic3.xml
+ magic-and-hierarchy.foo
+ magic-and-hierarchy.xml
+ magic-and-hierarchy2.foo
+ qml-again.xml
+ test.qml
+ text-x-objcsrc.xml
+ yast2-metapackage-handler-mimetypes.xml
+)
+
+
+#### Keys ignored in scope 1:.:.:qmimedatabase-xml.pro:<TRUE>:
+# CONFIG = "testcase"
+
+## Scopes:
+#####################################################################
+
+extend_target(tst_qmimedatabase-xml CONDITION 2*_x_ - g
+ COMPILE_OPTIONS
+ -W
+ -Wall
+ -Wextra
+ -Wno-long-long
+ -Wnon-virtual-dtor
+ -Wshadow
+)
+
+extend_target(tst_qmimedatabase-xml CONDITION UNIX AND NOT APPLE AND NOT QNX
+ DEFINES
+ USE_XDG_DATA_DIRS
+)
diff --git a/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-xml/CMakeLists.txt b/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-xml/CMakeLists.txt
index 526b63aafa..e8c5a9e9f4 100644
--- a/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-xml/CMakeLists.txt
+++ b/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-xml/CMakeLists.txt
@@ -5,11 +5,12 @@
#####################################################################
add_qt_test(tst_qmimedatabase-xml
+ GUI
SOURCES
../tst_qmimedatabase.h
tst_qmimedatabase-xml.cpp
PUBLIC_LIBRARIES
- Qt::ConcurrentPrivate
+ Qt::Concurrent
)
# Resources:
@@ -25,7 +26,6 @@ set_source_files_properties("../text-x-objcsrc.xml"
set_source_files_properties("../yast2-metapackage-handler-mimetypes.xml"
PROPERTIES alias "yast2-metapackage-handler-mimetypes.xml"
)
-
add_qt_resource(tst_qmimedatabase-xml "testdata"
PREFIX
"/qt-project.org/qmime"
@@ -56,7 +56,7 @@ corelib_add_mimetypes_resources(tst_qmimedatabase-xml)
## Scopes:
#####################################################################
-extend_target(tst_qmimedatabase-xml CONDITION CMAKE_COMPILER_IS_GNUCXX
+extend_target(tst_qmimedatabase-xml CONDITION CMAKE_COMPILER_IS_GNUCXX # special case
COMPILE_OPTIONS
-W
-Wall
@@ -66,7 +66,7 @@ extend_target(tst_qmimedatabase-xml CONDITION CMAKE_COMPILER_IS_GNUCXX
-Wshadow
)
-extend_target(tst_qmimedatabase-xml CONDITION UNIX AND NOT APPLE_OSX AND NOT QNX
+extend_target(tst_qmimedatabase-xml CONDITION UNIX AND NOT APPLE AND NOT QNX
DEFINES
USE_XDG_DATA_DIRS
)