aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/blackbox/tst_blackbox.cpp
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2024-02-12 15:24:04 +0100
committerChristian Kandeler <christian.kandeler@qt.io>2024-02-13 10:16:37 +0000
commita30e54c2e7fb7d9735a364497914a5df452dd1ad (patch)
treee06d019e7ebe38253c4b64ef1dc9f9c78273ac5c /tests/auto/blackbox/tst_blackbox.cpp
parenteb746c7caf2a1e7427984bbd1d970ebdbd108207 (diff)
Fix wildcard change tracking
We recorded both too many and not enough time stamps for wildcards: - We should not try to track changes regarding recursive wildcards ("**/"), as that can easily pull in large parts of the source tree and/or the project root directory, likely resulting in unwanted re-resolvings. - We should track the parent dir of a wildcard pattern, even if the last evaluation yielded no matches. Change-Id: I8e5521a2fcb7fd1f54103e0df566f33dd6f2a972 Reviewed-by: Ivan Komissarov <ABBAPOH@gmail.com>
Diffstat (limited to 'tests/auto/blackbox/tst_blackbox.cpp')
-rw-r--r--tests/auto/blackbox/tst_blackbox.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/auto/blackbox/tst_blackbox.cpp b/tests/auto/blackbox/tst_blackbox.cpp
index 8ba6e2fa5..395e5aba6 100644
--- a/tests/auto/blackbox/tst_blackbox.cpp
+++ b/tests/auto/blackbox/tst_blackbox.cpp
@@ -8048,6 +8048,35 @@ void TestBlackbox::wildCardsAndRules()
QVERIFY(!m_qbsStdout.contains("creating output artifact"));
}
+void TestBlackbox::wildCardsAndChangeTracking_data()
+{
+ QTest::addColumn<QString>("dirToModify");
+ QTest::addColumn<bool>("expectReResolve");
+
+ QTest::newRow("root path") << QString(".") << false;
+ QTest::newRow("dir with recursive match") << QString("recursive1") << false;
+ QTest::newRow("non-recursive base dir") << QString("nonrecursive") << true;
+ QTest::newRow("empty base dir with file patterns") << QString("nonrecursive/empty") << true;
+}
+
+void TestBlackbox::wildCardsAndChangeTracking()
+{
+ QFETCH(QString, dirToModify);
+ QFETCH(bool, expectReResolve);
+
+ const QString srcDir = testDataDir + "/wildcards-and-change-tracking";
+ QDir::setCurrent(srcDir);
+ rmDirR("default");
+ QDir::current().mkdir("nonrecursive/empty");
+
+ QCOMPARE(runQbs({"resolve"}), 0);
+ QVERIFY2(m_qbsStdout.contains("Resolving"), m_qbsStdout.constData());
+ WAIT_FOR_NEW_TIMESTAMP();
+ touch(dirToModify + "/blubb.txt");
+ QCOMPARE(runQbs({"resolve"}), 0);
+ QCOMPARE(m_qbsStdout.contains("Resolving"), expectReResolve);
+}
+
void TestBlackbox::loadableModule()
{
QDir::setCurrent(testDataDir + QLatin1String("/loadablemodule"));