diff options
author | Luca Di Sera <luca.disera@qt.io> | 2024-04-17 17:48:14 +0200 |
---|---|---|
committer | Luca Di Sera <luca.disera@qt.io> | 2024-04-23 09:47:01 +0200 |
commit | 1126785007af4e7867a17a83ba6c08f262c20ceb (patch) | |
tree | 694f52887d7899de79a7e313ab6b5a21407c818c | |
parent | d48b5545a91c4d5ca41ef68ccfeca8ffe74c88e3 (diff) |
qmltc: Move qlmtc_build_failures to tst_qmltc_qprocess
`qmltc_build_failures` uses the available CMake infrastructure to test
for expected build-level failures from a `qmltc` compilation.
This allows tracking failures over certain constructs that
`qmltc` should not support, but has an high amount of friction when
extended, as each "test case" needs to be its own whole project, and
doesn't provide an error-level granularity for the failures, so that the
success of a "test case" might depend on a failure that is different
from the intended one.
`tst_qmltc_qprocess` has the infrastructure required to run failing
`qmltc` builds in a leaner way, provides an easier extension story, based on
the general and well-known testlib-based structure and allows to
have tests with an error-level granularity.
Hence, remove `qmltc_build_failures` and move the existing "test case"
to `tst_qmltc_qprocess`.
Change-Id: Ib11227c0da1f6336e6537bea76011ccc0090039f
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
-rw-r--r-- | tests/auto/cmake/CMakeLists.txt | 3 | ||||
-rw-r--r-- | tests/auto/cmake/qmltc_build_failures/CMakeLists.txt | 7 | ||||
-rw-r--r-- | tests/auto/cmake/qmltc_build_failures/nontoplevelrequiredproperty/CMakeLists.txt | 26 | ||||
-rw-r--r-- | tests/auto/cmake/qmltc_build_failures/nontoplevelrequiredproperty/main.cpp | 3 | ||||
-rw-r--r-- | tests/auto/qml/qmltc_qprocess/CMakeLists.txt | 1 | ||||
-rw-r--r-- | tests/auto/qml/qmltc_qprocess/data/innerLevelRequiredProperty.qml (renamed from tests/auto/cmake/qmltc_build_failures/nontoplevelrequiredproperty/Main.qml) | 0 | ||||
-rw-r--r-- | tests/auto/qml/qmltc_qprocess/tst_qmltc_qprocess.cpp | 11 |
7 files changed, 12 insertions, 39 deletions
diff --git a/tests/auto/cmake/CMakeLists.txt b/tests/auto/cmake/CMakeLists.txt index 16893b77e4..0e168cf6ad 100644 --- a/tests/auto/cmake/CMakeLists.txt +++ b/tests/auto/cmake/CMakeLists.txt @@ -155,7 +155,4 @@ if(TARGET Qt::Quick) ) endif() endif() - - add_subdirectory(qmltc_build_failures) endif() - diff --git a/tests/auto/cmake/qmltc_build_failures/CMakeLists.txt b/tests/auto/cmake/qmltc_build_failures/CMakeLists.txt deleted file mode 100644 index 25d62b807d..0000000000 --- a/tests/auto/cmake/qmltc_build_failures/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -# Copyright (C) 2024 The Qt Company Ltd. -# SPDX-License-Identifier: BSD-3-Clause - -cmake_minimum_required(VERSION 3.16) -project(qmltc_build_failures) - -_qt_internal_test_expect_build_fail(nontoplevelrequiredproperty) diff --git a/tests/auto/cmake/qmltc_build_failures/nontoplevelrequiredproperty/CMakeLists.txt b/tests/auto/cmake/qmltc_build_failures/nontoplevelrequiredproperty/CMakeLists.txt deleted file mode 100644 index 1e28a9b817..0000000000 --- a/tests/auto/cmake/qmltc_build_failures/nontoplevelrequiredproperty/CMakeLists.txt +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright (C) 2024 The Qt Company Ltd. -# SPDX-License-Identifier: BSD-3-Clause - -cmake_minimum_required(VERSION 3.16) - -project(nontoplevelrequiredproperty) - -find_package(Qt6 REQUIRED Quick REQUIRED ${Qt6Tests_PREFIX_PATH}) - -qt_standard_project_setup() - -qt_add_executable(executable - main.cpp -) - -qt6_add_qml_module(executable - VERSION 1.0 - URI QmltcBuildFailures - QML_FILES - Main.qml - DEPENDENCIES - QtQuick - ENABLE_TYPE_COMPILER -) - -target_link_libraries(executable PRIVATE Qt6::Quick) diff --git a/tests/auto/cmake/qmltc_build_failures/nontoplevelrequiredproperty/main.cpp b/tests/auto/cmake/qmltc_build_failures/nontoplevelrequiredproperty/main.cpp deleted file mode 100644 index 2cd0d051b6..0000000000 --- a/tests/auto/cmake/qmltc_build_failures/nontoplevelrequiredproperty/main.cpp +++ /dev/null @@ -1,3 +0,0 @@ -#include "main.h" - -int main() { } diff --git a/tests/auto/qml/qmltc_qprocess/CMakeLists.txt b/tests/auto/qml/qmltc_qprocess/CMakeLists.txt index e3addf5baf..85c01d0a5f 100644 --- a/tests/auto/qml/qmltc_qprocess/CMakeLists.txt +++ b/tests/auto/qml/qmltc_qprocess/CMakeLists.txt @@ -47,6 +47,7 @@ qt6_add_qml_module(tst_qmltc_qprocess data/unboundRequiredPropertyInInlineComponent.qml data/componentDefinitionInnerRequiredProperty.qml data/componentDefinitionInnerRequiredPropertyFromOutside.qml + data/innerLevelRequiredProperty.qml ) set(common_libraries diff --git a/tests/auto/cmake/qmltc_build_failures/nontoplevelrequiredproperty/Main.qml b/tests/auto/qml/qmltc_qprocess/data/innerLevelRequiredProperty.qml index 8b28418670..8b28418670 100644 --- a/tests/auto/cmake/qmltc_build_failures/nontoplevelrequiredproperty/Main.qml +++ b/tests/auto/qml/qmltc_qprocess/data/innerLevelRequiredProperty.qml diff --git a/tests/auto/qml/qmltc_qprocess/tst_qmltc_qprocess.cpp b/tests/auto/qml/qmltc_qprocess/tst_qmltc_qprocess.cpp index 9558c98a46..31c27c3cd7 100644 --- a/tests/auto/qml/qmltc_qprocess/tst_qmltc_qprocess.cpp +++ b/tests/auto/qml/qmltc_qprocess/tst_qmltc_qprocess.cpp @@ -58,6 +58,7 @@ private slots: void unboundRequiredPropertyInInlineComponent(); void componentDefinitionInnerRequiredProperty(); void componentDefinitionInnerRequiredPropertyFromOutside(); + void innerLevelRequiredProperty(); }; #ifndef TST_QMLTC_QPROCESS_RESOURCES @@ -374,5 +375,15 @@ void tst_qmltc_qprocess::componentDefinitionInnerRequiredPropertyFromOutside() } } +void tst_qmltc_qprocess::innerLevelRequiredProperty() +{ + { + const auto errors = runQmltc(u"innerLevelRequiredProperty.qml"_s, false); + QVERIFY(errors.contains( + u"innerLevelRequiredProperty.qml:7:5: Component is missing required property foo from here [required]" + )); + } +} + QTEST_MAIN(tst_qmltc_qprocess) #include "tst_qmltc_qprocess.moc" |