diff options
Diffstat (limited to 'tests/auto/blackbox')
5 files changed, 60 insertions, 0 deletions
diff --git a/tests/auto/blackbox/testdata/missing-dependency/main.cpp b/tests/auto/blackbox/testdata/missing-dependency/main.cpp new file mode 100644 index 000000000..ee2bdf30e --- /dev/null +++ b/tests/auto/blackbox/testdata/missing-dependency/main.cpp @@ -0,0 +1,5 @@ +#include <theHeader.h> + +int main() +{ +} diff --git a/tests/auto/blackbox/testdata/missing-dependency/missing-dependency.qbs b/tests/auto/blackbox/testdata/missing-dependency/missing-dependency.qbs new file mode 100644 index 000000000..e3a37d415 --- /dev/null +++ b/tests/auto/blackbox/testdata/missing-dependency/missing-dependency.qbs @@ -0,0 +1,39 @@ +import qbs +import qbs.TextFile + +Project { + Product { + name: "theDep" + type: ["genheader"] + + // TODO: Remove in 1.6 + Group { + files: ["theHeader.h.in"] + fileTags: ["header.in"] + } + + Rule { + inputs: ["header.in"] + Artifact { + filePath: project.buildDirectory + "/theHeader.h" + fileTags: product.type + } + prepare: { + var cmd = new JavaScriptCommand(); + cmd.silent = true; + cmd.sourceCode = function() { + var f = new TextFile(output.filePath, TextFile.WriteOnly); + f.close(); + } + return [cmd]; + } + } + } + CppApplication { + name: "theApp" + cpp.includePaths: [project.buildDirectory] + files: ["main.cpp"] + } +} + + diff --git a/tests/auto/blackbox/testdata/missing-dependency/theHeader.h.in b/tests/auto/blackbox/testdata/missing-dependency/theHeader.h.in new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/tests/auto/blackbox/testdata/missing-dependency/theHeader.h.in diff --git a/tests/auto/blackbox/tst_blackbox.cpp b/tests/auto/blackbox/tst_blackbox.cpp index e1f05b534..a46d02fe5 100644 --- a/tests/auto/blackbox/tst_blackbox.cpp +++ b/tests/auto/blackbox/tst_blackbox.cpp @@ -3880,6 +3880,21 @@ void TestBlackbox::lrelease() QVERIFY(!regularFileExists(relativeProductBuildDir("lrelease-test") + "/hu.qm")); } +void TestBlackbox::missingDependency() +{ + QDir::setCurrent(testDataDir + "/missing-dependency"); + QbsRunParameters params; + params.expectFailure = true; + params.arguments << "-p" << "theApp"; + QVERIFY(runQbs(params) != 0); + QVERIFY2(!m_qbsStderr.contains("ASSERT"), m_qbsStderr.constData()); + QCOMPARE(runQbs(QbsRunParameters(QStringList() << "-p" << "theDep")), 0); + params.expectFailure = false; + params.arguments << "-vv"; + QCOMPARE(runQbs(params), 0); + QVERIFY(m_qbsStderr.contains("false positive")); +} + void TestBlackbox::badInterpreter() { if (!HostOsInfo::isAnyUnixHost()) diff --git a/tests/auto/blackbox/tst_blackbox.h b/tests/auto/blackbox/tst_blackbox.h index be4c3a8fc..22a435c07 100644 --- a/tests/auto/blackbox/tst_blackbox.h +++ b/tests/auto/blackbox/tst_blackbox.h @@ -160,6 +160,7 @@ private slots: void listPropertyOrder(); void loadableModule(); void lrelease(); + void missingDependency(); void missingProfile(); void mixedBuildVariants(); void multipleChanges(); |