aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/blackbox
diff options
context:
space:
mode:
authorJake Petroules <jake.petroules@petroules.com>2014-04-07 12:45:13 -0400
committerJake Petroules <jake.petroules@petroules.com>2014-04-11 01:27:34 +0200
commit9ab4669eff693e80090db5ad2f08633518f5abde (patch)
tree03036e7bdf73f2a6d0eee70eaec9cefd50be3478 /tests/auto/blackbox
parent317a76c0d11f10270a8747c64bd82fd387c9f8b6 (diff)
Fix WiX test and turn it into an autotest.
Change-Id: Ifd1cdfc54e7566146a478cf0833a6f67196735cd Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
Diffstat (limited to 'tests/auto/blackbox')
-rw-r--r--tests/auto/blackbox/testdata/wix/ExampleScript.bat1
-rw-r--r--tests/auto/blackbox/testdata/wix/QbsBootstrapper.wxs10
-rw-r--r--tests/auto/blackbox/testdata/wix/QbsSetup.wxs34
-rw-r--r--tests/auto/blackbox/testdata/wix/WiXInstallers.qbs18
-rw-r--r--tests/auto/blackbox/tst_blackbox.cpp57
-rw-r--r--tests/auto/blackbox/tst_blackbox.h1
6 files changed, 121 insertions, 0 deletions
diff --git a/tests/auto/blackbox/testdata/wix/ExampleScript.bat b/tests/auto/blackbox/testdata/wix/ExampleScript.bat
new file mode 100644
index 000000000..3af583cd8
--- /dev/null
+++ b/tests/auto/blackbox/testdata/wix/ExampleScript.bat
@@ -0,0 +1 @@
+echo Hello world!
diff --git a/tests/auto/blackbox/testdata/wix/QbsBootstrapper.wxs b/tests/auto/blackbox/testdata/wix/QbsBootstrapper.wxs
new file mode 100644
index 000000000..272f6af5b
--- /dev/null
+++ b/tests/auto/blackbox/testdata/wix/QbsBootstrapper.wxs
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
+ <Bundle Name="QbsBootstrapper" Version="1.0.0.0" Manufacturer="Qt Project" UpgradeCode="7b05b159-c9ce-477c-9fb5-7fce3cd50396">
+ <BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense" />
+
+ <Chain>
+ <MsiPackage SourceFile="$(var.msiName)" />
+ </Chain>
+ </Bundle>
+</Wix>
diff --git a/tests/auto/blackbox/testdata/wix/QbsSetup.wxs b/tests/auto/blackbox/testdata/wix/QbsSetup.wxs
new file mode 100644
index 000000000..8f97ff667
--- /dev/null
+++ b/tests/auto/blackbox/testdata/wix/QbsSetup.wxs
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
+ <Product Id="*" Name="QbsSetup" Language="1033" Version="1.0.0.0" Manufacturer="Qt Project" UpgradeCode="f60f643e-b002-44d5-b3f4-edafd078314c">
+ <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
+
+ <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
+ <MediaTemplate />
+
+ <Feature Id="ProductFeature" Title="QbsSetup" Level="1">
+ <ComponentGroupRef Id="ProductComponents" />
+ </Feature>
+ </Product>
+
+ <Fragment>
+ <Directory Id="TARGETDIR" Name="SourceDir">
+ <?ifdef Win64 ?>
+ <?define PlatformProgramFilesFolder = "ProgramFiles64Folder" ?>
+ <?else ?>
+ <?define PlatformProgramFilesFolder = "ProgramFilesFolder" ?>
+ <?endif ?>
+ <Directory Id="$(var.PlatformProgramFilesFolder)">
+ <Directory Id="INSTALLFOLDER" Name="QbsSetup" />
+ </Directory>
+ </Directory>
+ </Fragment>
+
+ <Fragment>
+ <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
+ <Component Id="ProductComponent">
+ <File Source="$(var.project.path)/$(var.scriptName)" />
+ </Component>
+ </ComponentGroup>
+ </Fragment>
+</Wix>
diff --git a/tests/auto/blackbox/testdata/wix/WiXInstallers.qbs b/tests/auto/blackbox/testdata/wix/WiXInstallers.qbs
new file mode 100644
index 000000000..6f4adfe8f
--- /dev/null
+++ b/tests/auto/blackbox/testdata/wix/WiXInstallers.qbs
@@ -0,0 +1,18 @@
+import qbs
+
+Project {
+ WindowsInstallerPackage {
+ name: "QbsSetup"
+ targetName: "qbs-" + qbs.architecture
+ files: ["QbsSetup.wxs", "ExampleScript.bat"]
+ wix.defines: ["scriptName=ExampleScript.bat"]
+ }
+
+ WindowsSetupPackage {
+ Depends { name: "QbsSetup" }
+ name: "QbsBootstrapper"
+ targetName: "qbs-setup-" + qbs.architecture
+ files: ["QbsBootstrapper.wxs"]
+ wix.defines: ["msiName=qbs-" + qbs.architecture + ".msi"]
+ }
+}
diff --git a/tests/auto/blackbox/tst_blackbox.cpp b/tests/auto/blackbox/tst_blackbox.cpp
index e033892a1..e9b067322 100644
--- a/tests/auto/blackbox/tst_blackbox.cpp
+++ b/tests/auto/blackbox/tst_blackbox.cpp
@@ -1921,4 +1921,61 @@ void TestBlackbox::testEmbedInfoPlist()
QVERIFY(runQbs(params) != 0);
}
+static bool haveWiX()
+{
+ QStringList regKeys;
+ regKeys << QLatin1String("HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows Installer XML\\")
+ << QLatin1String("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows Installer XML\\");
+
+ const QStringList versions = QStringList() << "4.0" << "3.9" << "3.8" << "3.7"
+ << "3.6" << "3.5" << "3.0" << "2.0";
+
+ QStringList paths = QProcessEnvironment::systemEnvironment().value("PATH")
+ .split(HostOsInfo::pathListSeparator(), QString::SkipEmptyParts);
+
+ foreach (const QString &version, versions) {
+ foreach (const QString &key, regKeys) {
+ QSettings settings(key + version, QSettings::NativeFormat);
+ QString str = settings.value(QLatin1String("InstallRoot")).toString();
+ if (!str.isEmpty())
+ paths.prepend(str);
+ }
+ }
+
+ foreach (const QString &path, paths) {
+ if (QFile::exists(QDir::fromNativeSeparators(path) +
+ HostOsInfo::appendExecutableSuffix(QLatin1String("/candle"))) &&
+ QFile::exists(QDir::fromNativeSeparators(path) +
+ HostOsInfo::appendExecutableSuffix(QLatin1String("/light")))) {
+ return true;
+ }
+ }
+
+ return false;
+}
+
+void TestBlackbox::testWiX()
+{
+ if (!HostOsInfo::isWindowsHost()) {
+ SKIP_TEST("only applies on Windows");
+ return;
+ }
+
+ if (!haveWiX()) {
+ SKIP_TEST("WiX is not installed");
+ return;
+ }
+
+ SettingsPtr settings = qbsSettings(QString());
+ Profile profile(buildProfileName, settings.data());
+ const QByteArray arch = profile.value("qbs.architecture").toString().toLatin1();
+
+ QDir::setCurrent(testDataDir + "/wix");
+ QCOMPARE(runQbs(), 0);
+ QVERIFY(m_qbsStdout.contains("compiling QbsSetup.wxs"));
+ QVERIFY(m_qbsStdout.contains("compiling QbsBootstrapper.wxs"));
+ QVERIFY(QFile::exists(buildDir + "/qbs-" + arch + ".msi"));
+ QVERIFY(QFile::exists(buildDir + "/qbs-setup-" + arch + ".exe"));
+}
+
QTEST_MAIN(TestBlackbox)
diff --git a/tests/auto/blackbox/tst_blackbox.h b/tests/auto/blackbox/tst_blackbox.h
index a51e8c594..e0d6600eb 100644
--- a/tests/auto/blackbox/tst_blackbox.h
+++ b/tests/auto/blackbox/tst_blackbox.h
@@ -168,6 +168,7 @@ private slots:
void testAssembly();
void testNsis();
void testEmbedInfoPlist();
+ void testWiX();
private:
QByteArray m_qbsStderr;