aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2017-01-05 15:16:41 +0100
committerChristian Kandeler <christian.kandeler@qt.io>2017-01-05 17:01:57 +0000
commita64a0ef5fc454b18a9474b39517a100d8f1fdf3c (patch)
tree4cca84f4a6746a087e7d3ef1e9d3c21d31b92bfe /tests
parenta6533f11d5d7129a86cfccf3248aa62081f31588 (diff)
Do not leak the build graph locker if project resolving is cancelledv1.7.1
Task-number: QTCREATORBUG-17543 Change-Id: Ie32f5e9729dc98705b0d0d27839d9544ffd29a43 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/api/tst_api.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/tests/auto/api/tst_api.cpp b/tests/auto/api/tst_api.cpp
index cbc0a5237..284b04e07 100644
--- a/tests/auto/api/tst_api.cpp
+++ b/tests/auto/api/tst_api.cpp
@@ -283,7 +283,7 @@ void TestApi::buildGraphLocking()
qPrintable(setupJob->error().toString()));
QVERIFY2(QFileInfo(lockFile).isFile(), qPrintable(lockFile));
- // Case 3: Changing the build directory of an existing project to something con-competing.
+ // Case 3: Changing the build directory of an existing project to something non-competing.
qbs::SetupProjectParameters setupParams3 = setupParams2;
setupParams3.setBuildRoot(setupParams.buildRoot() + "/3");
setupJob.reset(qbs::Project().setupProject(setupParams3, m_logSink, 0));
@@ -294,6 +294,19 @@ void TestApi::buildGraphLocking()
const QString newLockFile = setupParams3.buildRoot() + '/' + buildDirName + '/'
+ buildDirName + ".bg.lock";
QVERIFY2(QFileInfo(newLockFile).isFile(), qPrintable(newLockFile));
+ qbs::Project project3 = setupJob->project();
+ QVERIFY(project3.isValid());
+
+ // Case 4: Changing the build directory again, but cancelling the job.
+ setupJob.reset(project3.setupProject(setupParams2, m_logSink, 0));
+ setupJob->cancel();
+ waitForFinished(setupJob.data());
+ QVERIFY(setupJob->error().hasError());
+ QVERIFY2(!QFileInfo(lockFile).exists(), qPrintable(lockFile));
+ QVERIFY2(QFileInfo(newLockFile).isFile(), qPrintable(newLockFile));
+ setupJob.reset(nullptr);
+ project3 = qbs::Project();
+ QVERIFY2(!QFileInfo(newLockFile).exists(), qPrintable(newLockFile));
}
void TestApi::buildProject()