diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2018-07-17 14:53:56 +0200 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2018-07-31 08:34:24 +0000 |
commit | d020016e9ece106c0214d050aa3a5802357aeb55 (patch) | |
tree | 450d0b0e859e1a2ba3640eac1c801b26161043bc /tests/auto/api | |
parent | f8ba1f5c8d029840d24f342e92b116e5d107a835 (diff) |
Make sure the set of root artifacts is always up to date
... by updating it whenever artifact file tags change.
Change-Id: I62496ba73f7633888de6be16aca59777a53629ed
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'tests/auto/api')
-rw-r--r-- | tests/auto/api/testdata/target-artifact-status/target-artifact-status.qbs | 28 | ||||
-rw-r--r-- | tests/auto/api/tst_api.cpp | 30 | ||||
-rw-r--r-- | tests/auto/api/tst_api.h | 2 |
3 files changed, 60 insertions, 0 deletions
diff --git a/tests/auto/api/testdata/target-artifact-status/target-artifact-status.qbs b/tests/auto/api/testdata/target-artifact-status/target-artifact-status.qbs new file mode 100644 index 000000000..2f5776613 --- /dev/null +++ b/tests/auto/api/testdata/target-artifact-status/target-artifact-status.qbs @@ -0,0 +1,28 @@ +import qbs.TextFile + +Product { + name: "p" + type: "p_type" + property bool enableTagging + Rule { + multiplex: true + Artifact { filePath: "a1"; fileTags: "p_type" } + Artifact { filePath: "a2"; fileTags: "x" } + prepare: { + var cmd = new JavaScriptCommand(); + cmd.description = "generating outputs"; + cmd.sourceCode = function() { + var f = new TextFile(outputs.p_type[0].filePath, TextFile.WriteOnly); + f.close(); + f = new TextFile(outputs.x[0].filePath, TextFile.WriteOnly); + f.close(); + }; + return cmd; + } + } + Group { + condition: enableTagging + fileTagsFilter: "x" + fileTags: "p_type" + } +} diff --git a/tests/auto/api/tst_api.cpp b/tests/auto/api/tst_api.cpp index 1c31720c8..185a90c56 100644 --- a/tests/auto/api/tst_api.cpp +++ b/tests/auto/api/tst_api.cpp @@ -2733,6 +2733,36 @@ void TestApi::subProjects() qPrintable(errorInfo.toString())); } +void TestApi::targetArtifactStatus_data() +{ + QTest::addColumn<bool>("enableTagging"); + QTest::newRow("tagging off") << false; + QTest::newRow("tagging on") << true; + QTest::newRow("tagging off again") << false; +} + +void TestApi::targetArtifactStatus() +{ + QFETCH(bool, enableTagging); + qbs::SetupProjectParameters params + = defaultSetupParameters("target-artifact-status/target-artifact-status.qbs"); + params.setOverriddenValues({std::make_pair("products.p.enableTagging", enableTagging)}); + const std::unique_ptr<qbs::SetupProjectJob> setupJob(qbs::Project().setupProject(params, + m_logSink, 0)); + waitForFinished(setupJob.get()); + VERIFY_NO_ERROR(setupJob->error()); + const qbs::Project project = setupJob->project(); + QVERIFY(project.isValid()); + const std::unique_ptr<qbs::BuildJob> buildJob(project.buildAllProducts(qbs::BuildOptions())); + QVERIFY(waitForFinished(buildJob.get())); + VERIFY_NO_ERROR(buildJob->error()); + const qbs::ProjectData projectData = project.projectData(); + const QList<qbs::ProductData> products = projectData.products(); + QCOMPARE(products.size(), 1); + const qbs::ProductData product = products.front(); + QCOMPARE(product.targetArtifacts().size(), enableTagging ? 2 : 1); +} + void TestApi::toolInModule() { QVariantMap overrides({std::make_pair("qbs.installRoot", m_workingDataDir diff --git a/tests/auto/api/tst_api.h b/tests/auto/api/tst_api.h index 26f6655ad..9207a7328 100644 --- a/tests/auto/api/tst_api.h +++ b/tests/auto/api/tst_api.h @@ -139,6 +139,8 @@ private slots: void softDependency(); void sourceFileInBuildDir(); void subProjects(); + void targetArtifactStatus_data(); + void targetArtifactStatus(); void toolInModule(); void trackAddQObjectHeader(); void trackRemoveQObjectHeader(); |