diff options
author | Jake Petroules <jake.petroules@petroules.com> | 2013-11-14 12:57:26 -0500 |
---|---|---|
committer | Jake Petroules <jake.petroules@petroules.com> | 2013-11-18 14:57:36 +0100 |
commit | 67b0f10356220f6fa485ef9bb49cc1a1b0844d1b (patch) | |
tree | 2814dc8401043ea27ed5108e70c14f2067e3e921 | |
parent | 71b26daecaddfad7d7f63df40a814df253a2b859 (diff) |
Turn NSIS manual test into an autotest.
Change-Id: Ic8db2f80e1b6ebdad61032b3bcd8c8c986b62614
Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
-rwxr-xr-x | tests/auto/blackbox/testdata/nsis/hello.bat (renamed from tests/manual/nsis/hello.bat) | 0 | ||||
-rwxr-xr-x | tests/auto/blackbox/testdata/nsis/hello.nsi (renamed from tests/manual/nsis/hello.nsi) | 0 | ||||
-rwxr-xr-x | tests/auto/blackbox/testdata/nsis/hello.qbs (renamed from tests/manual/nsis/hello.qbs) | 1 | ||||
-rw-r--r-- | tests/auto/blackbox/tst_blackbox.cpp | 40 | ||||
-rw-r--r-- | tests/auto/blackbox/tst_blackbox.h | 1 |
5 files changed, 42 insertions, 0 deletions
diff --git a/tests/manual/nsis/hello.bat b/tests/auto/blackbox/testdata/nsis/hello.bat index 3af583cd8..3af583cd8 100755 --- a/tests/manual/nsis/hello.bat +++ b/tests/auto/blackbox/testdata/nsis/hello.bat diff --git a/tests/manual/nsis/hello.nsi b/tests/auto/blackbox/testdata/nsis/hello.nsi index 70b73056a..70b73056a 100755 --- a/tests/manual/nsis/hello.nsi +++ b/tests/auto/blackbox/testdata/nsis/hello.nsi diff --git a/tests/manual/nsis/hello.qbs b/tests/auto/blackbox/testdata/nsis/hello.qbs index 47465dcf4..b7f3da505 100755 --- a/tests/manual/nsis/hello.qbs +++ b/tests/auto/blackbox/testdata/nsis/hello.qbs @@ -1,6 +1,7 @@ import qbs NSISSetup { + condition: qbs.targetOS.contains("windows") name: "Qbs Hello" targetName: "qbs-hello-" + qbs.architecture files: ["hello.nsi", "hello.bat"] diff --git a/tests/auto/blackbox/tst_blackbox.cpp b/tests/auto/blackbox/tst_blackbox.cpp index 0700df165..bf02d86a8 100644 --- a/tests/auto/blackbox/tst_blackbox.cpp +++ b/tests/auto/blackbox/tst_blackbox.cpp @@ -1538,4 +1538,44 @@ void TestBlackbox::testAssembly() QCOMPARE((bool)m_qbsStdout.contains("creating libtestc.a"), haveGcc); } +void TestBlackbox::testNsis() +{ + QStringList regKeys; + regKeys << QLatin1String("HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\NSIS") + << QLatin1String("HKEY_LOCAL_MACHINE\\SOFTWARE\\NSIS"); + + QStringList paths = QProcessEnvironment::systemEnvironment().value("PATH") + .split(HostOsInfo::pathListSeparator(), QString::SkipEmptyParts); + + foreach (const QString &key, regKeys) { + QSettings settings(key, QSettings::NativeFormat); + QString str = settings.value(QLatin1String(".")).toString(); + if (!str.isEmpty()) + paths.prepend(str); + } + + bool haveMakeNsis = false; + foreach (const QString &path, paths) { + if (QFile::exists(QDir::fromNativeSeparators(path) + + HostOsInfo::appendExecutableSuffix(QLatin1String("/makensis")))) { + haveMakeNsis = true; + break; + } + } + + if (!haveMakeNsis) { + SKIP_TEST("makensis is not installed"); + return; + } + + SettingsPtr settings = qbsSettings(); + Profile profile(buildProfileName, settings.data()); + bool targetIsWindows = profile.value("qbs.targetOS").toStringList().contains("windows"); + QDir::setCurrent(testDataDir + "/nsis"); + QVERIFY(runQbs() == 0); + QCOMPARE((bool)m_qbsStdout.contains("compiling hello.nsi"), targetIsWindows); + QCOMPARE((bool)m_qbsStdout.contains("SetCompressor ignored due to previous call with the /FINAL switch"), targetIsWindows); + QVERIFY(!QFile::exists(defaultInstallRoot + "/you-should-not-see-a-file-with-this-name.exe")); +} + QTEST_MAIN(TestBlackbox) diff --git a/tests/auto/blackbox/tst_blackbox.h b/tests/auto/blackbox/tst_blackbox.h index 24e8dce5d..43c1d1d12 100644 --- a/tests/auto/blackbox/tst_blackbox.h +++ b/tests/auto/blackbox/tst_blackbox.h @@ -153,6 +153,7 @@ private slots: void checkProjectFilePath(); void missingProfile(); void testAssembly(); + void testNsis(); private: QByteArray m_qbsStderr; |