From 4ec248512e9238acaebe7db089da4106473301aa Mon Sep 17 00:00:00 2001 From: Luca Di Sera Date: Wed, 12 Apr 2023 15:44:16 +0200 Subject: QDoc: Remove relative paths to QDoc files from QDoc test projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit QDoc tests are organized into a series of different projects under the "tests/auto/qdoc" directory. Many of those projects uses a subset of QDoc source and header files to perform tests on a subset of QDoc functionalities. The CMake target description for those projects refers to those required files through the use of relative paths, going back up and down the filesystem structure to the "src/qdoc" directory and the files themselves. Due to a recent change in QDoc directory structure, those relative paths were broken, breaking the tests as a consequence, thus requiring modification to test projects' "CMakeLists.txt" files to align to the new structure. While we don't expect QDoc directory structure to change often, we can reduce the friction of doing so in the future by centralizing the definition for the base path of those relative paths. To do so, "tests/auto/qdoc/CMakeLists.txt", the "parent" "CMakeLists.txt" file to QDoc's test projects, was modified to provide two variables, `QDOC_SOURCE_DIRECTORY` and `QDOC_INCLUDE_DIRECTORY`. Both variable refer to a suitable path that can be used as the base for finding source file and header files, respectively. The "CMakeLists.txt" files for the affected test projects were modified to use `QDOC_INCLUDE_DIRECTORIES` in the `INCLUDE_DIRECTORIES` property for their test target, replacing the relative path to the QDoc source directory. Similarly, they were modified to use "QDOC_SOURCE_DIRECTORY" as the base path for the inclusion of C++ source files under the `SOURCES` property of their test target. Some of the test project target included certain used headers files under their `SOURCES` property. As the availability of those headers is implicit under the provided `INCLUDE_DIRECTORIES` property of the target, all paths to headers files were removed from under the `SOURCES` property. Albeit a restructuring such as the one that was performed would still break the tests configuration, having a single place of failure to change is expected to alleviate the issue. Change-Id: I9f0bd42a61a7dd436d70e19e7d38820bf9b54662 Reviewed-by: Paul Wicking Reviewed-by: Qt CI Bot Reviewed-by: Topi Reiniƶ --- tests/auto/qdoc/CMakeLists.txt | 3 +++ tests/auto/qdoc/config/CMakeLists.txt | 10 +++++----- tests/auto/qdoc/qdoc/CMakeLists.txt | 10 +++++----- tests/auto/qdoc/qdoccommandlineparser/CMakeLists.txt | 6 +++--- tests/auto/qdoc/utilities/CMakeLists.txt | 4 ++-- 5 files changed, 18 insertions(+), 15 deletions(-) (limited to 'tests') diff --git a/tests/auto/qdoc/CMakeLists.txt b/tests/auto/qdoc/CMakeLists.txt index a75fdcaf3..a2c3ae274 100644 --- a/tests/auto/qdoc/CMakeLists.txt +++ b/tests/auto/qdoc/CMakeLists.txt @@ -6,6 +6,9 @@ if(CMAKE_VERSION VERSION_LESS "3.19" AND MSVC AND QT_FEATURE_debug_and_release) return() endif() +set(QDOC_SOURCE_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/../../../src/qdoc/qdoc/) +set(QDOC_INCLUDE_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/../../../src/qdoc/qdoc/) + add_subdirectory(catch_generators) add_subdirectory(qdoc) add_subdirectory(config) diff --git a/tests/auto/qdoc/config/CMakeLists.txt b/tests/auto/qdoc/config/CMakeLists.txt index b1d132e48..cc863fba6 100644 --- a/tests/auto/qdoc/config/CMakeLists.txt +++ b/tests/auto/qdoc/config/CMakeLists.txt @@ -7,11 +7,11 @@ qt_internal_add_test(tst_config SOURCES - ../../../../src/qdoc/qdoc/config.cpp ../../../../src/qdoc/qdoc/config.h - ../../../../src/qdoc/qdoc/location.cpp ../../../../src/qdoc/qdoc/location.h - ../../../../src/qdoc/qdoc/qdoccommandlineparser.cpp ../../../../src/qdoc/qdoc/qdoccommandlineparser.h - ../../../../src/qdoc/qdoc/utilities.cpp ../../../../src/qdoc/qdoc/utilities.h + ${QDOC_SOURCE_DIRECTORY}/config.cpp + ${QDOC_SOURCE_DIRECTORY}/location.cpp + ${QDOC_SOURCE_DIRECTORY}/qdoccommandlineparser.cpp + ${QDOC_SOURCE_DIRECTORY}/utilities.cpp tst_config.cpp INCLUDE_DIRECTORIES - ../../../../src/qdoc/qdoc + ${QDOC_INCLUDE_DIRECTORY} ) diff --git a/tests/auto/qdoc/qdoc/CMakeLists.txt b/tests/auto/qdoc/qdoc/CMakeLists.txt index 9c3897305..fdebe3541 100644 --- a/tests/auto/qdoc/qdoc/CMakeLists.txt +++ b/tests/auto/qdoc/qdoc/CMakeLists.txt @@ -9,12 +9,12 @@ qt_internal_add_test(tst_QDoc boundaries/filesystem/catch_directorypath.cpp filesystem/catch_fileresolver.cpp - ../../../../src/qdoc/qdoc/boundaries/filesystem/filepath.cpp - ../../../../src/qdoc/qdoc/boundaries/filesystem/directorypath.cpp - ../../../../src/qdoc/qdoc/boundaries/filesystem/resolvedfile.cpp - ../../../../src/qdoc/qdoc/filesystem/fileresolver.cpp + ${QDOC_SOURCE_DIRECTORY}/boundaries/filesystem/filepath.cpp + ${QDOC_SOURCE_DIRECTORY}/boundaries/filesystem/directorypath.cpp + ${QDOC_SOURCE_DIRECTORY}/boundaries/filesystem/resolvedfile.cpp + ${QDOC_SOURCE_DIRECTORY}/filesystem/fileresolver.cpp INCLUDE_DIRECTORIES - ../../../../src/qdoc/qdoc/ + ${QDOC_INCLUDE_DIRECTORY} ../catch/ ../catch_generators/ ../catch_conversions/ diff --git a/tests/auto/qdoc/qdoccommandlineparser/CMakeLists.txt b/tests/auto/qdoc/qdoccommandlineparser/CMakeLists.txt index ef0103f11..325f022d7 100644 --- a/tests/auto/qdoc/qdoccommandlineparser/CMakeLists.txt +++ b/tests/auto/qdoc/qdoccommandlineparser/CMakeLists.txt @@ -9,11 +9,11 @@ qt_internal_add_test(tst_qdoccommandlineparser WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" SOURCES - ../../../../src/qdoc/qdoc/qdoccommandlineparser.cpp ../../../../src/qdoc/qdoc/qdoccommandlineparser.h - ../../../../src/qdoc/qdoc/utilities.cpp ../../../../src/qdoc/qdoc/utilities.h + ${QDOC_SOURCE_DIRECTORY}/qdoccommandlineparser.cpp + ${QDOC_SOURCE_DIRECTORY}/utilities.cpp tst_qdoccommandlineparser.cpp INCLUDE_DIRECTORIES - ../../../../src/qdoc/qdoc + ${QDOC_INCLUDE_DIRECTORY} ) # Resources: diff --git a/tests/auto/qdoc/utilities/CMakeLists.txt b/tests/auto/qdoc/utilities/CMakeLists.txt index a23eff6e9..ecd83ea82 100644 --- a/tests/auto/qdoc/utilities/CMakeLists.txt +++ b/tests/auto/qdoc/utilities/CMakeLists.txt @@ -7,8 +7,8 @@ qt_internal_add_test(tst_utilities SOURCES - ../../../../src/qdoc/qdoc/utilities.cpp ../../../../src/qdoc/qdoc/utilities.h + ${QDOC_SOURCE_DIRECTORY}/utilities.cpp tst_utilities.cpp INCLUDE_DIRECTORIES - ../../../../src/qdoc/qdoc + ${QDOC_INCLUDE_DIRECTORY} ) -- cgit v1.2.1