diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2016-11-09 15:26:48 +0000 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2016-11-09 15:26:48 +0000 |
commit | 448a2ff6dbf1511fbe660d73034140e1efb97830 (patch) | |
tree | 22c339a86d4018cf45d683483c44ffa29ca43cfe /tests | |
parent | 8cbc439b5fc7aa50edeef8fa7fd893aaea59b9dc (diff) | |
parent | 13fb98936634e00444ab466679808ae386a6745f (diff) |
Merge "Merge 1.6 into master"
Diffstat (limited to 'tests')
4 files changed, 70 insertions, 0 deletions
diff --git a/tests/auto/blackbox/testdata/generated-artifact-as-input-to-dynamic-rule/input.txt b/tests/auto/blackbox/testdata/generated-artifact-as-input-to-dynamic-rule/input.txt new file mode 100644 index 000000000..37081c649 --- /dev/null +++ b/tests/auto/blackbox/testdata/generated-artifact-as-input-to-dynamic-rule/input.txt @@ -0,0 +1 @@ +old.txt diff --git a/tests/auto/blackbox/testdata/generated-artifact-as-input-to-dynamic-rule/p.qbs b/tests/auto/blackbox/testdata/generated-artifact-as-input-to-dynamic-rule/p.qbs new file mode 100644 index 000000000..725966c3b --- /dev/null +++ b/tests/auto/blackbox/testdata/generated-artifact-as-input-to-dynamic-rule/p.qbs @@ -0,0 +1,50 @@ +import qbs +import qbs.File +import qbs.TextFile + +Product { + type: ["mytype.final"] + + Group { + files: ["input.txt"] + fileTags: ["mytype.in"] + } + + Rule { + inputs: ["mytype.in"] + Artifact { + filePath: "output.txt" + fileTags: ["mytype.out"] + } + prepare: { + var cmd = new JavaScriptCommand(); + cmd.description = "generating " + output.fileName; + cmd.sourceCode = function() { File.copy(input.filePath, output.filePath); }; + return [cmd]; + } + } + + Rule { + inputs: ["mytype.out"] + outputFileTags: ["mytype.final"] + outputArtifacts: { + var file; + var inFile = new TextFile(input.filePath, TextFile.ReadOnly); + try { + file = inFile.readLine(); + if (!file) + throw "no file name found"; + } finally { + inFile.close(); + } + return [{ filePath: file, fileTags: ["mytype.final"] }]; + } + prepare: { + var cmd = new JavaScriptCommand(); + cmd.description = "generating " + output.fileName; + cmd.sourceCode = function() { File.copy(input.filePath, output.filePath); }; + return [cmd]; + } + } +} + diff --git a/tests/auto/blackbox/tst_blackbox.cpp b/tests/auto/blackbox/tst_blackbox.cpp index 6a3b2e359..fee806d39 100644 --- a/tests/auto/blackbox/tst_blackbox.cpp +++ b/tests/auto/blackbox/tst_blackbox.cpp @@ -3761,6 +3761,24 @@ void TestBlackbox::frameworkStructure() QVERIFY(!directoryExists(relativeProductBuildDir("Widget") + "/Widget.framework/PrivateHeaders")); } +void TestBlackbox::generatedArtifactAsInputToDynamicRule() +{ + QDir::setCurrent(testDataDir + "/generated-artifact-as-input-to-dynamic-rule"); + QCOMPARE(runQbs(), 0); + const QString oldFile = relativeProductBuildDir("p") + "/old.txt"; + QVERIFY2(regularFileExists(oldFile), qPrintable(oldFile)); + WAIT_FOR_NEW_TIMESTAMP(); + QFile inputFile("input.txt"); + QVERIFY2(inputFile.open(QIODevice::WriteOnly), qPrintable(inputFile.errorString())); + inputFile.resize(0); + inputFile.write("new.txt"); + inputFile.close(); + QCOMPARE(runQbs(), 0); + QVERIFY2(!regularFileExists(oldFile), qPrintable(oldFile)); + const QString newFile = relativeProductBuildDir("p") + "/new.txt"; + QVERIFY2(regularFileExists(newFile), qPrintable(oldFile)); +} + static bool haveWiX(const Profile &profile) { if (profile.value("wix.toolchainInstallPath").isValid() && diff --git a/tests/auto/blackbox/tst_blackbox.h b/tests/auto/blackbox/tst_blackbox.h index 9e88caa43..d628cfff0 100644 --- a/tests/auto/blackbox/tst_blackbox.h +++ b/tests/auto/blackbox/tst_blackbox.h @@ -79,6 +79,7 @@ private slots: void exportToOutsideSearchPath(); void fileDependencies(); void frameworkStructure(); + void generatedArtifactAsInputToDynamicRule(); void groupsInModules(); void iconset(); void iconsetApp(); |