diff options
| author | Jake Petroules <jake.petroules@theqtcompany.com> | 2016-04-13 19:21:02 -0700 |
|---|---|---|
| committer | Jake Petroules <jake.petroules@qt.io> | 2016-04-14 11:49:08 +0000 |
| commit | 9ec50632e8a9a57c1a02b629d322db27142cdcd0 (patch) | |
| tree | 62fd4bbd3108ae6d1c0cb4f59fad3b427ec6654f | |
| parent | de21bd6cb84dded97aaf3260f3f727cea7e7f678 (diff) | |
| download | qbs-9ec50632e8a9a57c1a02b629d322db27142cdcd0.tar.gz | |
Restore original behavior of PathProbe fileName/path properties.
This is a regression caused by ea470c74e4e62831f45faaa898dac8cb06da899b.
Add autotests to verify.
Task-number: QBS-948
Change-Id: I012312de60e9d64107f5621a7fd87acab98190e8
Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
| -rw-r--r-- | share/qbs/imports/qbs/Probes/path-probe.js | 11 | ||||
| -rw-r--r-- | tests/auto/blackbox/testdata/probeProperties/bin/tool | 0 | ||||
| -rw-r--r-- | tests/auto/blackbox/testdata/probeProperties/main.c | 1 | ||||
| -rw-r--r-- | tests/auto/blackbox/testdata/probeProperties/probeProperties.qbs | 30 | ||||
| -rw-r--r-- | tests/auto/blackbox/tst_blackbox.cpp | 13 | ||||
| -rw-r--r-- | tests/auto/blackbox/tst_blackbox.h | 1 |
6 files changed, 54 insertions, 2 deletions
diff --git a/share/qbs/imports/qbs/Probes/path-probe.js b/share/qbs/imports/qbs/Probes/path-probe.js index 4f634876a..53d43b1b1 100644 --- a/share/qbs/imports/qbs/Probes/path-probe.js +++ b/share/qbs/imports/qbs/Probes/path-probe.js @@ -63,8 +63,15 @@ function configure(names, nameSuffixes, nameFilter, pathPrefixes, pathSuffixes, return { found: true, filePath: _filePath, - fileName: FileInfo.fileName(_filePath), - path: FileInfo.path(_filePath) + + // Manually specify the path components that constitute _filePath rather + // than using the FileInfo.path and FileInfo.fileName functions because we + // want to break _filePath into its constituent parts based on the input + // originally given by the user. For example, the FileInfo functions would + // produce a different result if any of the items in the names property + // contained more than a single path component. + fileName: _names[i], + path: FileInfo.joinPaths(_paths[j], _suffixes[k]), } } } diff --git a/tests/auto/blackbox/testdata/probeProperties/bin/tool b/tests/auto/blackbox/testdata/probeProperties/bin/tool new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/tests/auto/blackbox/testdata/probeProperties/bin/tool diff --git a/tests/auto/blackbox/testdata/probeProperties/main.c b/tests/auto/blackbox/testdata/probeProperties/main.c new file mode 100644 index 000000000..76e819701 --- /dev/null +++ b/tests/auto/blackbox/testdata/probeProperties/main.c @@ -0,0 +1 @@ +int main() { return 0; } diff --git a/tests/auto/blackbox/testdata/probeProperties/probeProperties.qbs b/tests/auto/blackbox/testdata/probeProperties/probeProperties.qbs new file mode 100644 index 000000000..36842e40b --- /dev/null +++ b/tests/auto/blackbox/testdata/probeProperties/probeProperties.qbs @@ -0,0 +1,30 @@ +import qbs +import qbs.Probes + +CppApplication { + Probes.PathProbe { + id: probe1 + names: ["bin/tool"] + platformPaths: [product.sourceDirectory] + } + + Probes.PathProbe { + id: probe2 + names: ["tool"] + platformPaths: [product.sourceDirectory + "/bin"] + } + + targetName: { + console.info("probe1.fileName=" + probe1.fileName); + console.info("probe1.path=" + probe1.path); + console.info("probe1.filePath=" + probe1.filePath); + + console.info("probe2.fileName=" + probe2.fileName); + console.info("probe2.path=" + probe2.path); + console.info("probe2.filePath=" + probe2.filePath); + + return name; + } + + files: ["main.c"] +} diff --git a/tests/auto/blackbox/tst_blackbox.cpp b/tests/auto/blackbox/tst_blackbox.cpp index 4a6fdd8b8..98765d9e1 100644 --- a/tests/auto/blackbox/tst_blackbox.cpp +++ b/tests/auto/blackbox/tst_blackbox.cpp @@ -1691,6 +1691,19 @@ void TestBlackbox::overrideProjectProperties() QCOMPARE(runQbs(params), 0); } +void TestBlackbox::probeProperties() +{ + QDir::setCurrent(testDataDir + "/probeProperties"); + const QByteArray dir = QDir::cleanPath(testDataDir).toLatin1() + "/probeProperties"; + QCOMPARE(runQbs(), 0); + QVERIFY2(m_qbsStdout.contains("probe1.fileName=bin/tool"), m_qbsStdout.constData()); + QVERIFY2(m_qbsStdout.contains("probe1.path=" + dir), m_qbsStdout.constData()); + QVERIFY2(m_qbsStdout.contains("probe1.filePath=" + dir + "/bin/tool"), m_qbsStdout.constData()); + QVERIFY2(m_qbsStdout.contains("probe2.fileName=tool"), m_qbsStdout.constData()); + QVERIFY2(m_qbsStdout.contains("probe2.path=" + dir + "/bin"), m_qbsStdout.constData()); + QVERIFY2(m_qbsStdout.contains("probe2.filePath=" + dir + "/bin/tool"), m_qbsStdout.constData()); +} + void TestBlackbox::probeInExportedModule() { QDir::setCurrent(testDataDir + "/probe-in-exported-module"); diff --git a/tests/auto/blackbox/tst_blackbox.h b/tests/auto/blackbox/tst_blackbox.h index 2a087fcbb..770ffed5f 100644 --- a/tests/auto/blackbox/tst_blackbox.h +++ b/tests/auto/blackbox/tst_blackbox.h @@ -160,6 +160,7 @@ private slots: void objcArc(); void outputArtifactAutoTagging(); void overrideProjectProperties(); + void probeProperties(); void probeInExportedModule(); void probesInNestedModules(); void productDependenciesByType(); |
