From 5f340b9d60db4562ca9ba5e7f3568bf8e816ee42 Mon Sep 17 00:00:00 2001 From: Ivan Komissarov Date: Mon, 3 May 2021 00:07:39 +0200 Subject: Move Windows only tests into TestBlackboxWindows Change-Id: I9a4877db93249a67879f1b68182b19251cdc02a9 Reviewed-by: Christian Kandeler --- .../testdata-windows/innosetup/inc/qbsinc.iss | 0 .../testdata-windows/innosetup/innosetup.qbs | 25 ++++ .../blackbox/testdata-windows/innosetup/test.iss | 6 + .../innosetupDependencies.qbs | 76 ++++++++++++ .../testdata-windows/innosetupDependencies/main.c | 1 + .../innosetupDependencies/test.iss | 8 ++ .../testdata-windows/wix/ExampleScript.bat | 1 + .../testdata-windows/wix/QbsBootstrapper.wxs | 10 ++ .../blackbox/testdata-windows/wix/QbsSetup.wxs | 34 ++++++ tests/auto/blackbox/testdata-windows/wix/Qt.wxs | 5 + .../testdata-windows/wix/WiXInstallers.qbs | 38 ++++++ tests/auto/blackbox/testdata-windows/wix/de.wxl | 1 + .../testdata-windows/wixDependencies/QbsSetup.wxs | 37 ++++++ .../testdata-windows/wixDependencies/main.c | 1 + .../wixDependencies/wixDependencies.qbs | 67 +++++++++++ .../blackbox/testdata/innosetup/inc/qbsinc.iss | 0 .../auto/blackbox/testdata/innosetup/innosetup.qbs | 25 ---- tests/auto/blackbox/testdata/innosetup/test.iss | 6 - .../innosetupDependencies.qbs | 76 ------------ .../blackbox/testdata/innosetupDependencies/main.c | 1 - .../testdata/innosetupDependencies/test.iss | 8 -- tests/auto/blackbox/testdata/wix/ExampleScript.bat | 1 - .../auto/blackbox/testdata/wix/QbsBootstrapper.wxs | 10 -- tests/auto/blackbox/testdata/wix/QbsSetup.wxs | 34 ------ tests/auto/blackbox/testdata/wix/Qt.wxs | 5 - tests/auto/blackbox/testdata/wix/WiXInstallers.qbs | 38 ------ tests/auto/blackbox/testdata/wix/de.wxl | 1 - .../blackbox/testdata/wixDependencies/QbsSetup.wxs | 37 ------ .../auto/blackbox/testdata/wixDependencies/main.c | 1 - .../testdata/wixDependencies/wixDependencies.qbs | 67 ----------- tests/auto/blackbox/tst_blackbox.cpp | 129 -------------------- tests/auto/blackbox/tst_blackbox.h | 4 - tests/auto/blackbox/tst_blackboxwindows.cpp | 133 +++++++++++++++++++++ tests/auto/blackbox/tst_blackboxwindows.h | 4 + 34 files changed, 447 insertions(+), 443 deletions(-) create mode 100644 tests/auto/blackbox/testdata-windows/innosetup/inc/qbsinc.iss create mode 100644 tests/auto/blackbox/testdata-windows/innosetup/innosetup.qbs create mode 100644 tests/auto/blackbox/testdata-windows/innosetup/test.iss create mode 100644 tests/auto/blackbox/testdata-windows/innosetupDependencies/innosetupDependencies.qbs create mode 100644 tests/auto/blackbox/testdata-windows/innosetupDependencies/main.c create mode 100644 tests/auto/blackbox/testdata-windows/innosetupDependencies/test.iss create mode 100644 tests/auto/blackbox/testdata-windows/wix/ExampleScript.bat create mode 100644 tests/auto/blackbox/testdata-windows/wix/QbsBootstrapper.wxs create mode 100644 tests/auto/blackbox/testdata-windows/wix/QbsSetup.wxs create mode 100644 tests/auto/blackbox/testdata-windows/wix/Qt.wxs create mode 100644 tests/auto/blackbox/testdata-windows/wix/WiXInstallers.qbs create mode 100644 tests/auto/blackbox/testdata-windows/wix/de.wxl create mode 100644 tests/auto/blackbox/testdata-windows/wixDependencies/QbsSetup.wxs create mode 100644 tests/auto/blackbox/testdata-windows/wixDependencies/main.c create mode 100644 tests/auto/blackbox/testdata-windows/wixDependencies/wixDependencies.qbs delete mode 100644 tests/auto/blackbox/testdata/innosetup/inc/qbsinc.iss delete mode 100644 tests/auto/blackbox/testdata/innosetup/innosetup.qbs delete mode 100644 tests/auto/blackbox/testdata/innosetup/test.iss delete mode 100644 tests/auto/blackbox/testdata/innosetupDependencies/innosetupDependencies.qbs delete mode 100644 tests/auto/blackbox/testdata/innosetupDependencies/main.c delete mode 100644 tests/auto/blackbox/testdata/innosetupDependencies/test.iss delete mode 100644 tests/auto/blackbox/testdata/wix/ExampleScript.bat delete mode 100644 tests/auto/blackbox/testdata/wix/QbsBootstrapper.wxs delete mode 100644 tests/auto/blackbox/testdata/wix/QbsSetup.wxs delete mode 100644 tests/auto/blackbox/testdata/wix/Qt.wxs delete mode 100644 tests/auto/blackbox/testdata/wix/WiXInstallers.qbs delete mode 100644 tests/auto/blackbox/testdata/wix/de.wxl delete mode 100644 tests/auto/blackbox/testdata/wixDependencies/QbsSetup.wxs delete mode 100644 tests/auto/blackbox/testdata/wixDependencies/main.c delete mode 100644 tests/auto/blackbox/testdata/wixDependencies/wixDependencies.qbs (limited to 'tests') diff --git a/tests/auto/blackbox/testdata-windows/innosetup/inc/qbsinc.iss b/tests/auto/blackbox/testdata-windows/innosetup/inc/qbsinc.iss new file mode 100644 index 000000000..e69de29bb diff --git a/tests/auto/blackbox/testdata-windows/innosetup/innosetup.qbs b/tests/auto/blackbox/testdata-windows/innosetup/innosetup.qbs new file mode 100644 index 000000000..718dec6f5 --- /dev/null +++ b/tests/auto/blackbox/testdata-windows/innosetup/innosetup.qbs @@ -0,0 +1,25 @@ +import qbs.FileInfo + +Project { + InnoSetup { + property bool _test: { + var present = qbs.targetOS.contains("windows") && innosetup.present; + console.info("has innosetup: " + present); + } + + name: "QbsSetup" + targetName: "qbs.setup.test" + version: "1.5" + files: [ + "test.iss" + ] + innosetup.verboseOutput: true + innosetup.includePaths: ["inc"] + innosetup.defines: ["MyProgram=" + name, "MyProgramVersion=" + version] + innosetup.compilerFlags: ["/V9"] + } + InnoSetup { + name: "Example1" + files: [FileInfo.joinPaths(innosetup.toolchainInstallPath, "Examples", name + ".iss")] + } +} diff --git a/tests/auto/blackbox/testdata-windows/innosetup/test.iss b/tests/auto/blackbox/testdata-windows/innosetup/test.iss new file mode 100644 index 000000000..f9f9195a6 --- /dev/null +++ b/tests/auto/blackbox/testdata-windows/innosetup/test.iss @@ -0,0 +1,6 @@ +#include "qbsinc.iss" + +[Setup] +AppName={#MyProgram} +AppVersion={#MyProgramVersion} +DefaultDirName={pf}\{#MyProgram} diff --git a/tests/auto/blackbox/testdata-windows/innosetupDependencies/innosetupDependencies.qbs b/tests/auto/blackbox/testdata-windows/innosetupDependencies/innosetupDependencies.qbs new file mode 100644 index 000000000..ab68d3011 --- /dev/null +++ b/tests/auto/blackbox/testdata-windows/innosetupDependencies/innosetupDependencies.qbs @@ -0,0 +1,76 @@ +import qbs.TextFile + +Project { + InnoSetup { + property bool _test: { + var present = qbs.targetOS.contains("windows") && innosetup.present; + console.info("has innosetup: " + present); + } + Depends { name: "app" } + Depends { name: "lib" } + name: "QbsSetup" + targetName: "qbs.setup.test" + version: "1.5" + files: [ + "test.iss" + ] + innosetup.verboseOutput: true + innosetup.defines: [ + "MyProgram=" + name, + "MyProgramVersion=" + version, + "buildDirectory=" + project.buildDirectory + ] + innosetup.compilerFlags: ["/V9"] + destinationDirectory: project.buildDirectory + } + Application { + Depends { name: "cpp" } + name: "app" + files: ["main.c"] + Group { + fileTagsFilter: product.type + qbs.install: true + } + destinationDirectory: project.buildDirectory + } + DynamicLibrary { + Depends { name: "cpp" } + name: "lib" + files: ["main.c"] + Group { + fileTagsFilter: product.type + qbs.install: true + } + Rule { + // This rule tries to provoke the installer into building too early (and the test + // verifies that it does not) by causing the build of the installables to take + // a lot longer. + multiplex: true + outputFileTags: ["c"] + outputArtifacts: { + var artifacts = []; + for (var i = 0; i < 96; ++i) + artifacts.push({ filePath: "c" + i + ".c", fileTags: ["c"] }); + return artifacts; + } + prepare: { + var cmd = new JavaScriptCommand(); + cmd.silent = true; + cmd.sourceCode = function() { + for (var i = 0; i < outputs["c"].length; ++i) { + var tf; + try { + tf = new TextFile(outputs["c"][i].filePath, TextFile.WriteOnly); + tf.writeLine("int main" + i + "() { return 0; }"); + } finally { + if (tf) + tf.close(); + } + } + }; + return [cmd]; + } + } + destinationDirectory: project.buildDirectory + } +} diff --git a/tests/auto/blackbox/testdata-windows/innosetupDependencies/main.c b/tests/auto/blackbox/testdata-windows/innosetupDependencies/main.c new file mode 100644 index 000000000..76e819701 --- /dev/null +++ b/tests/auto/blackbox/testdata-windows/innosetupDependencies/main.c @@ -0,0 +1 @@ +int main() { return 0; } diff --git a/tests/auto/blackbox/testdata-windows/innosetupDependencies/test.iss b/tests/auto/blackbox/testdata-windows/innosetupDependencies/test.iss new file mode 100644 index 000000000..430f9941b --- /dev/null +++ b/tests/auto/blackbox/testdata-windows/innosetupDependencies/test.iss @@ -0,0 +1,8 @@ +[Setup] +AppName={#MyProgram} +AppVersion={#MyProgramVersion} +DefaultDirName={pf}\{#MyProgram} + +[Files] +Source: "{#buildDirectory}\app.exe"; DestDir: "{app}" +Source: "{#buildDirectory}\lib.dll"; DestDir: "{app}" diff --git a/tests/auto/blackbox/testdata-windows/wix/ExampleScript.bat b/tests/auto/blackbox/testdata-windows/wix/ExampleScript.bat new file mode 100644 index 000000000..3af583cd8 --- /dev/null +++ b/tests/auto/blackbox/testdata-windows/wix/ExampleScript.bat @@ -0,0 +1 @@ +echo Hello world! diff --git a/tests/auto/blackbox/testdata-windows/wix/QbsBootstrapper.wxs b/tests/auto/blackbox/testdata-windows/wix/QbsBootstrapper.wxs new file mode 100644 index 000000000..272f6af5b --- /dev/null +++ b/tests/auto/blackbox/testdata-windows/wix/QbsBootstrapper.wxs @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/tests/auto/blackbox/testdata-windows/wix/QbsSetup.wxs b/tests/auto/blackbox/testdata-windows/wix/QbsSetup.wxs new file mode 100644 index 000000000..8f97ff667 --- /dev/null +++ b/tests/auto/blackbox/testdata-windows/wix/QbsSetup.wxs @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/auto/blackbox/testdata-windows/wix/Qt.wxs b/tests/auto/blackbox/testdata-windows/wix/Qt.wxs new file mode 100644 index 000000000..fbd992c43 --- /dev/null +++ b/tests/auto/blackbox/testdata-windows/wix/Qt.wxs @@ -0,0 +1,5 @@ + + + + + diff --git a/tests/auto/blackbox/testdata-windows/wix/WiXInstallers.qbs b/tests/auto/blackbox/testdata-windows/wix/WiXInstallers.qbs new file mode 100644 index 000000000..07f61ba2c --- /dev/null +++ b/tests/auto/blackbox/testdata-windows/wix/WiXInstallers.qbs @@ -0,0 +1,38 @@ +import qbs.FileInfo + +Project { + WindowsInstallerPackage { + name: "QbsSetup" + targetName: "qbs" + files: ["QbsSetup.wxs", "ExampleScript.bat"] + wix.defines: ["scriptName=ExampleScript.bat"] + wix.extensions: ["WixBalExtension", "WixUIExtension"] + qbs.targetPlatform: "windows" + + Export { + Depends { name: "wix" } + wix.defines: base.concat(["msiName=" + + FileInfo.joinPaths(product.buildDirectory, + product.targetName + wix.windowsInstallerSuffix)]) + } + } + + WindowsSetupPackage { + Depends { name: "QbsSetup" } + condition: qbs.hostOS.contains("windows") // currently does not work in Wine with WiX 3.9 + name: "QbsBootstrapper" + targetName: "qbs-setup-" + qbs.architecture + files: ["QbsBootstrapper.wxs"] + qbs.architecture: original || "x86" + qbs.targetPlatform: "windows" + } + + WindowsInstallerPackage { + name: "RegressionBuster9000" + files: ["QbsSetup.wxs", "Qt.wxs", "de.wxl"] + wix.defines: ["scriptName=ExampleScript.bat"] + wix.cultures: [] + qbs.architecture: original || "x86" + qbs.targetPlatform: "windows" + } +} diff --git a/tests/auto/blackbox/testdata-windows/wix/de.wxl b/tests/auto/blackbox/testdata-windows/wix/de.wxl new file mode 100644 index 000000000..75394cfdd --- /dev/null +++ b/tests/auto/blackbox/testdata-windows/wix/de.wxl @@ -0,0 +1 @@ + diff --git a/tests/auto/blackbox/testdata-windows/wixDependencies/QbsSetup.wxs b/tests/auto/blackbox/testdata-windows/wixDependencies/QbsSetup.wxs new file mode 100644 index 000000000..ec839a269 --- /dev/null +++ b/tests/auto/blackbox/testdata-windows/wixDependencies/QbsSetup.wxs @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/auto/blackbox/testdata-windows/wixDependencies/main.c b/tests/auto/blackbox/testdata-windows/wixDependencies/main.c new file mode 100644 index 000000000..76e819701 --- /dev/null +++ b/tests/auto/blackbox/testdata-windows/wixDependencies/main.c @@ -0,0 +1 @@ +int main() { return 0; } diff --git a/tests/auto/blackbox/testdata-windows/wixDependencies/wixDependencies.qbs b/tests/auto/blackbox/testdata-windows/wixDependencies/wixDependencies.qbs new file mode 100644 index 000000000..d42a18054 --- /dev/null +++ b/tests/auto/blackbox/testdata-windows/wixDependencies/wixDependencies.qbs @@ -0,0 +1,67 @@ +import qbs.TextFile + +Project { + WindowsInstallerPackage { + Depends { name: "app" } + Depends { name: "lib" } + name: "QbsSetup" + targetName: "qbs" + files: ["QbsSetup.wxs"] + wix.extensions: ["WixBalExtension", "WixUIExtension"] + destinationDirectory: project.buildDirectory + } + + Application { + Depends { name: "cpp" } + name: "app" + files: ["main.c"] + Group { + fileTagsFilter: product.type + qbs.install: true + } + destinationDirectory: project.buildDirectory + } + + DynamicLibrary { + Depends { name: "cpp" } + name: "lib" + files: ["main.c"] + Group { + fileTagsFilter: product.type + qbs.install: true + } + Rule { + // This rule tries to provoke the installer into building too early (and the test + // verifies that it does not) by causing the build of the installables to take + // a lot longer. + multiplex: true + outputFileTags: ["c"] + outputArtifacts: { + var artifacts = []; + for (var i = 0; i < 96; ++i) + artifacts.push({ filePath: "c" + i + ".c", fileTags: ["c"] }); + return artifacts; + } + prepare: { + var cmd = new JavaScriptCommand(); + cmd.silent = true; + cmd.sourceCode = function() { + for (var j = 0; j < 1000; ++j) { // Artificial delay. + for (var i = 0; i < outputs["c"].length; ++i) { + var tf; + try { + tf = new TextFile(outputs["c"][i].filePath, TextFile.WriteOnly); + tf.writeLine("int main" + i + "() { return 0; }"); + } finally { + if (tf) + tf.close(); + } + } + } + }; + return [cmd]; + } + } + destinationDirectory: project.buildDirectory + } +} diff --git a/tests/auto/blackbox/testdata/innosetup/inc/qbsinc.iss b/tests/auto/blackbox/testdata/innosetup/inc/qbsinc.iss deleted file mode 100644 index e69de29bb..000000000 diff --git a/tests/auto/blackbox/testdata/innosetup/innosetup.qbs b/tests/auto/blackbox/testdata/innosetup/innosetup.qbs deleted file mode 100644 index 718dec6f5..000000000 --- a/tests/auto/blackbox/testdata/innosetup/innosetup.qbs +++ /dev/null @@ -1,25 +0,0 @@ -import qbs.FileInfo - -Project { - InnoSetup { - property bool _test: { - var present = qbs.targetOS.contains("windows") && innosetup.present; - console.info("has innosetup: " + present); - } - - name: "QbsSetup" - targetName: "qbs.setup.test" - version: "1.5" - files: [ - "test.iss" - ] - innosetup.verboseOutput: true - innosetup.includePaths: ["inc"] - innosetup.defines: ["MyProgram=" + name, "MyProgramVersion=" + version] - innosetup.compilerFlags: ["/V9"] - } - InnoSetup { - name: "Example1" - files: [FileInfo.joinPaths(innosetup.toolchainInstallPath, "Examples", name + ".iss")] - } -} diff --git a/tests/auto/blackbox/testdata/innosetup/test.iss b/tests/auto/blackbox/testdata/innosetup/test.iss deleted file mode 100644 index f9f9195a6..000000000 --- a/tests/auto/blackbox/testdata/innosetup/test.iss +++ /dev/null @@ -1,6 +0,0 @@ -#include "qbsinc.iss" - -[Setup] -AppName={#MyProgram} -AppVersion={#MyProgramVersion} -DefaultDirName={pf}\{#MyProgram} diff --git a/tests/auto/blackbox/testdata/innosetupDependencies/innosetupDependencies.qbs b/tests/auto/blackbox/testdata/innosetupDependencies/innosetupDependencies.qbs deleted file mode 100644 index ab68d3011..000000000 --- a/tests/auto/blackbox/testdata/innosetupDependencies/innosetupDependencies.qbs +++ /dev/null @@ -1,76 +0,0 @@ -import qbs.TextFile - -Project { - InnoSetup { - property bool _test: { - var present = qbs.targetOS.contains("windows") && innosetup.present; - console.info("has innosetup: " + present); - } - Depends { name: "app" } - Depends { name: "lib" } - name: "QbsSetup" - targetName: "qbs.setup.test" - version: "1.5" - files: [ - "test.iss" - ] - innosetup.verboseOutput: true - innosetup.defines: [ - "MyProgram=" + name, - "MyProgramVersion=" + version, - "buildDirectory=" + project.buildDirectory - ] - innosetup.compilerFlags: ["/V9"] - destinationDirectory: project.buildDirectory - } - Application { - Depends { name: "cpp" } - name: "app" - files: ["main.c"] - Group { - fileTagsFilter: product.type - qbs.install: true - } - destinationDirectory: project.buildDirectory - } - DynamicLibrary { - Depends { name: "cpp" } - name: "lib" - files: ["main.c"] - Group { - fileTagsFilter: product.type - qbs.install: true - } - Rule { - // This rule tries to provoke the installer into building too early (and the test - // verifies that it does not) by causing the build of the installables to take - // a lot longer. - multiplex: true - outputFileTags: ["c"] - outputArtifacts: { - var artifacts = []; - for (var i = 0; i < 96; ++i) - artifacts.push({ filePath: "c" + i + ".c", fileTags: ["c"] }); - return artifacts; - } - prepare: { - var cmd = new JavaScriptCommand(); - cmd.silent = true; - cmd.sourceCode = function() { - for (var i = 0; i < outputs["c"].length; ++i) { - var tf; - try { - tf = new TextFile(outputs["c"][i].filePath, TextFile.WriteOnly); - tf.writeLine("int main" + i + "() { return 0; }"); - } finally { - if (tf) - tf.close(); - } - } - }; - return [cmd]; - } - } - destinationDirectory: project.buildDirectory - } -} diff --git a/tests/auto/blackbox/testdata/innosetupDependencies/main.c b/tests/auto/blackbox/testdata/innosetupDependencies/main.c deleted file mode 100644 index 76e819701..000000000 --- a/tests/auto/blackbox/testdata/innosetupDependencies/main.c +++ /dev/null @@ -1 +0,0 @@ -int main() { return 0; } diff --git a/tests/auto/blackbox/testdata/innosetupDependencies/test.iss b/tests/auto/blackbox/testdata/innosetupDependencies/test.iss deleted file mode 100644 index 430f9941b..000000000 --- a/tests/auto/blackbox/testdata/innosetupDependencies/test.iss +++ /dev/null @@ -1,8 +0,0 @@ -[Setup] -AppName={#MyProgram} -AppVersion={#MyProgramVersion} -DefaultDirName={pf}\{#MyProgram} - -[Files] -Source: "{#buildDirectory}\app.exe"; DestDir: "{app}" -Source: "{#buildDirectory}\lib.dll"; DestDir: "{app}" diff --git a/tests/auto/blackbox/testdata/wix/ExampleScript.bat b/tests/auto/blackbox/testdata/wix/ExampleScript.bat deleted file mode 100644 index 3af583cd8..000000000 --- a/tests/auto/blackbox/testdata/wix/ExampleScript.bat +++ /dev/null @@ -1 +0,0 @@ -echo Hello world! diff --git a/tests/auto/blackbox/testdata/wix/QbsBootstrapper.wxs b/tests/auto/blackbox/testdata/wix/QbsBootstrapper.wxs deleted file mode 100644 index 272f6af5b..000000000 --- a/tests/auto/blackbox/testdata/wix/QbsBootstrapper.wxs +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/tests/auto/blackbox/testdata/wix/QbsSetup.wxs b/tests/auto/blackbox/testdata/wix/QbsSetup.wxs deleted file mode 100644 index 8f97ff667..000000000 --- a/tests/auto/blackbox/testdata/wix/QbsSetup.wxs +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/auto/blackbox/testdata/wix/Qt.wxs b/tests/auto/blackbox/testdata/wix/Qt.wxs deleted file mode 100644 index fbd992c43..000000000 --- a/tests/auto/blackbox/testdata/wix/Qt.wxs +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/tests/auto/blackbox/testdata/wix/WiXInstallers.qbs b/tests/auto/blackbox/testdata/wix/WiXInstallers.qbs deleted file mode 100644 index 07f61ba2c..000000000 --- a/tests/auto/blackbox/testdata/wix/WiXInstallers.qbs +++ /dev/null @@ -1,38 +0,0 @@ -import qbs.FileInfo - -Project { - WindowsInstallerPackage { - name: "QbsSetup" - targetName: "qbs" - files: ["QbsSetup.wxs", "ExampleScript.bat"] - wix.defines: ["scriptName=ExampleScript.bat"] - wix.extensions: ["WixBalExtension", "WixUIExtension"] - qbs.targetPlatform: "windows" - - Export { - Depends { name: "wix" } - wix.defines: base.concat(["msiName=" + - FileInfo.joinPaths(product.buildDirectory, - product.targetName + wix.windowsInstallerSuffix)]) - } - } - - WindowsSetupPackage { - Depends { name: "QbsSetup" } - condition: qbs.hostOS.contains("windows") // currently does not work in Wine with WiX 3.9 - name: "QbsBootstrapper" - targetName: "qbs-setup-" + qbs.architecture - files: ["QbsBootstrapper.wxs"] - qbs.architecture: original || "x86" - qbs.targetPlatform: "windows" - } - - WindowsInstallerPackage { - name: "RegressionBuster9000" - files: ["QbsSetup.wxs", "Qt.wxs", "de.wxl"] - wix.defines: ["scriptName=ExampleScript.bat"] - wix.cultures: [] - qbs.architecture: original || "x86" - qbs.targetPlatform: "windows" - } -} diff --git a/tests/auto/blackbox/testdata/wix/de.wxl b/tests/auto/blackbox/testdata/wix/de.wxl deleted file mode 100644 index 75394cfdd..000000000 --- a/tests/auto/blackbox/testdata/wix/de.wxl +++ /dev/null @@ -1 +0,0 @@ - diff --git a/tests/auto/blackbox/testdata/wixDependencies/QbsSetup.wxs b/tests/auto/blackbox/testdata/wixDependencies/QbsSetup.wxs deleted file mode 100644 index ec839a269..000000000 --- a/tests/auto/blackbox/testdata/wixDependencies/QbsSetup.wxs +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/auto/blackbox/testdata/wixDependencies/main.c b/tests/auto/blackbox/testdata/wixDependencies/main.c deleted file mode 100644 index 76e819701..000000000 --- a/tests/auto/blackbox/testdata/wixDependencies/main.c +++ /dev/null @@ -1 +0,0 @@ -int main() { return 0; } diff --git a/tests/auto/blackbox/testdata/wixDependencies/wixDependencies.qbs b/tests/auto/blackbox/testdata/wixDependencies/wixDependencies.qbs deleted file mode 100644 index d42a18054..000000000 --- a/tests/auto/blackbox/testdata/wixDependencies/wixDependencies.qbs +++ /dev/null @@ -1,67 +0,0 @@ -import qbs.TextFile - -Project { - WindowsInstallerPackage { - Depends { name: "app" } - Depends { name: "lib" } - name: "QbsSetup" - targetName: "qbs" - files: ["QbsSetup.wxs"] - wix.extensions: ["WixBalExtension", "WixUIExtension"] - destinationDirectory: project.buildDirectory - } - - Application { - Depends { name: "cpp" } - name: "app" - files: ["main.c"] - Group { - fileTagsFilter: product.type - qbs.install: true - } - destinationDirectory: project.buildDirectory - } - - DynamicLibrary { - Depends { name: "cpp" } - name: "lib" - files: ["main.c"] - Group { - fileTagsFilter: product.type - qbs.install: true - } - Rule { - // This rule tries to provoke the installer into building too early (and the test - // verifies that it does not) by causing the build of the installables to take - // a lot longer. - multiplex: true - outputFileTags: ["c"] - outputArtifacts: { - var artifacts = []; - for (var i = 0; i < 96; ++i) - artifacts.push({ filePath: "c" + i + ".c", fileTags: ["c"] }); - return artifacts; - } - prepare: { - var cmd = new JavaScriptCommand(); - cmd.silent = true; - cmd.sourceCode = function() { - for (var j = 0; j < 1000; ++j) { // Artificial delay. - for (var i = 0; i < outputs["c"].length; ++i) { - var tf; - try { - tf = new TextFile(outputs["c"][i].filePath, TextFile.WriteOnly); - tf.writeLine("int main" + i + "() { return 0; }"); - } finally { - if (tf) - tf.close(); - } - } - } - }; - return [cmd]; - } - } - destinationDirectory: project.buildDirectory - } -} diff --git a/tests/auto/blackbox/tst_blackbox.cpp b/tests/auto/blackbox/tst_blackbox.cpp index 7d75ab91f..1082ba595 100644 --- a/tests/auto/blackbox/tst_blackbox.cpp +++ b/tests/auto/blackbox/tst_blackbox.cpp @@ -7423,94 +7423,6 @@ void TestBlackbox::generator_data() QTest::newRow("no update") << QString() << QStringList(); } -static bool haveWiX(const Profile &profile) -{ - if (profile.value("wix.toolchainInstallPath").isValid() && - profile.value("wix.toolchainInstallRoot").isValid()) { - return true; - } - - QStringList regKeys; - regKeys << QStringLiteral("HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows Installer XML\\") - << QStringLiteral("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows Installer XML\\"); - - QStringList paths = QProcessEnvironment::systemEnvironment().value("PATH") - .split(HostOsInfo::pathListSeparator(), QBS_SKIP_EMPTY_PARTS); - - for (const QString &key : qAsConst(regKeys)) { - const QStringList versions = QSettings(key, QSettings::NativeFormat).childGroups(); - for (const QString &version : versions) { - QSettings settings(key + version, QSettings::NativeFormat); - QString str = settings.value(QStringLiteral("InstallRoot")).toString(); - if (!str.isEmpty()) - paths.prepend(str); - } - } - - for (const QString &path : qAsConst(paths)) { - if (regularFileExists(QDir::fromNativeSeparators(path) + - HostOsInfo::appendExecutableSuffix(QStringLiteral("/candle"))) && - regularFileExists(QDir::fromNativeSeparators(path) + - HostOsInfo::appendExecutableSuffix(QStringLiteral("/light")))) { - return true; - } - } - - return false; -} - -void TestBlackbox::wix() -{ - const SettingsPtr s = settings(); - Profile profile(profileName(), s.get()); - - if (!haveWiX(profile)) { - QSKIP("WiX is not installed"); - return; - } - - QByteArray arch = profile.value("qbs.architecture").toString().toLatin1(); - if (arch.isEmpty()) - arch = QByteArrayLiteral("x86"); - - QDir::setCurrent(testDataDir + "/wix"); - QCOMPARE(runQbs(), 0); - QVERIFY2(m_qbsStdout.contains("compiling QbsSetup.wxs"), m_qbsStdout); - QVERIFY2(m_qbsStdout.contains("linking qbs.msi"), m_qbsStdout); - QVERIFY(regularFileExists(relativeProductBuildDir("QbsSetup") + "/qbs.msi")); - - if (HostOsInfo::isWindowsHost()) { - QVERIFY2(m_qbsStdout.contains("compiling QbsBootstrapper.wxs"), m_qbsStdout); - QVERIFY2(m_qbsStdout.contains("linking qbs-setup-" + arch + ".exe"), m_qbsStdout); - QVERIFY(regularFileExists(relativeProductBuildDir("QbsBootstrapper") - + "/qbs-setup-" + arch + ".exe")); - } -} - -void TestBlackbox::wixDependencies() -{ - const SettingsPtr s = settings(); - Profile profile(profileName(), s.get()); - - if (!haveWiX(profile)) { - QSKIP("WiX is not installed"); - return; - } - - QByteArray arch = profile.value("qbs.architecture").toString().toLatin1(); - if (arch.isEmpty()) - arch = QByteArrayLiteral("x86"); - - QDir::setCurrent(testDataDir + "/wixDependencies"); - QbsRunParameters params; - if (!HostOsInfo::isWindowsHost()) - params.arguments << "qbs.targetOS:windows"; - QCOMPARE(runQbs(params), 0); - QVERIFY2(m_qbsStdout.contains("compiling QbsSetup.wxs"), m_qbsStdout); - QVERIFY2(m_qbsStdout.contains("linking qbs.msi"), m_qbsStdout); - QVERIFY(regularFileExists(relativeBuildDir() + "/qbs.msi")); -} - void TestBlackbox::nodejs() { const SettingsPtr s = settings(); @@ -7628,47 +7540,6 @@ void TestBlackbox::includeLookup() QVERIFY2(m_qbsStdout.contains("definition.."), m_qbsStdout.constData()); } -void TestBlackbox::innoSetup() -{ - const SettingsPtr s = settings(); - Profile profile(profileName(), s.get()); - - QDir::setCurrent(testDataDir + "/innosetup"); - - QCOMPARE(runQbs({"resolve"}), 0); - const bool withInnosetup = m_qbsStdout.contains("has innosetup: true"); - const bool withoutInnosetup = m_qbsStdout.contains("has innosetup: false"); - QVERIFY2(withInnosetup || withoutInnosetup, m_qbsStdout.constData()); - if (withoutInnosetup) - QSKIP("innosetup module not present"); - - QCOMPARE(runQbs(), 0); - QVERIFY(m_qbsStdout.contains("compiling test.iss")); - QVERIFY(m_qbsStdout.contains("compiling Example1.iss")); - QVERIFY(regularFileExists(relativeProductBuildDir("QbsSetup") + "/qbs.setup.test.exe")); - QVERIFY(regularFileExists(relativeProductBuildDir("Example1") + "/Example1.exe")); -} - -void TestBlackbox::innoSetupDependencies() -{ - const SettingsPtr s = settings(); - Profile profile(profileName(), s.get()); - - QDir::setCurrent(testDataDir + "/innosetupDependencies"); - - QCOMPARE(runQbs({"resolve"}), 0); - const bool withInnosetup = m_qbsStdout.contains("has innosetup: true"); - const bool withoutInnosetup = m_qbsStdout.contains("has innosetup: false"); - QVERIFY2(withInnosetup || withoutInnosetup, m_qbsStdout.constData()); - if (withoutInnosetup) - QSKIP("innosetup module not present"); - - QbsRunParameters params; - QCOMPARE(runQbs(params), 0); - QVERIFY(m_qbsStdout.contains("compiling test.iss")); - QVERIFY(regularFileExists(relativeBuildDir() + "/qbs.setup.test.exe")); -} - void TestBlackbox::inputTagsChangeTracking_data() { QTest::addColumn("generateInput"); diff --git a/tests/auto/blackbox/tst_blackbox.h b/tests/auto/blackbox/tst_blackbox.h index 942cb6b47..6395eb679 100644 --- a/tests/auto/blackbox/tst_blackbox.h +++ b/tests/auto/blackbox/tst_blackbox.h @@ -143,8 +143,6 @@ private slots: void importingProduct(); void importsConflict(); void includeLookup(); - void innoSetup(); - void innoSetupDependencies(); void inputTagsChangeTracking_data(); void inputTagsChangeTracking(); void inputsFromDependencies(); @@ -337,8 +335,6 @@ private slots: void wholeArchive_data(); void wildCardsAndRules(); void wildcardRenaming(); - void wix(); - void wixDependencies(); void zip(); void zip_data(); void zipInvalid(); diff --git a/tests/auto/blackbox/tst_blackboxwindows.cpp b/tests/auto/blackbox/tst_blackboxwindows.cpp index 0c82754fb..d1d62496c 100644 --- a/tests/auto/blackbox/tst_blackboxwindows.cpp +++ b/tests/auto/blackbox/tst_blackboxwindows.cpp @@ -33,11 +33,14 @@ #include "../shared.h" #include +#include +#include #include #include using qbs::Internal::HostOsInfo; +using qbs::Profile; struct SigntoolInfo { @@ -117,6 +120,47 @@ void TestBlackboxWindows::initTestCase() TestBlackboxBase::initTestCase(); } +void TestBlackboxWindows::innoSetup() +{ + const SettingsPtr s = settings(); + Profile profile(profileName(), s.get()); + + QDir::setCurrent(testDataDir + "/innosetup"); + + QCOMPARE(runQbs({"resolve"}), 0); + const bool withInnosetup = m_qbsStdout.contains("has innosetup: true"); + const bool withoutInnosetup = m_qbsStdout.contains("has innosetup: false"); + QVERIFY2(withInnosetup || withoutInnosetup, m_qbsStdout.constData()); + if (withoutInnosetup) + QSKIP("innosetup module not present"); + + QCOMPARE(runQbs(), 0); + QVERIFY(m_qbsStdout.contains("compiling test.iss")); + QVERIFY(m_qbsStdout.contains("compiling Example1.iss")); + QVERIFY(regularFileExists(relativeProductBuildDir("QbsSetup") + "/qbs.setup.test.exe")); + QVERIFY(regularFileExists(relativeProductBuildDir("Example1") + "/Example1.exe")); +} + +void TestBlackboxWindows::innoSetupDependencies() +{ + const SettingsPtr s = settings(); + Profile profile(profileName(), s.get()); + + QDir::setCurrent(testDataDir + "/innosetupDependencies"); + + QCOMPARE(runQbs({"resolve"}), 0); + const bool withInnosetup = m_qbsStdout.contains("has innosetup: true"); + const bool withoutInnosetup = m_qbsStdout.contains("has innosetup: false"); + QVERIFY2(withInnosetup || withoutInnosetup, m_qbsStdout.constData()); + if (withoutInnosetup) + QSKIP("innosetup module not present"); + + QbsRunParameters params; + QCOMPARE(runQbs(params), 0); + QVERIFY(m_qbsStdout.contains("compiling test.iss")); + QVERIFY(regularFileExists(relativeBuildDir() + "/qbs.setup.test.exe")); +} + void TestBlackboxWindows::standaloneCodesign() { QFETCH(SigntoolInfo::CodeSignResult, result); @@ -171,4 +215,93 @@ void TestBlackboxWindows::standaloneCodesign_data() << "http://timestamp.digicert.com"; } + +static bool haveWiX(const Profile &profile) +{ + if (profile.value("wix.toolchainInstallPath").isValid() && + profile.value("wix.toolchainInstallRoot").isValid()) { + return true; + } + + QStringList regKeys; + regKeys << QStringLiteral("HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows Installer XML\\") + << QStringLiteral("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows Installer XML\\"); + + QStringList paths = QProcessEnvironment::systemEnvironment().value("PATH") + .split(HostOsInfo::pathListSeparator(), QBS_SKIP_EMPTY_PARTS); + + for (const QString &key : qAsConst(regKeys)) { + const QStringList versions = QSettings(key, QSettings::NativeFormat).childGroups(); + for (const QString &version : versions) { + QSettings settings(key + version, QSettings::NativeFormat); + QString str = settings.value(QStringLiteral("InstallRoot")).toString(); + if (!str.isEmpty()) + paths.prepend(str); + } + } + + for (const QString &path : qAsConst(paths)) { + if (regularFileExists(QDir::fromNativeSeparators(path) + + HostOsInfo::appendExecutableSuffix(QStringLiteral("/candle"))) && + regularFileExists(QDir::fromNativeSeparators(path) + + HostOsInfo::appendExecutableSuffix(QStringLiteral("/light")))) { + return true; + } + } + + return false; +} + +void TestBlackboxWindows::wix() +{ + const SettingsPtr s = settings(); + Profile profile(profileName(), s.get()); + + if (!haveWiX(profile)) { + QSKIP("WiX is not installed"); + return; + } + + QByteArray arch = profile.value("qbs.architecture").toString().toLatin1(); + if (arch.isEmpty()) + arch = QByteArrayLiteral("x86"); + + QDir::setCurrent(testDataDir + "/wix"); + QCOMPARE(runQbs(), 0); + QVERIFY2(m_qbsStdout.contains("compiling QbsSetup.wxs"), m_qbsStdout); + QVERIFY2(m_qbsStdout.contains("linking qbs.msi"), m_qbsStdout); + QVERIFY(regularFileExists(relativeProductBuildDir("QbsSetup") + "/qbs.msi")); + + if (HostOsInfo::isWindowsHost()) { + QVERIFY2(m_qbsStdout.contains("compiling QbsBootstrapper.wxs"), m_qbsStdout); + QVERIFY2(m_qbsStdout.contains("linking qbs-setup-" + arch + ".exe"), m_qbsStdout); + QVERIFY(regularFileExists(relativeProductBuildDir("QbsBootstrapper") + + "/qbs-setup-" + arch + ".exe")); + } +} + +void TestBlackboxWindows::wixDependencies() +{ + const SettingsPtr s = settings(); + Profile profile(profileName(), s.get()); + + if (!haveWiX(profile)) { + QSKIP("WiX is not installed"); + return; + } + + QByteArray arch = profile.value("qbs.architecture").toString().toLatin1(); + if (arch.isEmpty()) + arch = QByteArrayLiteral("x86"); + + QDir::setCurrent(testDataDir + "/wixDependencies"); + QbsRunParameters params; + if (!HostOsInfo::isWindowsHost()) + params.arguments << "qbs.targetOS:windows"; + QCOMPARE(runQbs(params), 0); + QVERIFY2(m_qbsStdout.contains("compiling QbsSetup.wxs"), m_qbsStdout); + QVERIFY2(m_qbsStdout.contains("linking qbs.msi"), m_qbsStdout); + QVERIFY(regularFileExists(relativeBuildDir() + "/qbs.msi")); +} + QTEST_MAIN(TestBlackboxWindows) diff --git a/tests/auto/blackbox/tst_blackboxwindows.h b/tests/auto/blackbox/tst_blackboxwindows.h index fbc597313..ad8d60ca3 100644 --- a/tests/auto/blackbox/tst_blackboxwindows.h +++ b/tests/auto/blackbox/tst_blackboxwindows.h @@ -44,8 +44,12 @@ public slots: void initTestCase() override; private slots: + void innoSetup(); + void innoSetupDependencies(); void standaloneCodesign(); void standaloneCodesign_data(); + void wix(); + void wixDependencies(); }; #endif // TST_BLACKBOXWINDOWS_H -- cgit v1.2.3