diff options
author | Jake Petroules <jake.petroules@petroules.com> | 2014-04-07 12:45:13 -0400 |
---|---|---|
committer | Jake Petroules <jake.petroules@petroules.com> | 2014-04-11 01:27:34 +0200 |
commit | 9ab4669eff693e80090db5ad2f08633518f5abde (patch) | |
tree | 03036e7bdf73f2a6d0eee70eaec9cefd50be3478 | |
parent | 317a76c0d11f10270a8747c64bd82fd387c9f8b6 (diff) |
Fix WiX test and turn it into an autotest.
Change-Id: Ifd1cdfc54e7566146a478cf0833a6f67196735cd
Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
-rw-r--r-- | tests/auto/blackbox/testdata/wix/ExampleScript.bat (renamed from tests/manual/WiXInstallers/ExampleScript.bat) | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | tests/auto/blackbox/testdata/wix/QbsBootstrapper.wxs (renamed from tests/manual/WiXInstallers/QbsBootstrapper.wxs) | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | tests/auto/blackbox/testdata/wix/QbsSetup.wxs (renamed from tests/manual/WiXInstallers/QbsSetup.wxs) | 0 | ||||
-rw-r--r-- | tests/auto/blackbox/testdata/wix/WiXInstallers.qbs (renamed from tests/manual/WiXInstallers/WiXInstallers.qbs) | 2 | ||||
-rw-r--r-- | tests/auto/blackbox/tst_blackbox.cpp | 57 | ||||
-rw-r--r-- | tests/auto/blackbox/tst_blackbox.h | 1 |
6 files changed, 59 insertions, 1 deletions
diff --git a/tests/manual/WiXInstallers/ExampleScript.bat b/tests/auto/blackbox/testdata/wix/ExampleScript.bat index 3af583cd8..3af583cd8 100644 --- a/tests/manual/WiXInstallers/ExampleScript.bat +++ b/tests/auto/blackbox/testdata/wix/ExampleScript.bat diff --git a/tests/manual/WiXInstallers/QbsBootstrapper.wxs b/tests/auto/blackbox/testdata/wix/QbsBootstrapper.wxs index 272f6af5b..272f6af5b 100755..100644 --- a/tests/manual/WiXInstallers/QbsBootstrapper.wxs +++ b/tests/auto/blackbox/testdata/wix/QbsBootstrapper.wxs diff --git a/tests/manual/WiXInstallers/QbsSetup.wxs b/tests/auto/blackbox/testdata/wix/QbsSetup.wxs index 8f97ff667..8f97ff667 100755..100644 --- a/tests/manual/WiXInstallers/QbsSetup.wxs +++ b/tests/auto/blackbox/testdata/wix/QbsSetup.wxs diff --git a/tests/manual/WiXInstallers/WiXInstallers.qbs b/tests/auto/blackbox/testdata/wix/WiXInstallers.qbs index 59cdf7f4c..6f4adfe8f 100644 --- a/tests/manual/WiXInstallers/WiXInstallers.qbs +++ b/tests/auto/blackbox/testdata/wix/WiXInstallers.qbs @@ -8,7 +8,7 @@ Project { wix.defines: ["scriptName=ExampleScript.bat"] } - BurnSetupPackage { + WindowsSetupPackage { Depends { name: "QbsSetup" } name: "QbsBootstrapper" targetName: "qbs-setup-" + qbs.architecture 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; |