aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIvan Komissarov <abbapoh@gmail.com>2020-03-17 19:09:57 +0100
committerIvan Komissarov <ABBAPOH@gmail.com>2020-03-20 13:21:41 +0000
commit6abf593b385bee391df76a1b7236d7c032bd9d7d (patch)
treed658a79087cc1f11cdf76043f05735f22109ebd8
parent84c57a11858f4cd7680da23e52a350c10c9cbe18 (diff)
Refactor TestBlackbox::installLocations()
To be able to test debug info directories Change-Id: Ifde3ceef40e3face12c40e670675c641d42a561e Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
-rw-r--r--tests/auto/blackbox/tst_blackbox.cpp59
1 files changed, 38 insertions, 21 deletions
diff --git a/tests/auto/blackbox/tst_blackbox.cpp b/tests/auto/blackbox/tst_blackbox.cpp
index 87a14c853..2738d0c6d 100644
--- a/tests/auto/blackbox/tst_blackbox.cpp
+++ b/tests/auto/blackbox/tst_blackbox.cpp
@@ -4030,35 +4030,52 @@ void TestBlackbox::installLocations()
const bool isUnix = m_qbsStdout.contains("is unix");
QVERIFY(isWindows || isMac || isUnix);
QCOMPARE(runQbs(QbsRunParameters(QStringList("--clean-install-root"))), 0);
- const QString dllFileName = isWindows ? "thelib.dll" : isMac ? "thelib" : "libthelib.so";
- const QString pluginFileName =
- isWindows ? "theplugin.dll" : isMac ? "theplugin" : "libtheplugin.so";
- const QString appFileName = isWindows ? "theapp.exe" : "theapp";
- if (binDir.isEmpty())
- binDir = isMac ? "/Applications" : "/bin";
- if (dllDir.isEmpty())
- dllDir = isMac ? "/Library/Frameworks" : isWindows ? "/bin" : "/lib";
- if (libDir.isEmpty())
- libDir = "/lib";
- if (pluginDir.isEmpty())
- pluginDir = dllDir;
- if (isMac) {
- binDir += "/theapp.app/Contents/MacOS";
- dllDir += "/thelib.framework";
- pluginDir += "/theplugin.bundle/Contents/MacOS";
- }
+
+ struct BinaryInfo
+ {
+ QString fileName;
+ QString installDir;
+ QString subDir;
+
+ QString absolutePath(const QString &prefix) const
+ {
+ return QDir::cleanPath(prefix + '/' + installDir + '/' + subDir + '/' + fileName);
+ }
+ };
+
+ const BinaryInfo dll = {
+ isWindows ? "thelib.dll" : isMac ? "thelib" : "libthelib.so",
+ dllDir.isEmpty() ? (isMac ? "/Library/Frameworks" : isWindows ? "/bin" : "/lib") : dllDir,
+ isMac ? "thelib.framework" : ""
+ };
+ const BinaryInfo plugin = {
+ isWindows ? "theplugin.dll" : isMac ? "theplugin" : "libtheplugin.so",
+ pluginDir.isEmpty() ? dll.installDir : pluginDir,
+ isMac ? "theplugin.bundle/Contents/MacOS" : ""
+ };
+ const BinaryInfo app = {
+ isWindows ? "theapp.exe" : "theapp",
+ binDir.isEmpty() ? (isMac ? "/Applications" : "/bin") : binDir,
+ isMac ? "theapp.app/Contents/MacOS" : ""
+ };
+
const QString installRoot = QDir::currentPath() + "/default/install-root";
const QString installPrefix = isWindows ? QString() : "/usr/local";
const QString fullInstallPrefix = installRoot + '/' + installPrefix + '/';
- const QString appFilePath = fullInstallPrefix + binDir + '/' + appFileName;
+ const QString appFilePath = app.absolutePath(fullInstallPrefix);
QVERIFY2(QFile::exists(appFilePath), qPrintable(appFilePath));
- const QString dllFilePath = fullInstallPrefix + dllDir + '/' + dllFileName;
+ const QString dllFilePath = dll.absolutePath(fullInstallPrefix);
QVERIFY2(QFile::exists(dllFilePath), qPrintable(dllFilePath));
if (isWindows) {
- const QString libFilePath = fullInstallPrefix + libDir + "/thelib.lib";
+ const BinaryInfo lib = {
+ "thelib.lib",
+ libDir.isEmpty() ? "/lib" : libDir,
+ ""
+ };
+ const QString libFilePath = lib.absolutePath(fullInstallPrefix);
QVERIFY2(QFile::exists(libFilePath), qPrintable(libFilePath));
}
- const QString pluginFilePath = fullInstallPrefix + pluginDir + '/' + pluginFileName;
+ const QString pluginFilePath = plugin.absolutePath(fullInstallPrefix);
QVERIFY2(QFile::exists(pluginFilePath), qPrintable(pluginFilePath));
}