diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2018-04-30 15:55:34 +0200 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2018-05-07 06:58:47 +0000 |
commit | 3096c93ded3ea0fff0c3b239982ab0d446f352a3 (patch) | |
tree | 4c28bbcf1f0e3fbf7a82d164632f2c947f93b631 /tests | |
parent | 4a1c5a12928cc434f06132ea9a3f7e501115636c (diff) |
Add AutotestRunner.auxiliaryInputs
This is a set of file tags representing run-time dependencies of the
test executables.
[ChangeLog] Added the AutotestRunner.auxiliaryInputs property for
specifying run-time dependencies of test executables
Change-Id: If1ac6256d83f535b8be859a096062f07b0070729
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'tests')
5 files changed, 53 insertions, 0 deletions
diff --git a/tests/auto/blackbox/testdata/autotest-with-dependencies/autotest-with-dependencies.qbs b/tests/auto/blackbox/testdata/autotest-with-dependencies/autotest-with-dependencies.qbs new file mode 100644 index 000000000..a94cb3d78 --- /dev/null +++ b/tests/auto/blackbox/testdata/autotest-with-dependencies/autotest-with-dependencies.qbs @@ -0,0 +1,27 @@ +import qbs +import qbs.FileInfo + +Project { + CppApplication { + name: "helper-app" + type: ["application", "test-helper"] + files: "helper-main.cpp" + cpp.executableSuffix: ".exe" + Group { + fileTagsFilter: "application" + fileTags: "test-helper" + qbs.install: true + qbs.installDir: "bin" + } + } + CppApplication { + name: "test-app" + type: ["application", "autotest"] + files: "test-main.cpp" + } + + AutotestRunner { + arguments: FileInfo.joinPaths(qbs.installRoot, qbs.installPrefix, "bin") + auxiliaryInputs: "test-helper" + } +} diff --git a/tests/auto/blackbox/testdata/autotest-with-dependencies/helper-main.cpp b/tests/auto/blackbox/testdata/autotest-with-dependencies/helper-main.cpp new file mode 100644 index 000000000..b5a07ecd5 --- /dev/null +++ b/tests/auto/blackbox/testdata/autotest-with-dependencies/helper-main.cpp @@ -0,0 +1,7 @@ +#include <iostream> + +int main() +{ + std::cout << "i am the helper" << std::endl; + return 0; +} diff --git a/tests/auto/blackbox/testdata/autotest-with-dependencies/test-main.cpp b/tests/auto/blackbox/testdata/autotest-with-dependencies/test-main.cpp new file mode 100644 index 000000000..382049ea8 --- /dev/null +++ b/tests/auto/blackbox/testdata/autotest-with-dependencies/test-main.cpp @@ -0,0 +1,10 @@ +#include <cstdlib> +#include <iostream> +#include <string> + +int main(int argc, char *argv[]) +{ + std::cout << "i am the test app" << std::endl; + const std::string fullHelperExe = std::string(argv[1]) + "/helper-app.exe"; + return std::system(fullHelperExe.c_str()) == 0 ? EXIT_SUCCESS : EXIT_FAILURE; +} diff --git a/tests/auto/blackbox/tst_blackbox.cpp b/tests/auto/blackbox/tst_blackbox.cpp index e548a0236..8fd6d347c 100644 --- a/tests/auto/blackbox/tst_blackbox.cpp +++ b/tests/auto/blackbox/tst_blackbox.cpp @@ -4914,6 +4914,14 @@ void TestBlackbox::assembly() QCOMPARE(m_qbsStdout.contains("creating testd.lib"), haveMSVC); } +void TestBlackbox::autotestWithDependencies() +{ + QDir::setCurrent(testDataDir + "/autotest-with-dependencies"); + QCOMPARE(runQbs(QStringList({"-p", "autotest-runner"})), 0); + QVERIFY2(m_qbsStdout.contains("i am the test app") + && m_qbsStdout.contains("i am the helper"), m_qbsStdout.constData()); +} + void TestBlackbox::auxiliaryInputsFromDependencies() { QDir::setCurrent(testDataDir + "/aux-inputs-from-deps"); diff --git a/tests/auto/blackbox/tst_blackbox.h b/tests/auto/blackbox/tst_blackbox.h index 746c885fa..2804f513c 100644 --- a/tests/auto/blackbox/tst_blackbox.h +++ b/tests/auto/blackbox/tst_blackbox.h @@ -47,6 +47,7 @@ private slots: void artifactsMapRaceCondition(); void artifactScanning(); void assembly(); + void autotestWithDependencies(); void auxiliaryInputsFromDependencies(); void badInterpreter(); void buildDataOfDisabledProduct(); |