CQtDeployer/UnitTests/tst_deploytest.cpp

2353 lines
77 KiB
C++
Raw Normal View History

2019-01-26 15:34:39 +03:00
/*
2019-12-08 13:57:20 +03:00
* Copyright (C) 2018-2020 QuasarApp.
2019-01-26 15:34:39 +03:00
* Distributed under the lgplv3 software license, see the accompanying
* Everyone is permitted to copy and distribute verbatim copies
* of this license document, but changing it is not allowed.
*/
#include <QtTest>
#include <quasarapp.h>
2019-09-03 18:15:05 +03:00
#include <deploycore.h>
2019-09-08 13:37:33 +03:00
#include <extracter.h>
2019-03-19 21:50:05 +03:00
#include <dependenciesscanner.h>
2019-03-26 22:12:20 +03:00
#include <qml.h>
2019-09-08 19:30:01 +03:00
#include <deploy.h>
2019-09-14 13:59:11 +03:00
#include <configparser.h>
#include <QCryptographicHash>
2019-09-15 11:47:51 +03:00
#include <distrostruct.h>
#include <pathutils.h>
2019-12-08 13:57:20 +03:00
#include <dependencymap.h>
2020-01-04 16:39:25 +03:00
#include <packing.h>
#include <pluginsparser.h>
2019-01-26 15:34:39 +03:00
2019-03-19 21:50:05 +03:00
#include <QMap>
2019-01-26 22:27:36 +03:00
#include <QByteArray>
2019-01-26 15:34:39 +03:00
#include <QDir>
2019-01-26 22:27:36 +03:00
#include <thread>
2019-03-19 21:50:05 +03:00
#include "libcreator.h"
2019-09-14 15:51:23 +03:00
#include "modules.h"
2019-03-26 22:12:20 +03:00
#include "qmlcreator.h"
2019-09-10 18:22:49 +03:00
#include "testutils.h"
2020-09-09 13:01:06 +03:00
2020-09-09 14:15:54 +03:00
// add necessary includes here
2020-09-09 13:01:06 +03:00
2019-01-26 15:34:39 +03:00
2019-09-11 18:09:37 +03:00
const QString TestBinDir = TEST_BIN_DIR;
const QString TestQtDir = QT_BASE_DIR;
2019-09-11 18:09:37 +03:00
2019-01-26 15:34:39 +03:00
class deploytest : public QObject
{
Q_OBJECT
private:
2020-02-28 15:12:44 +03:00
QHash<QString, QSet<QString>> filesTree;
2019-09-13 17:44:20 +03:00
2019-04-01 12:45:12 +03:00
bool runProcess(const QString& DistroPath,
const QString& filename,
const QString &qt = "");
2019-03-29 23:02:39 +03:00
QStringList getFilesFromDir(const QString& dir);
2019-05-14 11:31:13 +03:00
2020-02-28 15:12:44 +03:00
QSet<QString> getFilesTree(const QStringList& keys = {});
2019-05-14 11:31:13 +03:00
2020-04-04 15:43:46 +03:00
void runTestParams(QStringList list,
2020-02-28 15:12:44 +03:00
QSet<QString> *tree = nullptr,
const QStringList &checkableKeys = {},
2020-01-20 15:43:00 +03:00
bool noWarnings = false,
2020-01-20 16:40:18 +03:00
bool onlySize = false);
2019-09-10 18:22:49 +03:00
2020-02-28 15:12:44 +03:00
void checkResults(const QSet<QString> &tree,
const QStringList &checkagbleKeys,
bool noWarnings,
bool onlySize = false);
2019-01-26 15:34:39 +03:00
public:
deploytest();
2019-01-27 12:30:45 +03:00
/**
* @brief generateLib
* @param paath
* @return size of lib
*/
int generateLib(const QString& paath);
void deleteLib(const QString& paath);
2019-01-26 15:34:39 +03:00
~deploytest();
private slots:
void initTestCase();
void cleanupTestCase();
2019-09-10 18:22:49 +03:00
// old tests (not valid)
2019-01-26 22:27:36 +03:00
void testDeployTarget();
void testStrip();
2019-03-19 21:50:05 +03:00
void testExtractLib();
void testRelativeLink();
void testCheckQt();
2019-05-23 18:31:51 +03:00
2019-04-01 12:50:59 +03:00
void testQmlExtrct();
2019-08-27 11:07:12 +03:00
void testSetTargetDir();
2019-01-26 15:34:39 +03:00
2019-09-14 15:51:23 +03:00
// void mainTests();
2019-09-10 18:22:49 +03:00
// end old tests
2019-12-27 12:51:03 +03:00
// tested flags customScript
void costomScript();
2020-02-27 10:50:11 +03:00
void testDistroStruct();
2019-12-27 12:51:03 +03:00
2019-09-12 17:00:50 +03:00
// tested flags clear noOvervrite
void testOverwrite();
2019-09-12 17:00:50 +03:00
// tested flags binDir
2019-09-12 10:23:49 +03:00
void testBinDir();
2020-01-31 12:40:31 +03:00
// tested flags qmlDir qmake
void testQt();
2020-07-07 11:05:27 +03:00
void testWebEngine();
2019-09-14 15:51:23 +03:00
// tested flags confFile
2019-09-12 17:00:50 +03:00
void testConfFile();
2020-01-27 20:02:25 +03:00
// tested flags targetPackage
void testPackages();
2019-12-28 15:06:43 +03:00
2019-09-28 16:44:39 +03:00
// tested clear force clear in clear mode
void testClear();
2019-09-14 15:51:23 +03:00
// tested flags ignore ignoreEnv
void testIgnore();
// tested flags libDir recursiveDepth
void testLibDir();
// tested flag extraPlugin
void testExtraPlugins();
// tested flag targetDir
void testTargetDir();
2019-09-24 16:30:52 +03:00
// tested flag noLibc deploySystem
2019-09-14 15:51:23 +03:00
void testSystemLib();
2019-09-24 16:30:52 +03:00
// tested flag qmlOut libOut trOut pluginOut binOut
void testOutDirs();
2019-03-28 10:32:46 +03:00
void testMSVC();
2019-09-10 18:22:49 +03:00
2019-09-16 12:38:48 +03:00
void testEmptyParamsString();
2020-01-14 15:48:35 +03:00
// qif flags
void testQIF();
// init flags
void testInit();
2019-12-08 13:57:20 +03:00
void testDependencyMap();
void testQmlScaner();
void testVirtualKeyBoard();
2019-01-26 15:34:39 +03:00
};
2019-04-01 12:45:12 +03:00
bool deploytest::runProcess(const QString &DistroPath,
const QString &filename,
const QString& qt) {
QProcess p;
2019-04-01 12:45:12 +03:00
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
if (qt.size()) {
auto val = env.value("LD_LIBRARY_PATH","").remove(qt);
env.insert("LD_LIBRARY_PATH", val);
val = env.value("PATH","").remove(qt);
env.insert("PATH", val);
env.insert("QTDIR", "");
} else {
env.clear();
env.insert("QTDIR", "");
}
p.setProcessEnvironment(env);
#ifdef Q_OS_UNIX
p.setProgram(DistroPath + "/" + filename + ".sh");
#else
p.setProgram(DistroPath + "/" + filename + ".exe");
#endif
p.start();
2019-04-06 18:12:50 +03:00
if (!p.waitForFinished(10000)) {
return false;
}
QString str = p.readAll();
2019-04-01 12:45:12 +03:00
if (p.exitCode()) {
qCritical() << p.errorString();
}
if (p.exitCode()) {
qWarning() << "exitCode == " << p.exitCode();
}
if (str.contains("failed to load component", Qt::CaseInsensitive)
|| str.contains("is not installed", Qt::CaseInsensitive) ||
str.contains("error", Qt::CaseInsensitive)) {
return false;
}
return p.exitCode() == 0;
}
2019-03-29 23:02:39 +03:00
QStringList deploytest::getFilesFromDir(const QString &path) {
2019-09-14 15:51:23 +03:00
QDir dir(path);
2019-03-29 23:02:39 +03:00
2019-09-14 15:51:23 +03:00
QStringList res;
2019-03-29 23:02:39 +03:00
2019-09-14 15:51:23 +03:00
auto list = dir.entryInfoList(QDir::Dirs| QDir::Files| QDir::NoDotAndDotDot);
2019-03-29 23:02:39 +03:00
2020-01-12 16:43:03 +03:00
for (const auto &subDir: list) {
2019-03-29 23:02:39 +03:00
2019-09-14 15:51:23 +03:00
if (subDir.isFile()) {
res.push_back(subDir.fileName());
} else {
res.append(getFilesFromDir(subDir.absoluteFilePath()));
2019-03-29 23:02:39 +03:00
}
2019-05-14 11:31:13 +03:00
}
2019-09-14 15:51:23 +03:00
return res;
2019-03-29 23:02:39 +03:00
}
2019-05-14 11:31:13 +03:00
2020-02-28 15:12:44 +03:00
QSet<QString> deploytest::getFilesTree(const QStringList &keys) {
QSet<QString> result;
if (keys.isEmpty()) {
for (auto it = filesTree.begin(); it != filesTree.end(); ++it) {
result += filesTree[it.key()];
}
return result;
}
for (const auto& i: keys) {
result += filesTree[i];
}
return result;
}
2019-09-13 17:44:20 +03:00
deploytest::deploytest() {
2020-09-09 13:01:06 +03:00
2020-11-18 14:59:02 +03:00
qputenv("QTEST_FUNCTION_TIMEOUT", "1800000");
2019-09-13 17:44:20 +03:00
TestUtils utils;
2019-05-14 11:31:13 +03:00
2019-09-13 17:44:20 +03:00
auto tempTree = utils.getTree(TestQtDir);
2020-02-28 15:12:44 +03:00
for (const QString &i: tempTree) {
filesTree["Qt"].insert(QFileInfo(i).fileName());
}
2019-05-14 11:31:13 +03:00
2020-02-28 15:12:44 +03:00
tempTree = utils.getTree("/lib", 5);
for (const QString &i: tempTree) {
filesTree["/lib"].insert(QFileInfo(i).fileName());
}
2019-09-23 14:26:45 +03:00
2020-02-28 15:12:44 +03:00
tempTree = utils.getTree("/usr/lib", 5);
2019-09-13 17:44:20 +03:00
for (const QString &i: tempTree) {
2020-02-28 15:12:44 +03:00
filesTree["/usr/lib"].insert(QFileInfo(i).fileName());
2019-05-14 11:31:13 +03:00
}
}
2019-01-27 12:30:45 +03:00
int deploytest::generateLib(const QString &paath)
{
QDir dir;
2019-01-27 15:37:19 +03:00
dir.mkpath(QFileInfo(paath).absolutePath());
2019-01-27 12:30:45 +03:00
QFile testLib (paath);
int size = 0;
if (testLib.open(QIODevice::ReadWrite| QIODevice::Truncate)) {
QFile resData(":/debugLib");
if (resData.open(QIODevice::ReadOnly)) {
QByteArray tempData = resData.readAll();
size = tempData.size();
testLib.write(tempData.data(), tempData.size());
resData.close();
}
testLib.close();
}
return size;
}
void deploytest::deleteLib(const QString &paath)
{
QFileInfo info(paath);
if (info.isDir()) {
QFile::remove(info.absoluteFilePath());
} else {
QDir qt(info.absoluteFilePath());
qt.removeRecursively();
}
}
2019-01-26 15:34:39 +03:00
deploytest::~deploytest(){}
void deploytest::initTestCase() {
QDir qt;
2019-11-05 13:17:52 +03:00
2020-02-26 14:29:04 +03:00
QDir("./" + DISTRO_DIR).removeRecursively();
2019-01-26 15:34:39 +03:00
qt.mkpath("./test/Qt/5.12/");
qt.mkpath("./test/extraPath/");
qt.mkpath("./test/extra/");
qt.mkpath("./test/warning/");
2019-01-26 17:39:19 +03:00
qt.mkpath("./test/bins/");
2019-01-26 15:34:39 +03:00
QFile f( "./test/Qt/5.12/generalLib.so");
if (f.open(QIODevice::WriteOnly| QIODevice::Truncate)) {
f.write("lib", 3);
f.close();
}
f.setFileName("./test/extraPath/ExtraLib.so");
if (f.open(QIODevice::WriteOnly| QIODevice::Truncate)) {
f.write("lib", 3);
f.close();
}
f.setFileName("./test/extra/ExtraLib.so");
if (f.open(QIODevice::WriteOnly| QIODevice::Truncate)) {
f.write("lib", 3);
f.close();
}
f.setFileName("./test/warning/WarningLib.so");
if (f.open(QIODevice::WriteOnly| QIODevice::Truncate)) {
f.write("lib", 3);
f.close();
}
2019-01-26 17:39:19 +03:00
f.setFileName("./test/bins/execTarget.exe");
if (f.open(QIODevice::WriteOnly| QIODevice::Truncate)) {
f.write("exec", 3);
f.close();
}
f.setFileName("./test/bins/execTarget");
if (f.open(QIODevice::WriteOnly| QIODevice::Truncate)) {
f.write("exec", 3);
f.close();
}
2019-01-26 15:34:39 +03:00
}
void deploytest::cleanupTestCase() {
QDir qt("./test");
qt.removeRecursively();
}
2019-01-26 22:27:36 +03:00
void deploytest::testDeployTarget() {
2019-01-26 15:34:39 +03:00
2019-09-08 19:30:01 +03:00
FileManager file;
2019-11-13 18:18:44 +03:00
DependenciesScanner scan;
2020-01-04 16:39:25 +03:00
Packing pac;
PluginsParser _pluginParser;
2020-01-04 16:39:25 +03:00
ConfigParser *deploy = new ConfigParser(&file, &_pluginParser, &scan, &pac);
2019-09-08 19:30:01 +03:00
2019-01-26 17:39:19 +03:00
QStringList targets;
targets << "./test/bins/execTarget.exe";
QVERIFY(deploy->setTargets(targets));
delete deploy;
targets.clear();
deploy = new ConfigParser(&file, &_pluginParser, &scan, &pac);
2019-01-26 17:39:19 +03:00
targets << "./test/bins/execTarget";
QVERIFY(deploy->setTargets(targets));
delete deploy;
targets.clear();
deploy = new ConfigParser(&file, &_pluginParser, &scan, &pac);
2019-01-26 17:39:19 +03:00
targets << "./test/bins/execTarget.exe" << "./test/bins/execTarget";
QVERIFY(deploy->setTargets(targets));
delete deploy;
targets.clear();
deploy = new ConfigParser(&file, &_pluginParser, &scan, &pac);
2019-01-26 17:39:19 +03:00
targets << "./test/bns/execTarget.exe";
QVERIFY(!deploy->setTargets(targets));
delete deploy;
targets.clear();
deploy = new ConfigParser(&file, &_pluginParser, &scan, &pac);
2019-01-26 17:39:19 +03:00
targets << "./test/bins/";
QVERIFY(deploy->setTargets(targets));
delete deploy;
targets.clear();
deploy = new ConfigParser(&file, &_pluginParser, &scan, &pac);
2019-01-26 17:39:19 +03:00
targets << "./test/bins/" << "./test/warning/";
QVERIFY(deploy->setTargets(targets));
delete deploy;
targets.clear();
2019-01-26 22:27:36 +03:00
}
2019-01-26 17:39:19 +03:00
2019-01-26 22:27:36 +03:00
void deploytest::testStrip() {
2019-01-26 17:39:19 +03:00
2019-09-08 19:30:01 +03:00
#ifdef Q_OS_UNIX
2019-01-27 12:30:45 +03:00
//for one lib
qint64 sizeBefor = generateLib("./test/binTargetDir/debugLib.so");
2019-01-26 22:27:36 +03:00
qint64 sizeAfter = 0;
2019-09-04 12:01:33 +03:00
FileManager *deploy = new FileManager();
2019-01-27 12:30:45 +03:00
QVERIFY(deploy->strip("./test/binTargetDir/debugLib.so"));
2019-01-26 22:27:36 +03:00
2019-01-27 12:30:45 +03:00
QFile testLib ("./test/binTargetDir/debugLib.so");
2019-01-26 22:27:36 +03:00
if (testLib.open(QIODevice::ReadOnly)) {
sizeAfter = testLib.size();
testLib.close();
}
2019-01-26 15:34:39 +03:00
2019-01-27 12:30:45 +03:00
deleteLib("./test/binTargetDir");
delete deploy;
2019-01-26 15:34:39 +03:00
2019-01-26 22:27:36 +03:00
QVERIFY(sizeBefor > sizeAfter);
2019-01-27 12:30:45 +03:00
//for folder
QStringList libList = {
("./test/binTargetDir/debugLib1.so"),
("./test/binTargetDir/debugLib2.so.1.2"),
("./test/binTargetDir/debugLib3.so.1"),
("./test/binTargetDir/debugLib4.so.1.0.0"),
("./test/binTargetDir/debugLib.dll"),
("./test/binTargetDir/debugLib1.dll")
};
QList<qint64> sizeBeforList = {};
for (auto i: libList) {
sizeBeforList.push_back(generateLib(i));
}
QList<qint64> sizeAfterList;
2019-09-04 12:01:33 +03:00
deploy = new FileManager();
2019-01-27 12:30:45 +03:00
QVERIFY(deploy->strip("./test/binTargetDir"));
for(auto i: libList) {
QFile testLib (i);
if (testLib.open(QIODevice::ReadOnly)) {
sizeAfterList.push_back(testLib.size());
testLib.close();
}
}
deleteLib("./test/binTargetDir");
QVERIFY(sizeBeforList.size() == sizeAfterList.size());
for (int i = 0; i < sizeAfterList.size(); ++i) {
QVERIFY2(sizeBeforList[i] > sizeAfterList[i],
QString("index %0, lib: %1 size befor:%2, sizeAfter:%3").
arg(i).arg(libList[i]).arg(sizeBeforList[i]).arg(sizeAfterList[i]).
toLatin1());
}
2019-04-01 22:03:37 +03:00
2019-01-27 19:46:11 +03:00
#endif
}
2019-03-19 21:50:05 +03:00
void deploytest::testExtractLib() {
LibCreator creator("./");
auto libs = creator.getLibs();
auto deb = creator.getLibsDep();
auto platforms = creator.getLibplatform();
DependenciesScanner scaner;
LibInfo info;
2020-01-12 16:43:03 +03:00
for (const auto &lib : libs) {
2019-03-19 21:50:05 +03:00
QVERIFY(scaner.fillLibInfo(info, lib));
2019-04-05 14:23:42 +03:00
QVERIFY(info.getName() == QFileInfo(lib).fileName());
QVERIFY(info.getPath() == QFileInfo(lib).absolutePath());
2019-03-19 21:50:05 +03:00
QVERIFY(info.fullPath() == QFileInfo(lib).absoluteFilePath());
2019-04-05 14:23:42 +03:00
QVERIFY(info.getPlatform() == platforms.value(lib));
2019-03-23 20:40:33 +03:00
2020-01-12 16:43:03 +03:00
for (const auto &dep : deb.value(lib)) {
2020-10-13 22:38:16 +03:00
QString depName = dep;
if (info.getPlatform() & Platform::Win) {
depName = dep.toUpper();
}
bool test = info.getDependncies().contains(depName);
2019-04-05 16:52:53 +03:00
QVERIFY(test);
2019-03-23 20:40:33 +03:00
}
2019-03-19 21:50:05 +03:00
}
}
2019-03-28 10:32:46 +03:00
void deploytest::testMSVC() {
QString testPath = "./Qt/5.11.2/msvc2017_64/bin/";
QDir d;
QDir oldDir("./Qt");
oldDir.removeRecursively();
QVERIFY(d.mkpath(testPath));
2019-11-01 15:12:03 +03:00
auto msvc = DeployCore::getMSVC(testPath);
2019-03-28 10:32:46 +03:00
QVERIFY(msvc & MSVCVersion::MSVC_17);
QVERIFY(msvc & MSVCVersion::MSVC_x64);
2019-04-01 12:54:07 +03:00
QDir dir("./Qt");
dir.removeRecursively();
2019-03-28 10:32:46 +03:00
}
2019-09-16 12:38:48 +03:00
void deploytest::testEmptyParamsString() {
}
2019-09-15 20:31:31 +03:00
void deploytest::testWebEngine() {
2020-02-27 21:01:32 +03:00
#ifdef Q_OS_UNIX
2019-09-15 20:31:31 +03:00
TestUtils utils;
QString bin = TestBinDir + "quicknanobrowser";
QString qmake = TestQtDir + "bin/qmake";
auto comapareTree = TestModule.qtWebEngine();
2019-09-15 20:31:31 +03:00
runTestParams({"-bin", bin, "clear" ,
"-qmake", qmake,
"-qmlDir", TestBinDir + "/../quicknanobrowser"}, &comapareTree);
bin = TestBinDir + "webui";
qmake = TestQtDir + "bin/qmake";
comapareTree = TestModule.qtWebEngineWidgets();
runTestParams({"-bin", bin, "clear" ,
"-qmake", qmake}, &comapareTree);
#endif
2019-09-15 20:31:31 +03:00
}
2020-01-14 15:48:35 +03:00
void deploytest::testQIF() {
TestUtils utils;
#ifdef Q_OS_UNIX
QString bin = TestBinDir + "TestQMLWidgets";
2020-01-16 18:14:48 +03:00
QString target1 = TestBinDir + "TestOnlyC";
2020-01-14 15:48:35 +03:00
QString qmake = TestQtDir + "bin/qmake";
2020-01-16 15:25:36 +03:00
auto comapareTree = utils.createTree({
2020-03-08 13:52:26 +03:00
"./" + DISTRO_DIR + "/InstallerTestQMLWidgets.run",
2020-01-16 15:25:36 +03:00
});
2020-01-14 15:48:35 +03:00
2020-03-08 13:52:26 +03:00
auto comapareTreeMulti = utils.createTree({
2020-07-05 13:53:15 +03:00
"./" + DISTRO_DIR + "/InstallerQtWidgetsProject.run",
});
2020-01-14 15:48:35 +03:00
#else
QString bin = TestBinDir + "TestQMLWidgets.exe";
2020-01-16 18:14:48 +03:00
QString target1 = TestBinDir + "TestOnlyC.exe";
2020-01-14 15:48:35 +03:00
QString qmake = TestQtDir + "bin/qmake.exe";
2020-01-16 15:25:36 +03:00
auto comapareTree = utils.createTree({
2020-03-08 13:52:26 +03:00
"./" + DISTRO_DIR + "/InstallerTestQMLWidgets.exe",
});
auto comapareTreeMulti = utils.createTree({
2020-07-05 13:53:15 +03:00
"./" + DISTRO_DIR + "/InstallerQtWidgetsProject.exe",
});
2020-01-14 15:48:35 +03:00
#endif
runTestParams({"-bin", bin, "clear" ,
"-qmake", qmake,
"-qmlDir", TestBinDir + "/../TestQMLWidgets",
2020-09-07 14:46:21 +03:00
"qif", "qifFromSystem"}, &comapareTree, {}, true);
2020-01-14 15:48:35 +03:00
2020-04-25 16:59:20 +03:00
// test clear for qif
2020-09-07 14:46:21 +03:00
runTestParams({"clear"}, {} , {}, true);
2020-01-16 18:14:48 +03:00
runTestParams({"-bin", bin, "clear" ,
"-qmake", qmake,
"-qmlDir", TestBinDir + "/../TestQMLWidgets",
2020-07-07 11:05:27 +03:00
"qif", "qifFromSystem",
"-qifStyle", "quasar",
"-qifBanner", TestBinDir + "/../../res/cqtdeployer banner.png",
2020-09-07 14:46:21 +03:00
"-qifLogo", TestBinDir + "/../../res/icon.png"}, &comapareTree, {}, true);
2020-01-18 17:32:50 +03:00
#ifdef Q_OS_UNIX
QString target2 = TestBinDir + "TestQMLWidgets";
QString target3 = TestBinDir + "QtWidgetsProject";
#else
QString target2 = TestBinDir + "TestQMLWidgets.exe";
QString target3 = TestBinDir + "QtWidgetsProject.exe";
#endif
bin = target1;
bin += "," + target2;
bin += "," + target3;
2020-01-27 20:02:25 +03:00
auto packageString = "/package1/;" + QFileInfo(target1).absoluteFilePath() + ",/package2/;" + QFileInfo(target2).absoluteFilePath();
2020-01-20 16:05:23 +03:00
runTestParams({"-bin", bin, "force-clear",
"-binOut", "/lol",
"-libOut", "/lolLib",
"-trOut", "/lolTr",
"-pluginOut", "/p",
"-qmlOut", "/q",
2020-01-27 20:02:25 +03:00
"-qmlDir", "package2;" + TestBinDir + "/../TestQMLWidgets",
2020-07-07 11:05:27 +03:00
"-targetPackage", packageString,
"qif", "qifFromSystem"}, &comapareTreeMulti, {}, true);
2020-01-20 16:05:23 +03:00
}
void deploytest::testInit()
{
TestUtils utils;
runTestParams({"init"});
runTestParams({});
2020-01-27 20:02:25 +03:00
QVERIFY(QFile(DEFAULT_COFIGURATION_FILE).remove());
2020-03-08 14:46:17 +03:00
runTestParams({"-init", "multi"});
runTestParams({});
QVERIFY(QFile(DEFAULT_COFIGURATION_FILE).remove());
runTestParams({"-init", "single"});
2020-01-27 19:35:02 +03:00
runTestParams({});
2020-01-27 20:02:25 +03:00
QVERIFY(QFile(DEFAULT_COFIGURATION_FILE).remove());
}
2019-12-08 13:57:20 +03:00
void deploytest::testDependencyMap() {
DependencyMap dep1, dep2, dep3;
QVERIFY(dep1.qtModules() == 0);
QVERIFY(dep2.qtModules() == 0);
QVERIFY(dep3.qtModules() == 0);
QVERIFY(dep1.systemLibs().isEmpty());
QVERIFY(dep2.systemLibs().isEmpty());
QVERIFY(dep3.systemLibs().isEmpty());
QVERIFY(dep1.neadedLibs().isEmpty());
QVERIFY(dep2.neadedLibs().isEmpty());
QVERIFY(dep3.neadedLibs().isEmpty());
dep1.addModule(DeployCore::QtModule::QtGuiModule);
QVERIFY(dep1.qtModules() == DeployCore::QtModule::QtGuiModule);
dep1.addModule(DeployCore::QtModule::QtHelpModule);
QVERIFY(dep1.qtModules() == (DeployCore::QtModule::QtGuiModule |
2020-07-05 13:53:15 +03:00
DeployCore::QtModule::QtHelpModule));
2019-12-08 13:57:20 +03:00
dep1.removeModule(DeployCore::QtModule::QtGuiModule);
QVERIFY(dep1.qtModules() == DeployCore::QtModule::QtHelpModule);
dep2.addModule(DeployCore::QtModule::QtGuiModule);
dep1 += dep2;
QVERIFY(dep1.qtModules() == (DeployCore::QtModule::QtGuiModule |
2020-07-05 13:53:15 +03:00
DeployCore::QtModule::QtHelpModule));
2019-12-08 13:57:20 +03:00
}
void deploytest::testQmlScaner() {
// qt5
auto qmlRoot = QFileInfo(TestQtDir + "/qml").absoluteFilePath();
QML *scaner = new QML(qmlRoot, QtMajorVersion::Qt5);
auto imports = scaner->extractImportsFromFile(":/qmlFile.qml");
scaner->scanQmlTree(qmlRoot);
QSet<QString> results = {
{qmlRoot + "/QtQuick.2/"},
{qmlRoot + "/QtQuick/Controls.2/"},
{qmlRoot + "/QtQuick/Controls.2/Material/"},
{qmlRoot + "/QtQuick/Layouts/"},
};
QVERIFY(results.size() == imports.size());
for (const auto &import: qAsConst(imports)) {
auto path = scaner->getPathFromImport(import);
QVERIFY(results.contains(path));
}
scaner->setQtVersion(QtMajorVersion::Qt6);
// qt6
results = {
{qmlRoot + "/QtQuick"},
{qmlRoot + "/QtQuick/Controls"},
{qmlRoot + "/QtQuick/Controls/Material"},
{qmlRoot + "/QtQuick/Layouts"},
};
imports = scaner->extractImportsFromFile(":/qmlFileQt6.qml");
QVERIFY(results.size() == imports.size());
for (const auto &import: qAsConst(imports)) {
auto path = scaner->getPathFromImport(import);
QVERIFY(results.contains(path));
}
imports = scaner->extractImportsFromFile(":/qmlFile.qml");
QVERIFY(results.size() == imports.size());
for (const auto & import: qAsConst(imports)) {
auto path = scaner->getPathFromImport(import);
QVERIFY(results.contains(path));
}
// qt5
scaner->setQtVersion(QtMajorVersion::Qt5);
results = {
{qmlRoot + "/QtQuick.2/"},
{qmlRoot + "/QtQuick/Window.2/"},
{qmlRoot + "/QtQuick/Layouts/"},
{qmlRoot + "/Qt/labs/folderlistmodel/"},
{qmlRoot + "/QtQuick/VirtualKeyboard/Settings/"},
{qmlRoot + "/QtQuick/VirtualKeyboard/Styles/"},
};
imports = scaner->extractImportsFromQmlModule(":/qmlDir");
QVERIFY(results.size() == imports.size());
for (const auto &import: qAsConst(imports)) {
auto path = scaner->getPathFromImport(import);
QVERIFY(results.contains(path));
}
// qt6
scaner->setQtVersion(QtMajorVersion::Qt6);
results = {
{qmlRoot + "/QtQuick"},
{qmlRoot + "/QtQuick/Window"},
{qmlRoot + "/QtQuick/Layouts"},
{qmlRoot + "/Qt/labs/folderlistmodel"},
{qmlRoot + "/QtQuick/VirtualKeyboard/Settings"},
{qmlRoot + "/QtQuick/VirtualKeyboard/Styles"},
};
imports = scaner->extractImportsFromQmlModule(":/qmlDir");
QVERIFY(results.size() == imports.size());
for (const auto &import: qAsConst(imports)) {
auto path = scaner->getPathFromImport(import);
QVERIFY(results.contains(path));
}
2019-12-08 13:57:20 +03:00
}
void deploytest::testVirtualKeyBoard() {
TestUtils utils;
#ifdef Q_OS_UNIX
QString bin = TestBinDir + "basic";
QString qmake = TestQtDir + "bin/qmake";
#else
QString bin = TestBinDir + "basic.exe";
QString qmake = TestQtDir + "bin/qmake.exe";
#endif
auto comapareTree = TestModule.qmlVirtualKeyBoadrLibs();
runTestParams({"-bin", bin, "clear",
"-qmake", qmake,
"-qmlDir", TestBinDir + "/../virtualkeyboard"}, &comapareTree);
}
2019-04-01 12:54:07 +03:00
void deploytest::testQmlExtrct() {
2019-03-26 22:12:20 +03:00
QmlCreator creator("./");
auto imports = creator.getQmlImports();
auto qmlFiles = creator.getCopyedQml();
QML scaner("./", QtMajorVersion::Qt5);
2019-03-26 22:12:20 +03:00
2020-01-12 16:43:03 +03:00
for (const auto &file : qmlFiles) {
2019-03-26 22:12:20 +03:00
auto fileImports = scaner.extractImportsFromFile(file);
2020-01-12 16:43:03 +03:00
for (const auto &fil : imports.value(file)) {
2019-04-02 12:46:14 +03:00
QVERIFY(fileImports.contains(fil, Qt::CaseInsensitive));
2019-03-26 22:12:20 +03:00
}
}
}
2019-08-25 14:42:00 +03:00
void deploytest::testDistroStruct() {
DistroStruct distro;
auto cases = QList<QPair<QString,QString>>{
2019-08-26 08:46:53 +03:00
{"", "/"},
2019-08-25 14:42:00 +03:00
{"/", "/"},
2019-08-28 17:23:49 +03:00
{"/res","/../"},
{"/res/","/../"},
{"/res/type","/../../"},
{"/res/type/","/../../"},
2020-02-26 14:29:04 +03:00
{"res/type","../../"},
{"res/type/","../../"},
{"res//type/","../../"},
{"res////type/","../../"},
2019-08-28 17:23:49 +03:00
{"//res///type/////","/../../"},
2019-08-26 08:46:53 +03:00
{"\\", "/"},
2019-08-28 17:23:49 +03:00
{"\\res","/../"},
{"\\res\\","/../"},
{"\\res\\type","/../../"},
{"\\res\\type\\","/../../"},
2020-02-26 14:29:04 +03:00
{"res\\type","../../"},
{"res\\type\\","../../"},
{"res\\\\type\\","../../"},
{"res\\\\\\\\type\\","../../"},
2019-08-28 17:23:49 +03:00
{"\\\\res\\\\\\type\\\\\\\\\\","/../../"},
2019-08-25 14:42:00 +03:00
};
2019-08-26 08:46:53 +03:00
2020-01-12 16:43:03 +03:00
for (const auto &i: cases) {
2020-02-26 14:29:04 +03:00
if (distro.getRelativePath(i.first) != i.second)
QVERIFY(false);
2019-08-27 11:21:13 +03:00
}
2020-02-27 10:50:11 +03:00
distro = DistroStruct();
distro.setTrOutDir("/tr/");
QVERIFY(distro.getTrOutDir() == "/tr/");
distro.setTrOutDir("/tr");
QVERIFY(distro.getTrOutDir() == "/tr/");
distro.setTrOutDir("tr");
QVERIFY(distro.getTrOutDir() == "/tr/");
2019-08-27 11:17:07 +03:00
}
void deploytest::testRelativeLink() {
auto cases = QList<QList<QString>>{
2020-07-05 13:53:15 +03:00
{"", "", "./"},
{"/media", "/etc", "./../etc/"},
{"/media///", "/etc///", "./../etc/"},
{"/media/etc/usr", "/media/etc", "./../"},
{"/media/etc", "/media/etc/usr", "./usr/"},
{"C:/", "C:/", "./"},
{"C:\\", "C:/", "./"},
{"C:/", "C:\\", "./"},
{"C:/media", "C:/etc", "./../etc/"},
{"C:/media//\\", "C:/etc///", "./../etc/"},
{"C:/media/etc/usr", "C:/media/etc", "./../"},
{"C:/media\\etc", "C:/media/etc/usr", "./usr/"},
{"C:/media/etc", "D:/media/etc/usr", "D:/media/etc/usr"},
2019-10-16 18:07:36 +03:00
2020-07-05 13:53:15 +03:00
};
2020-01-12 16:43:03 +03:00
for (const auto &i: cases) {
2020-02-26 14:29:04 +03:00
if (PathUtils::getRelativeLink(i[0], i[1]) != i[2])
QVERIFY(false);
}
2019-10-16 18:07:36 +03:00
for (int i = 1; i < cases.size() - 1; i++) {
2020-02-26 14:29:04 +03:00
if (!PathUtils::isAbsalutPath(cases[i][0]))
QVERIFY(false);
if (PathUtils::isAbsalutPath(cases[i][2]))
QVERIFY(false);
2019-10-16 18:07:36 +03:00
}
}
void deploytest::testCheckQt() {
Deploy *deployer = new Deploy();
QuasarAppUtils::Params::parseParams({"-binDir", TestBinDir, "clear",
2020-10-14 14:54:35 +03:00
"noCheckRPATH", "noCheckPATH", "noQt"});
QVERIFY(deployer->prepare());
2020-11-05 12:57:41 +03:00
auto cases = QList<QPair<QString, QtMajorVersion>>{
{TestQtDir + "/", QtMajorVersion::NoQt},
{TestQtDir + "", QtMajorVersion::NoQt},
{TestQtDir + "/bin/file1", QtMajorVersion::NoQt},
{TestQtDir + "/lib/file12.so", QtMajorVersion::NoQt},
{TestQtDir + "/resurces/file13.dll", QtMajorVersion::NoQt},
{TestQtDir + "/libexec/f", QtMajorVersion::NoQt},
{TestQtDir + "/mkspecs", QtMajorVersion::NoQt},
{TestQtDir + "/qml", QtMajorVersion::NoQt},
{TestQtDir + "/plugins", QtMajorVersion::NoQt},
{TestQtDir + "/file", QtMajorVersion::NoQt},
{TestQtDir + "\\", QtMajorVersion::NoQt},
{TestQtDir + "", QtMajorVersion::NoQt},
{TestQtDir + "\\bin\\file1", QtMajorVersion::NoQt},
{TestQtDir + "\\lib\\file12", QtMajorVersion::NoQt},
{TestQtDir + "\\resurces\\file13", QtMajorVersion::NoQt},
{TestQtDir + "\\libexec\\f.so", QtMajorVersion::NoQt},
{TestQtDir + "\\mkspecs.dll", QtMajorVersion::NoQt},
{TestQtDir + "\\qml", QtMajorVersion::NoQt},
{TestQtDir + "\\plugins", QtMajorVersion::NoQt},
{TestQtDir + "\\file", QtMajorVersion::NoQt},
};
for (const auto &i: cases) {
QVERIFY(DeployCore::isQtLib(i.first) == i.second);
}
delete deployer;
#ifdef Q_OS_UNIX
QString bin = TestBinDir + "TestQMLWidgets";
QString qmake = TestQtDir + "bin/qmake";
#else
QString bin = TestBinDir + "TestQMLWidgets.exe";
QString qmake = TestQtDir + "bin/qmake.exe";
#endif
deployer = new Deploy();
QuasarAppUtils::Params::parseParams({"-bin", bin, "clear" ,
"-qmake", qmake,
"-qmlDir", TestBinDir + "/../TestQMLWidgets"});
QVERIFY(deployer->prepare());
2020-11-05 12:57:41 +03:00
cases = QList<QPair<QString, QtMajorVersion>>{
{TestQtDir + "/", QtMajorVersion::NoQt},
{TestQtDir + "", QtMajorVersion::NoQt},
{TestQtDir + "/bin/file1", QtMajorVersion::NoQt},
{TestQtDir + "/lib/file12", QtMajorVersion::NoQt},
{TestQtDir + "/lib/file12", QtMajorVersion::NoQt},
{TestQtDir + "/mkspecs", QtMajorVersion::NoQt},
{TestQtDir + "/qml", QtMajorVersion::NoQt},
{TestQtDir + "/plugins", QtMajorVersion::NoQt},
{TestQtDir + "/file", QtMajorVersion::NoQt},
{TestQtDir + "\\", QtMajorVersion::NoQt},
{TestQtDir + "", QtMajorVersion::NoQt},
{TestQtDir + "\\lib\\file12", QtMajorVersion::NoQt},
{TestQtDir + "\\libexec\\fQt", QtMajorVersion::NoQt},
{TestQtDir + "\\mkspecs", QtMajorVersion::NoQt},
{TestQtDir + "\\qml", QtMajorVersion::NoQt},
{TestQtDir + "\\plugins", QtMajorVersion::NoQt},
{TestQtDir + "\\file", QtMajorVersion::NoQt},
{TestQtDir + "/bin/file1Qt4.so", QtMajorVersion::Qt4},
{TestQtDir + "/resources/Qt4file13.so", QtMajorVersion::Qt4},
{TestQtDir + "/libexec/Qt4f.dll", QtMajorVersion::Qt4},
{TestQtDir + "\\bin\\Qt4file1.dll", QtMajorVersion::Qt4},
{TestQtDir + "\\resources\\fileQt413.dll", QtMajorVersion::Qt4},
{TestQtDir + "/bin/file1Qt5.so", QtMajorVersion::Qt5},
{TestQtDir + "/resources/Qt5file13.so", QtMajorVersion::Qt5},
{TestQtDir + "/libexec/Qt5f.dll", QtMajorVersion::Qt5},
{TestQtDir + "\\bin\\Qt5file1.dll", QtMajorVersion::Qt5},
{TestQtDir + "\\resources\\fileQt513.dll", QtMajorVersion::Qt5},
{TestQtDir + "/bin/file1Qt6.so", QtMajorVersion::Qt6},
{TestQtDir + "/resources/Qt6file13.so", QtMajorVersion::Qt6},
{TestQtDir + "/libexec/Qt6f.dll", QtMajorVersion::Qt6},
{TestQtDir + "\\bin\\Qt6file1.dll", QtMajorVersion::Qt6},
{TestQtDir + "\\resources\\fileQt613.dll", QtMajorVersion::Qt6},
};
for (const auto &i: cases) {
2020-10-14 15:55:13 +03:00
auto dexription = QString("The isQtLib(%0) function should be return %1").arg(
i.first).arg(i.second);
QVERIFY2(DeployCore::isQtLib(i.first) == i.second, dexription.toLatin1().data());
}
delete deployer;
}
2019-08-27 11:07:12 +03:00
void deploytest::testSetTargetDir() {
2019-09-09 09:56:57 +03:00
FileManager file;
2019-11-13 18:18:44 +03:00
DependenciesScanner scan;
2020-01-04 16:39:25 +03:00
Packing pac;
PluginsParser _plugins;
ConfigParser dep(&file, &_plugins, &scan, &pac);
2019-08-27 11:07:12 +03:00
dep.setTargetDir();
2019-12-15 18:30:24 +03:00
QVERIFY(dep.config()->getTargetDir() == QFileInfo("./" + DISTRO_DIR + "").absoluteFilePath());
2019-08-27 11:07:12 +03:00
dep.setTargetDir("./ff");
2019-12-15 18:30:24 +03:00
QVERIFY(dep.config()->getTargetDir() == QFileInfo("./ff").absoluteFilePath());
2019-08-27 11:07:12 +03:00
2019-09-16 09:44:19 +03:00
QStringList argv = {"-targetDir", "./" + DISTRO_DIR + "2"};
2019-08-27 11:07:12 +03:00
2019-09-16 09:44:19 +03:00
QuasarAppUtils::Params::parseParams(argv);
2019-08-27 11:07:12 +03:00
dep.setTargetDir();
2019-12-15 18:30:24 +03:00
QVERIFY(dep.config()->getTargetDir() == QFileInfo("./" + DISTRO_DIR + "2").absoluteFilePath());
2019-08-27 11:07:12 +03:00
dep.setTargetDir("./ff");
2019-12-15 18:30:24 +03:00
QVERIFY(dep.config()->getTargetDir() == QFileInfo("./" + DISTRO_DIR + "2").absoluteFilePath());
2019-08-26 08:46:53 +03:00
2019-08-25 14:42:00 +03:00
}
2020-04-04 15:43:46 +03:00
void deploytest::runTestParams(QStringList list,
2020-02-28 15:12:44 +03:00
QSet<QString>* tree,
const QStringList &checkableKeys,
2020-01-20 16:40:18 +03:00
bool noWarnings, bool onlySize) {
2019-09-10 18:22:49 +03:00
2020-04-04 17:11:17 +03:00
QuasarAppUtils::Params::parseParams(list);
2019-09-10 18:22:49 +03:00
Deploy deploy;
if (deploy.run() != Good)
QVERIFY(false);
2019-09-10 18:22:49 +03:00
if (tree) {
2020-02-28 15:12:44 +03:00
checkResults(*tree, checkableKeys, noWarnings, onlySize);
2019-09-27 20:18:45 +03:00
}
#ifdef WITH_SNAP
#ifdef Q_OS_UNIX
if (QFileInfo::exists("/snap/cqtdeployer/current/cqtdeployer.sh") && tree) {
2019-09-10 18:22:49 +03:00
TestUtils utils;
2019-09-27 20:18:45 +03:00
auto targetDir = DeployCore::_config->targetDir;
QuasarAppUtils::Params::parseParams(QStringList{"clear",
"-targetDir", targetDir,
2020-07-05 13:53:15 +03:00
});
2019-09-27 20:18:45 +03:00
Deploy deployClear;
QVERIFY(deployClear.run() == 0);
2019-09-10 18:22:49 +03:00
auto resultTree = utils.getTree(DeployCore::_config->targetDir);
2019-09-13 17:44:20 +03:00
2019-09-27 20:18:45 +03:00
QVERIFY(!resultTree.size());
2019-09-10 18:22:49 +03:00
2019-09-27 20:18:45 +03:00
QProcess cqtdeployerProcess;
cqtdeployerProcess.setProcessEnvironment(QProcessEnvironment::systemEnvironment());
cqtdeployerProcess.setProgram("cqtdeployer");
cqtdeployerProcess.setArguments(list);
2019-05-14 11:31:13 +03:00
2019-09-27 20:18:45 +03:00
cqtdeployerProcess.start();
2019-09-13 17:44:20 +03:00
2019-09-27 20:18:45 +03:00
QVERIFY(cqtdeployerProcess.waitForStarted());
QVERIFY(cqtdeployerProcess.waitForFinished(3000000));
2019-09-13 17:44:20 +03:00
2019-09-27 20:18:45 +03:00
checkResults(*tree, noWarnings);
}
#endif
#endif
}
2019-09-13 17:44:20 +03:00
2020-02-28 15:12:44 +03:00
void deploytest::checkResults(const QSet<QString> &tree,
const QStringList& checkagbleKeys,
bool noWarnings,
bool onlySize) {
2019-09-27 20:18:45 +03:00
TestUtils utils;
2019-09-13 17:44:20 +03:00
2019-09-27 20:18:45 +03:00
QVERIFY(DeployCore::_config);
2019-12-15 18:30:24 +03:00
QVERIFY(!DeployCore::_config->getTargetDir().isEmpty());
2019-09-27 20:18:45 +03:00
2019-12-15 18:30:24 +03:00
auto resultTree = utils.getTree(DeployCore::_config->getTargetDir());
2019-09-27 20:18:45 +03:00
auto comapre = utils.compareTree(resultTree, tree);
2019-12-24 11:46:11 +03:00
if (onlySize) {
QVERIFY(resultTree.size() > tree.size());
return;
}
2019-09-27 20:18:45 +03:00
if (comapre.size() != 0) {
2019-09-27 20:18:45 +03:00
bool bug = false;
2019-11-02 01:00:05 +03:00
QJsonObject comapreResult;
2019-09-27 20:18:45 +03:00
for (auto i = comapre.begin(); i != comapre.end(); ++i) {
if (i.value() == 1) {
2019-11-02 01:00:05 +03:00
comapreResult[ i.key()] = "Added unnecessary file";
2019-09-27 20:18:45 +03:00
qCritical() << "added unnecessary file : " + i.key();
bug = true;
2020-02-28 15:12:44 +03:00
} else if (getFilesTree(checkagbleKeys).contains(QFileInfo(i.key()).fileName())) {
2019-11-02 01:00:05 +03:00
comapreResult[ i.key()] = "Missing";
2019-09-27 20:18:45 +03:00
qCritical() << "Missing file : " + i.key();
bug = true;
} else if (noWarnings) {
2019-11-02 01:00:05 +03:00
comapreResult[ i.key()] = " not exits in qt Dir";
2019-09-27 20:18:45 +03:00
qCritical() << "File : " + i.key() + " not exits in qt Dir";
bug = true;
} else {
2019-11-02 01:00:05 +03:00
comapreResult[ i.key()] = " not exits in qt Dir";
2019-09-27 20:18:45 +03:00
qWarning() << "File : " + i.key() + " not exits in qt Dir";
}
}
2019-09-12 21:42:10 +03:00
2019-09-27 20:18:45 +03:00
if (!bug) {
return;
}
2019-09-27 20:18:45 +03:00
QJsonObject obj;
for (const auto &i : resultTree) {
obj[i];
2019-09-12 21:42:10 +03:00
}
2019-09-10 18:22:49 +03:00
2019-09-27 20:18:45 +03:00
QJsonDocument doc(obj);
QFile lasttree("./LastTree.json");
lasttree.open(QIODevice::WriteOnly| QIODevice::Truncate);
lasttree.write(doc.toJson());
lasttree.close();
2019-11-02 01:00:05 +03:00
lasttree.setFileName("./CompareTree.json");
lasttree.open(QIODevice::WriteOnly| QIODevice::Truncate);
lasttree.write(QJsonDocument(comapreResult).toJson());
lasttree.close();
2019-09-27 20:18:45 +03:00
QVERIFY2(false, "runTestParams fail");
2019-09-10 18:22:49 +03:00
}
}
2019-12-27 12:51:03 +03:00
void deploytest::costomScript() {
TestUtils utils;
#ifdef Q_OS_UNIX
QFile f("./" + DISTRO_DIR + "/bin/TestOnlyC");
auto comapareTree = utils.createTree(
{"./" + DISTRO_DIR + "/bin/TestOnlyC",
"./" + DISTRO_DIR + "/bin/qt.conf",
"./" + DISTRO_DIR + "/TestOnlyC.sh"});
QString bin = TestBinDir + "TestOnlyC";
QString scriptPath = "./" + DISTRO_DIR + "/TestOnlyC.sh";
#else
QFile f("./" + DISTRO_DIR + "/TestOnlyC.exe");
auto comapareTree = utils.createTree(
{"./" + DISTRO_DIR + "/TestOnlyC.exe",
2020-01-10 18:15:31 +03:00
"./" + DISTRO_DIR + "/TestOnlyC.bat",
2019-12-27 12:51:03 +03:00
"./" + DISTRO_DIR + "/qt.conf"});
QString bin = TestBinDir + "TestOnlyC.exe";
QString scriptPath = "./" + DISTRO_DIR + "/TestOnlyC.bat";
#endif
runTestParams({"-bin", bin, "force-clear", "noOverwrite", "-libOut", "lib"}, &comapareTree);
QFile script(scriptPath);
QVERIFY(script.open(QIODevice::ReadOnly));
auto scriptText = script.readAll();
QVERIFY(!scriptText.contains("Begin Custom Script"));
script.close();
runTestParams({"-bin", bin, "force-clear", "noOverwrite",
"-libOut", "lib",
"-customScript", "echo 'this is test script'"}, &comapareTree);
QVERIFY(script.open(QIODevice::ReadOnly));
scriptText = script.readAll();
QVERIFY(scriptText.contains("Begin Custom Script"));
QVERIFY(scriptText.contains("echo 'this is test script'"));
QVERIFY(scriptText.contains("End Custom Script"));
script.close();
2019-09-10 18:22:49 +03:00
}
void deploytest::testOverwrite() {
TestUtils utils;
2019-09-12 17:00:50 +03:00
#ifdef Q_OS_UNIX
2019-09-16 09:44:19 +03:00
QFile f("./" + DISTRO_DIR + "/bin/TestOnlyC");
auto comapareTree = utils.createTree(
2019-09-16 09:44:19 +03:00
{"./" + DISTRO_DIR + "/bin/TestOnlyC",
2019-09-19 10:25:31 +03:00
"./" + DISTRO_DIR + "/bin/qt.conf",
2019-09-16 09:44:19 +03:00
"./" + DISTRO_DIR + "/TestOnlyC.sh"});
2019-09-14 13:59:11 +03:00
QString bin = TestBinDir + "TestOnlyC";
2019-09-12 17:00:50 +03:00
#else
2019-09-16 09:44:19 +03:00
QFile f("./" + DISTRO_DIR + "/TestOnlyC.exe");
2019-09-12 17:00:50 +03:00
auto comapareTree = utils.createTree(
2019-09-16 09:44:19 +03:00
{"./" + DISTRO_DIR + "/TestOnlyC.exe",
"./" + DISTRO_DIR + "/qt.conf"});
2019-09-14 13:59:11 +03:00
QString bin = TestBinDir + "TestOnlyC.exe";
2019-04-06 14:42:22 +03:00
2019-04-01 12:45:12 +03:00
#endif
2019-09-14 13:59:11 +03:00
runTestParams({"-bin", bin, "force-clear", "noOverwrite"}, &comapareTree);
QVERIFY(f.open(QIODevice::ReadOnly));
auto hashBefor = QCryptographicHash::hash(f.readAll(), QCryptographicHash::Md5);
f.close();
QVERIFY(f.open(QIODevice::WriteOnly | QIODevice::Append));
f.write(QByteArray(10, '1'));
f.close();
QVERIFY(f.open(QIODevice::ReadOnly));
auto hashAfter = QCryptographicHash::hash(f.readAll(), QCryptographicHash::Md5);
f.close();
QVERIFY(hashAfter != hashBefor);
2019-09-14 13:59:11 +03:00
runTestParams({"-bin", bin, "noOverwrite"}, &comapareTree);
QVERIFY(f.open(QIODevice::ReadOnly));
hashAfter = QCryptographicHash::hash(f.readAll(), QCryptographicHash::Md5);
f.close();
QVERIFY(hashAfter != hashBefor);
2019-09-14 13:59:11 +03:00
runTestParams({"-bin", bin}, &comapareTree);
QVERIFY(f.open(QIODevice::ReadOnly));
hashAfter = QCryptographicHash::hash(f.readAll(), QCryptographicHash::Md5);
f.close();
QVERIFY(hashAfter == hashBefor);
2019-04-01 12:45:12 +03:00
}
2019-09-12 10:23:49 +03:00
void deploytest::testBinDir() {
TestUtils utils;
2019-09-12 17:00:50 +03:00
#ifdef Q_OS_UNIX
2019-09-12 10:23:49 +03:00
auto comapareTree = utils.createTree(
2019-09-16 09:44:19 +03:00
{"./" + DISTRO_DIR + "/bin/TestOnlyC",
2019-09-19 10:25:31 +03:00
"./" + DISTRO_DIR + "/bin/qt.conf",
2019-09-16 09:44:19 +03:00
"./" + DISTRO_DIR + "/bin/QtWidgetsProject",
"./" + DISTRO_DIR + "/bin/TestQMLWidgets",
"./" + DISTRO_DIR + "/bin/basic",
2019-09-16 09:44:19 +03:00
"./" + DISTRO_DIR + "/TestOnlyC.sh",
"./" + DISTRO_DIR + "/QtWidgetsProject.sh",
"./" + DISTRO_DIR + "/TestQMLWidgets.sh",
"./" + DISTRO_DIR + "/basic.sh"});
2019-09-12 17:00:50 +03:00
#else
auto comapareTree = utils.createTree(
2019-09-16 09:44:19 +03:00
{"./" + DISTRO_DIR + "/TestOnlyC.exe",
"./" + DISTRO_DIR + "/QtWidgetsProject.exe",
"./" + DISTRO_DIR + "/TestQMLWidgets.exe",
"./" + DISTRO_DIR + "/basic.exe",
2019-09-16 09:44:19 +03:00
"./" + DISTRO_DIR + "/qt.conf"});
2019-09-12 17:00:50 +03:00
#endif
2019-04-04 18:11:38 +03:00
2020-02-27 21:01:32 +03:00
#ifdef Q_OS_UNIX
2019-09-19 11:13:28 +03:00
comapareTree += utils.createTree(
2020-11-28 23:19:21 +03:00
{"./" + DISTRO_DIR + "/bin/quicknanobrowser",
"./" + DISTRO_DIR + "/quicknanobrowser.sh",
"./" + DISTRO_DIR + "/bin/webui",
"./" + DISTRO_DIR + "/webui.sh"});
2019-09-19 11:13:28 +03:00
#endif
2019-04-04 18:11:38 +03:00
2019-11-14 17:35:21 +03:00
runTestParams({"-binDir", TestBinDir, "clear",
2020-10-13 22:38:16 +03:00
"noCheckRPATH", "noCheckPATH", "noQt"}, &comapareTree);
2019-09-12 17:00:50 +03:00
}
void deploytest::testConfFile() {
TestUtils utils;
2019-04-04 18:11:38 +03:00
2019-12-29 14:19:07 +03:00
2019-09-12 21:42:10 +03:00
QFile::remove(TestBinDir + "/TestConf.json");
2019-10-16 14:25:44 +03:00
QFile::remove(TestBinDir + "/../folder/For/Testing/Deploy/File/TestConf.json");
2019-09-12 17:00:50 +03:00
#ifdef Q_OS_UNIX
auto comapareTree = utils.createTree(
2019-09-16 09:44:19 +03:00
{"./" + DISTRO_DIR + "/bin/TestOnlyC",
2019-09-19 10:25:31 +03:00
"./" + DISTRO_DIR + "/bin/qt.conf",
2019-09-16 09:44:19 +03:00
"./" + DISTRO_DIR + "/bin/QtWidgetsProject",
"./" + DISTRO_DIR + "/bin/TestQMLWidgets",
"./" + DISTRO_DIR + "/bin/basic",
2019-09-16 09:44:19 +03:00
"./" + DISTRO_DIR + "/TestOnlyC.sh",
"./" + DISTRO_DIR + "/QtWidgetsProject.sh",
"./" + DISTRO_DIR + "/TestQMLWidgets.sh",
"./" + DISTRO_DIR + "/basic.sh"});
2019-04-04 18:11:38 +03:00
#else
2019-09-12 17:00:50 +03:00
auto comapareTree = utils.createTree(
2019-09-16 09:44:19 +03:00
{"./" + DISTRO_DIR + "/TestOnlyC.exe",
"./" + DISTRO_DIR + "/QtWidgetsProject.exe",
"./" + DISTRO_DIR + "/TestQMLWidgets.exe",
"./" + DISTRO_DIR + "/basic.exe",
"./" + DISTRO_DIR + "/qt.conf"});
2019-04-04 18:11:38 +03:00
#endif
2019-03-28 19:23:22 +03:00
2020-02-27 21:01:32 +03:00
#ifdef Q_OS_UNIX
2019-09-19 11:13:28 +03:00
comapareTree += utils.createTree(
2019-09-19 10:25:31 +03:00
{"./" + DISTRO_DIR + "/bin/quicknanobrowser",
2020-11-28 23:19:21 +03:00
"./" + DISTRO_DIR + "/quicknanobrowser.sh",
"./" + DISTRO_DIR + "/bin/webui",
"./" + DISTRO_DIR + "/webui.sh"});
2019-09-19 10:25:31 +03:00
#endif
2019-03-28 19:23:22 +03:00
2020-10-13 22:38:16 +03:00
runTestParams({"-bin", TestBinDir, "clear" , "noCheckRPATH", "noCheckPATH", "noQt",
2019-09-12 17:00:50 +03:00
"-confFile", TestBinDir + "/TestConf.json"}, &comapareTree);
2019-03-28 19:23:22 +03:00
2019-09-12 17:00:50 +03:00
QVERIFY(QFile::exists(TestBinDir + "/TestConf.json"));
QFile::remove(TestBinDir + "/TestConf.json");
2019-03-28 19:23:22 +03:00
2019-11-16 17:59:17 +03:00
comapareTree -= utils.createTree(
2020-11-28 23:19:21 +03:00
{"./" + DISTRO_DIR + "/bin/quicknanobrowser",
"./" + DISTRO_DIR + "/quicknanobrowser.sh",
"./" + DISTRO_DIR + "/bin/webui",
"./" + DISTRO_DIR + "/webui.sh"});
2019-11-16 17:59:17 +03:00
2019-09-12 17:00:50 +03:00
#ifdef Q_OS_UNIX
2019-09-12 21:42:10 +03:00
runTestParams({"-bin", TestBinDir + "TestOnlyC," + TestBinDir + "QtWidgetsProject," + TestBinDir + "TestQMLWidgets",
2020-10-13 22:38:16 +03:00
"clear", "noCheckRPATH", "noCheckPATH", "noQt",
2019-09-12 17:00:50 +03:00
"-confFile", TestBinDir + "/TestConf.json"}, &comapareTree);
#else
2019-09-12 21:42:10 +03:00
runTestParams({"-bin", TestBinDir + "TestOnlyC.exe," + TestBinDir + "QtWidgetsProject.exe," + TestBinDir + "TestQMLWidgets.exe",
2020-10-13 22:38:16 +03:00
"clear" , "-libDir", "L:/never/absalut/path", "noCheckPATH", "noQt",
2019-09-12 17:00:50 +03:00
"-confFile", TestBinDir + "/TestConf.json"}, &comapareTree);
#endif
2019-09-12 17:00:50 +03:00
QFile confFile(TestBinDir + "/TestConf.json");
QVERIFY(confFile.open(QIODevice::ReadOnly));
2019-09-12 17:00:50 +03:00
auto data = confFile.readAll();
2019-09-12 21:42:10 +03:00
confFile.close();
2019-09-12 17:00:50 +03:00
QJsonDocument doc;
2019-09-12 21:42:10 +03:00
doc = doc.fromJson(data);
2019-09-12 17:00:50 +03:00
QVERIFY(!doc.isNull());
#ifdef Q_OS_UNIX
2019-09-12 21:42:10 +03:00
QVERIFY(data.contains("\"bin\": ["));
QVERIFY(data.contains("./TestOnlyC"));
QVERIFY(data.contains("./QtWidgetsProject"));
QVERIFY(data.contains("./TestQMLWidgets"));
2020-07-05 13:53:15 +03:00
// QVERIFY(data.contains("\"libDir\": \"/never/absalut/path/\""));
2019-09-12 17:00:50 +03:00
QVERIFY(data.contains("\"clear\": true"));
2019-10-17 12:42:55 +03:00
data.insert(data.size() - 2, QString(",\"libDir\": \"/never/absalut/path/\"").toLatin1());
QVERIFY(confFile.open(QIODevice::WriteOnly | QIODevice::Truncate));
confFile.write(data);
2019-10-16 18:07:36 +03:00
confFile.close();
2019-09-12 21:42:10 +03:00
runTestParams({"-confFile", TestBinDir + "/TestConf.json"}, &comapareTree);
2019-04-01 22:03:37 +03:00
#else
QVERIFY(data.contains("\"bin\": ["));
QVERIFY(data.contains("./TestOnlyC.exe"));
QVERIFY(data.contains("./QtWidgetsProject.exe"));
QVERIFY(data.contains("./TestQMLWidgets.exe"));
2019-10-17 15:42:44 +03:00
QVERIFY(data.contains("\"libDir\": \"L:/never/absalut/path\""));
QVERIFY(data.contains("\"clear\": true"));
2019-09-12 21:42:10 +03:00
runTestParams({"-confFile", TestBinDir + "/TestConf.json"}, &comapareTree);
2019-03-28 19:23:22 +03:00
#endif
2019-09-12 10:23:49 +03:00
2019-09-12 21:42:10 +03:00
QVERIFY(QuasarAppUtils::Params::isEndable("clear"));
QVERIFY(QuasarAppUtils::Params::isEndable("bin"));
2019-10-16 18:07:36 +03:00
QVERIFY(QuasarAppUtils::Params::isEndable("libDir"));
#ifdef Q_OS_UNIX
QVERIFY(QuasarAppUtils::Params::getStrArg("libDir") == "/never/absalut/path/");
#else
2019-10-17 15:42:44 +03:00
QVERIFY(QuasarAppUtils::Params::getStrArg("libDir") == "L:/never/absalut/path");
2019-10-16 18:07:36 +03:00
#endif
QFile::remove(TestBinDir + "/TestConf.json");
2019-10-16 14:25:44 +03:00
#ifdef Q_OS_UNIX
runTestParams({"-bin", TestBinDir + "TestOnlyC," + TestBinDir + "QtWidgetsProject," + TestBinDir + "TestQMLWidgets",
2020-10-13 22:38:16 +03:00
"clear" , "noCheckRPATH", "noCheckPATH", "noQt",
2019-10-16 14:25:44 +03:00
"-confFile", TestBinDir + "/../folder/For/Testing/Deploy/File/TestConf.json"}, &comapareTree);
#else
runTestParams({"-bin", TestBinDir + "TestOnlyC.exe," + TestBinDir + "QtWidgetsProject.exe," + TestBinDir + "TestQMLWidgets.exe",
2020-10-13 22:38:16 +03:00
"clear" , "noCheckPATH", "noQt",
2019-10-16 14:25:44 +03:00
"-confFile", TestBinDir + "/../folder/For/Testing/Deploy/File/TestConf.json"}, &comapareTree);
#endif
confFile.setFileName(TestBinDir + "/../folder/For/Testing/Deploy/File/TestConf.json");
QVERIFY(confFile.open(QIODevice::ReadOnly));
data = confFile.readAll();
confFile.close();
doc = doc.fromJson(data);
QVERIFY(!doc.isNull());
#ifdef Q_OS_UNIX
QVERIFY(data.contains("\"bin\": ["));
QVERIFY(data.contains("./../../../../../build/TestOnlyC"));
QVERIFY(data.contains("./../../../../../build/QtWidgetsProject"));
QVERIFY(data.contains("./../../../../../build/TestQMLWidgets"));
QVERIFY(data.contains("\"clear\": true"));
2019-11-16 17:59:17 +03:00
QString qmake = TestQtDir + "bin/qmake";
2019-10-16 14:25:44 +03:00
#else
QVERIFY(data.contains("\"bin\": ["));
QVERIFY(data.contains("./../../../../../build/TestOnlyC.exe"));
QVERIFY(data.contains("./../../../../../build/QtWidgetsProject.exe"));
QVERIFY(data.contains("./../../../../../build/TestQMLWidgets.exe"));
QVERIFY(data.contains("\"clear\": true"));
2019-11-16 17:59:17 +03:00
QString qmake = TestQtDir + "bin/qmake.exe";
2019-10-16 14:25:44 +03:00
#endif
runTestParams({"-confFile", TestBinDir + "/../folder/For/Testing/Deploy/File/TestConf.json"}, &comapareTree);
QVERIFY(QuasarAppUtils::Params::isEndable("clear"));
QVERIFY(QuasarAppUtils::Params::isEndable("bin"));
2019-11-16 17:59:17 +03:00
comapareTree += TestModule.qtLibs();
comapareTree += TestModule.qmlLibs();
2019-11-16 17:59:17 +03:00
runTestParams({"-confFile", TestBinDir + "/../folder/For/Testing/Deploy/File/TestConf.json",
"-qmake", qmake,
"-qmlDir", TestBinDir + "/../TestQMLWidgets",
2020-07-05 13:53:15 +03:00
}, &comapareTree);
2019-10-16 14:25:44 +03:00
QVERIFY(QuasarAppUtils::Params::isEndable("clear"));
QVERIFY(QuasarAppUtils::Params::isEndable("bin"));
QFile::remove(TestBinDir + "/../folder/For/Testing/Deploy/File/TestConf.json");
2020-01-10 16:02:07 +03:00
// Test generar string in confFile
comapareTree = TestModule.qtLibs();
2020-01-09 23:47:57 +03:00
comapareTree = TestModule.ignoreFilter(comapareTree, "/plugins/p");
2020-01-10 10:43:35 +03:00
#ifdef Q_OS_UNIX
comapareTree -= utils.createTree(
{
2020-07-05 13:53:15 +03:00
"./" + DISTRO_DIR + "/lib/libQt5EglFSDeviceIntegration.so",
});
2020-01-10 18:15:31 +03:00
auto bin = TestBinDir + "QtWidgetsProject";
2020-01-10 10:43:35 +03:00
#else
comapareTree -= utils.createTree(
{
2020-07-05 13:53:15 +03:00
"./" + DISTRO_DIR + "/Qt5DBus.dll"
2020-03-28 23:25:42 +03:00
2020-07-05 13:53:15 +03:00
});
2020-01-10 18:15:31 +03:00
auto bin = TestBinDir + "QtWidgetsProject.exe";
2020-01-10 10:43:35 +03:00
#endif
2020-01-09 23:47:57 +03:00
2020-01-10 18:15:31 +03:00
runTestParams({"-bin", bin,
"-qmake", qmake,
2020-01-10 10:43:35 +03:00
"clear",
2020-01-09 23:47:57 +03:00
"-ignore", "/plugins/p",
"-confFile", TestBinDir + "/TestConf.json"}, &comapareTree);
runTestParams({"-confFile", TestBinDir + "/TestConf.json"}, &comapareTree);
QFile::remove(TestBinDir + "/TestConf.json");
2020-01-02 19:27:40 +03:00
#ifdef Q_OS_UNIX
QFile f("./" + DISTRO_DIR + "/bin/TestOnlyC");
comapareTree = utils.createTree(
{
2020-07-05 13:53:15 +03:00
"./" + DISTRO_DIR + "/package/TestOnlyC.sh",
"./" + DISTRO_DIR + "/package/bin/TestOnlyC",
"./" + DISTRO_DIR + "/package/bin/qt.conf"
});
2020-01-02 19:27:40 +03:00
QString target1 = TestBinDir + "TestOnlyC";
#else
QFile f("./" + DISTRO_DIR + "/TestOnlyC.exe");
comapareTree = utils.createTree(
2020-01-27 20:02:25 +03:00
{"./" + DISTRO_DIR + "/package/TestOnlyC.exe",
"./" + DISTRO_DIR + "/package/qt.conf"});
2020-01-02 19:27:40 +03:00
QString target1 = TestBinDir + "TestOnlyC.exe";
#endif
2020-01-18 16:52:00 +03:00
bin = target1;
2020-01-02 19:27:40 +03:00
runTestParams({"-bin", bin, "force-clear",
2020-07-05 13:53:15 +03:00
"-targetPackage", "package;TestOn",
"-confFile", TestBinDir + "/../folder/For/Testing/Deploy/File/TestConf.json"}, &comapareTree);
2020-01-02 19:27:40 +03:00
runTestParams({"-confFile", TestBinDir + "/../folder/For/Testing/Deploy/File/TestConf.json"},
&comapareTree);
QFile::remove(TestBinDir + "/../folder/For/Testing/Deploy/File/TestConf.json");
2020-03-13 21:49:13 +03:00
auto file = "testCase.json";
#ifdef Q_OS_UNIX
bin = TestBinDir + "QtWidgetsProject," + TestBinDir + "TestOnlyC";
#else
bin = TestBinDir + "QtWidgetsProject.exe," + TestBinDir + "TestOnlyC.exe";
#endif
2020-03-13 21:49:13 +03:00
QVERIFY(utils.deployFile(":/testResurces/testRes/testMultiPackageConfig.json", file,
{{"$BIN_DIR", bin.toLatin1()}}));
2020-03-13 21:49:13 +03:00
comapareTree = TestModule.onlyC(DISTRO_DIR + "/Dstro1") +
TestModule.qtLibs(DISTRO_DIR + "/Dstro2");
2020-01-02 19:27:40 +03:00
2020-03-14 13:59:21 +03:00
#ifdef Q_OS_LINUX
auto qmlDir = TestBinDir + "/../";
#else
auto qmlDir = TestBinDir + "/../TestQMLWidgets";
#endif
2020-03-13 21:49:13 +03:00
runTestParams({"-confFile", file},
2020-03-13 21:49:13 +03:00
&comapareTree);
2019-03-28 19:23:22 +03:00
}
2020-01-27 20:02:25 +03:00
void deploytest::testPackages() {
TestUtils utils;
#ifdef Q_OS_UNIX
QFile f("./" + DISTRO_DIR + "/bin/TestOnlyC");
auto comapareTree = utils.createTree(
2020-01-02 19:27:40 +03:00
{
2020-07-05 13:53:15 +03:00
"./" + DISTRO_DIR + "/package/TestOnlyC.sh",
"./" + DISTRO_DIR + "/package/bin/TestOnlyC",
"./" + DISTRO_DIR + "/package/bin/qt.conf"
});
2019-12-29 14:19:07 +03:00
QString target1 = TestBinDir + "TestOnlyC";
#else
QFile f("./" + DISTRO_DIR + "/TestOnlyC.exe");
auto comapareTree = utils.createTree(
2020-01-27 20:02:25 +03:00
{"./" + DISTRO_DIR + "/package/TestOnlyC.exe",
"./" + DISTRO_DIR + "/package/qt.conf"});
2019-12-29 14:19:07 +03:00
QString target1 = TestBinDir + "TestOnlyC.exe";
#endif
2019-12-29 14:19:07 +03:00
QString bin = target1;
runTestParams({"-bin", bin, "force-clear",
2020-07-05 13:53:15 +03:00
"-targetPackage", "/package/;TestOn"}, &comapareTree);
runTestParams({"-bin", bin, "force-clear",
2020-07-05 13:53:15 +03:00
"-targetPackage", "/package/;" + QFileInfo(target1).absoluteFilePath()}, &comapareTree);
2019-12-29 14:19:07 +03:00
#ifdef Q_OS_UNIX
QString target2 = TestBinDir + "TestQMLWidgets";
QString target3 = TestBinDir + "QtWidgetsProject";
#else
QString target2 = TestBinDir + "TestQMLWidgets.exe";
QString target3 = TestBinDir + "QtWidgetsProject.exe";
#endif
bin += "," + target2;
bin += "," + target3;
2020-02-26 16:51:28 +03:00
auto packageString = "package1;" + QFileInfo(target1).absoluteFilePath() + ",package2/ZzZ;" + QFileInfo(target2).absoluteFilePath();
2020-01-02 19:27:40 +03:00
comapareTree = TestModule.testDistroLibs(DISTRO_DIR);
2020-01-02 19:27:40 +03:00
runTestParams({"-bin", bin, "force-clear",
2019-12-29 14:19:07 +03:00
"-binOut", "/lol",
"-libOut", "/lolLib",
"-trOut", "/lolTr",
"-pluginOut", "/p",
2020-02-27 10:50:11 +03:00
"-qmlOut", "package2/ZzZ;/q/and/q,/q",
"-qmlDir", "package2/ZzZ;" + TestBinDir + "/../TestQMLWidgets",
2020-01-27 20:02:25 +03:00
"-targetPackage", packageString}, &comapareTree);
2020-01-02 19:27:40 +03:00
2020-02-27 10:50:11 +03:00
#ifdef Q_OS_UNIX
2020-01-02 19:27:40 +03:00
2020-02-27 10:50:11 +03:00
// test a wrapers source
QFile wraper("./" + DISTRO_DIR + "/package2/ZzZ/TestQMLWidgets.sh");
2020-01-02 19:27:40 +03:00
2020-02-27 10:50:11 +03:00
QVERIFY(wraper.open(QIODevice::ReadOnly));
auto data = wraper.readAll();
wraper.close();
2020-01-02 19:27:40 +03:00
2020-02-27 10:50:11 +03:00
wraper.setFileName(":/testResurces/testRes/TestQMLWidgets.sh");
QVERIFY(wraper.open(QIODevice::ReadOnly));
QVERIFY(wraper.readAll() == data);
wraper.close();
#endif
2019-12-28 15:06:43 +03:00
}
void deploytest::testQt() {
TestUtils utils;
2019-03-29 18:05:55 +03:00
#ifdef Q_OS_UNIX
2020-07-05 13:53:15 +03:00
QString bin = TestBinDir + "QtWidgetsProject";
QString qmake = TestQtDir + "bin/qmake";
#else
2020-07-05 13:53:15 +03:00
QString bin = TestBinDir + "QtWidgetsProject.exe";
QString qmake = TestQtDir + "bin/qmake.exe";
#endif
auto comapareTree = TestModule.qtLibs();
runTestParams({"-bin", bin, "clear" ,
2020-07-05 13:53:15 +03:00
"-qmake", qmake}, &comapareTree);
2019-03-29 18:05:55 +03:00
2020-07-05 13:53:15 +03:00
// test auto detection of detection qmake from PATH
runTestParams({"-bin", bin, "clear", "noCheckRPATH"}, &comapareTree);
2019-11-14 17:35:21 +03:00
2019-09-13 18:43:28 +03:00
#ifdef Q_OS_UNIX
2020-07-05 13:53:15 +03:00
// test auto detection of detection qmake from RPATH
runTestParams({"-bin", bin, "clear", "noCheckPATH"}, &comapareTree);
#endif
2019-04-04 18:11:38 +03:00
2019-11-14 17:35:21 +03:00
comapareTree = TestModule.qtWithoutTr();
2019-09-13 18:43:28 +03:00
2019-03-29 18:05:55 +03:00
2019-09-13 18:43:28 +03:00
runTestParams({"-bin", bin, "clear" ,
2020-07-05 13:53:15 +03:00
"-qmake", qmake, "noTranslations"}, &comapareTree);
2019-03-29 18:05:55 +03:00
2020-07-05 13:53:15 +03:00
comapareTree = TestModule.qmlLibs();
2020-01-28 15:25:35 +03:00
#ifdef Q_OS_UNIX
2020-07-05 13:53:15 +03:00
bin = TestBinDir + "TestQMLWidgets";
#else
bin = TestBinDir + "TestQMLWidgets.exe";
2020-01-28 15:25:35 +03:00
#endif
2020-01-28 13:51:00 +03:00
2020-07-05 13:53:15 +03:00
runTestParams({"-bin", bin, "clear" ,
"-qmake", qmake,
"-qmlDir", TestBinDir + "/../TestQMLWidgets"}, &comapareTree);
2019-09-24 16:30:52 +03:00
2020-07-05 13:53:15 +03:00
#ifdef Q_OS_UNIX
2019-09-13 18:43:28 +03:00
runTestParams({"-bin", bin, "clear" ,
2020-07-05 13:53:15 +03:00
"-qmlDir", TestBinDir + "/../TestQMLWidgets"}, &comapareTree);
#endif
2019-09-14 15:51:23 +03:00
}
2019-09-28 16:44:39 +03:00
void deploytest::testClear() {
TestUtils utils;
auto compareTree = QSet<QString>{};
runTestParams({"clear"}, &compareTree);
}
2019-09-14 15:51:23 +03:00
void deploytest::testIgnore() {
TestUtils utils;
2019-03-29 18:05:55 +03:00
2019-03-29 23:02:39 +03:00
2019-09-14 15:51:23 +03:00
#ifdef Q_OS_UNIX
QString bin = TestBinDir + "QtWidgetsProject";
QString qmake = TestQtDir + "bin/qmake";
2019-09-26 13:18:10 +03:00
auto comapareTree = utils.createTree(
{
"./" + DISTRO_DIR + "/QtWidgetsProject.sh",
"./" + DISTRO_DIR + "/bin/qt.conf",
"./" + DISTRO_DIR + "/bin/QtWidgetsProject",
});
2019-09-14 15:51:23 +03:00
2019-09-24 16:30:52 +03:00
#else
QString bin = TestBinDir + "QtWidgetsProject.exe";
QString qmake = TestQtDir + "bin/qmake.exe";
2019-09-14 15:51:23 +03:00
auto comapareTree = utils.createTree(
{
2019-09-26 13:18:10 +03:00
"./" + DISTRO_DIR + "/qt.conf",
"./" + DISTRO_DIR + "/QtWidgetsProject.exe",
"./" + DISTRO_DIR + "/libgcc_s_seh-1.dll",
"./" + DISTRO_DIR + "/libstdc++-6.dll",
"./" + DISTRO_DIR + "/libwinpthread-1.dll"
2019-09-26 13:18:10 +03:00
2019-09-14 15:51:23 +03:00
});
2019-05-14 11:31:13 +03:00
2019-09-26 13:18:10 +03:00
#endif
if (!TestQtDir.contains("Qt5")) {
#ifdef Q_OS_UNIX
QString bin = TestBinDir + "QtWidgetsProject";
QString qmake = TestQtDir + "bin/qmake";
#else
QString bin = TestBinDir + "QtWidgetsProject.exe";
QString qmake = TestQtDir + "bin/qmake.exe";
#endif
}
2019-05-14 11:31:13 +03:00
2019-09-14 15:51:23 +03:00
runTestParams({"-bin", bin, "clear" ,
"-qmake", qmake,
2020-07-05 13:53:15 +03:00
"-ignore", "Qt5"}, &comapareTree);
2019-03-29 18:05:55 +03:00
2019-09-26 13:18:10 +03:00
#ifdef Q_OS_UNIX
2019-09-14 15:51:23 +03:00
comapareTree = utils.createTree(
{
2019-09-16 09:44:19 +03:00
"./" + DISTRO_DIR + "/QtWidgetsProject.sh",
2019-09-19 11:13:28 +03:00
"./" + DISTRO_DIR + "/bin/qt.conf",
2019-09-16 09:44:19 +03:00
"./" + DISTRO_DIR + "/bin/QtWidgetsProject",
2019-09-14 15:51:23 +03:00
});
2019-03-29 18:05:55 +03:00
2019-09-26 13:18:10 +03:00
auto removeTree = utils.createTree({
2020-07-05 13:53:15 +03:00
"./" + DISTRO_DIR + "/plugins/virtualkeyboard/libqtvirtualkeyboard_hangul.so",
"./" + DISTRO_DIR + "/plugins/virtualkeyboard/libqtvirtualkeyboard_openwnn.so",
"./" + DISTRO_DIR + "/plugins/virtualkeyboard/libqtvirtualkeyboard_pinyin.so",
"./" + DISTRO_DIR + "/plugins/virtualkeyboard/libqtvirtualkeyboard_tcime.so",
"./" + DISTRO_DIR + "/plugins/virtualkeyboard/libqtvirtualkeyboard_thai.so",
"./" + DISTRO_DIR + "/plugins/platforminputcontexts/libqtvirtualkeyboardplugin.so",
"./" + DISTRO_DIR + "/lib/libQt5VirtualKeyboard.so",
2019-10-15 13:35:50 +03:00
2020-07-05 13:53:15 +03:00
});
2019-10-15 13:35:50 +03:00
2019-09-26 13:18:10 +03:00
#else
comapareTree = utils.createTree(
{
"./" + DISTRO_DIR + "/qt.conf",
"./" + DISTRO_DIR + "/QtWidgetsProject.exe",
});
auto removeTree = utils.createTree({
2020-07-05 13:53:15 +03:00
"./" + DISTRO_DIR + "/Qt5VirtualKeyboard.dll",
"./" + DISTRO_DIR + "/plugins/platforminputcontexts/qtvirtualkeyboardplugin.dll",
"./" + DISTRO_DIR + "/plugins/virtualkeyboard/qtvirtualkeyboard_hangul.dll",
"./" + DISTRO_DIR + "/plugins/virtualkeyboard/qtvirtualkeyboard_openwnn.dll",
"./" + DISTRO_DIR + "/plugins/virtualkeyboard/qtvirtualkeyboard_pinyin.dll",
"./" + DISTRO_DIR + "/plugins/virtualkeyboard/qtvirtualkeyboard_tcime.dll",
"./" + DISTRO_DIR + "/plugins/virtualkeyboard/qtvirtualkeyboard_thai.dll"
});
2019-10-17 15:42:44 +03:00
2019-09-26 13:18:10 +03:00
#endif
2019-09-14 15:51:23 +03:00
runTestParams({"-bin", bin, "clear" ,
"-qmake", qmake,
"-recursiveDepth", "3",
"-ignoreEnv", TestQtDir + "/lib," + TestQtDir + "/bin," + TestQtDir + "/../../Tools" },
2020-10-14 13:17:26 +03:00
&comapareTree);
2019-09-26 13:18:10 +03:00
comapareTree = TestModule.qtLibs() - removeTree;
2019-09-14 15:51:23 +03:00
runTestParams({"-bin", bin, "clear" ,
"-qmake", qmake,
2020-07-05 13:53:15 +03:00
"-ignore", "VirtualKeyboard"}, &comapareTree);
2019-09-13 18:43:28 +03:00
2019-09-12 10:23:49 +03:00
}
2019-09-14 15:51:23 +03:00
void deploytest::testLibDir() {
TestUtils utils;
2019-04-04 18:11:38 +03:00
2019-09-14 15:51:23 +03:00
#ifdef Q_OS_UNIX
QString bin = TestBinDir + "TestOnlyC";
2019-09-28 13:06:43 +03:00
QString extraPath = "/usr/lib,/lib";
2019-04-04 18:11:38 +03:00
2019-09-24 15:11:30 +03:00
auto comapareTree = utils.createTree(
{
2019-09-24 16:30:52 +03:00
"./" + DISTRO_DIR + "/TestOnlyC.sh",
"./" + DISTRO_DIR + "/bin/qt.conf",
"./" + DISTRO_DIR + "/bin/TestOnlyC"
2019-09-24 15:11:30 +03:00
});
2019-09-26 13:18:10 +03:00
#else
QString bin = TestBinDir + "TestOnlyC.exe";
QString extraPath = TestQtDir;
auto comapareTree = utils.createTree(
{
"./" + DISTRO_DIR + "/qt.conf",
"./" + DISTRO_DIR + "/TestOnlyC.exe",
});
#endif
2019-09-14 15:51:23 +03:00
runTestParams({"-bin", bin, "clear" ,
"-libDir", extraPath,
}, &comapareTree);
2019-09-26 13:18:10 +03:00
#ifdef Q_OS_UNIX
2019-09-14 15:51:23 +03:00
comapareTree = utils.createTree(
{
2020-07-05 13:53:15 +03:00
"./" + DISTRO_DIR + "/TestOnlyC.sh",
"./" + DISTRO_DIR + "/bin/qt.conf",
"./" + DISTRO_DIR + "/bin/TestOnlyC",
"./" + DISTRO_DIR + "/lib/libstdc++.so",
"./" + DISTRO_DIR + "/lib/libgcc_s.so",
"./" + DISTRO_DIR + "/lib/ld-linux-x86-64.so",
"./" + DISTRO_DIR + "/lib/libc.so",
"./" + DISTRO_DIR + "/lib/libm.so",
});
2019-11-05 13:17:52 +03:00
auto comapareTreeExtraLib = utils.createTree(
{
2020-07-05 13:53:15 +03:00
"./" + DISTRO_DIR + "2/TestOnlyC.sh",
"./" + DISTRO_DIR + "2/bin/qt.conf",
"./" + DISTRO_DIR + "2/bin/TestOnlyC",
"./" + DISTRO_DIR + "2/lib/libstdc++.so",
"./" + DISTRO_DIR + "2/lib/libgcc_s.so"
});
2019-11-05 13:17:52 +03:00
2019-09-26 13:18:10 +03:00
#else
comapareTree = utils.createTree(
{
2020-07-05 13:53:15 +03:00
"./" + DISTRO_DIR + "/qt.conf",
"./" + DISTRO_DIR + "/TestOnlyC.exe",
"./" + DISTRO_DIR + "/libgcc_s_seh-1.dll",
"./" + DISTRO_DIR + "/libwinpthread-1.dll",
"./" + DISTRO_DIR + "/libstdc++-6.dll",
2019-09-26 13:18:10 +03:00
2020-07-05 13:53:15 +03:00
});
2019-09-26 13:18:10 +03:00
2019-11-05 13:17:52 +03:00
auto comapareTreeExtraLib = utils.createTree(
{
2020-07-05 13:53:15 +03:00
"./" + DISTRO_DIR + "2/qt.conf",
"./" + DISTRO_DIR + "2/TestOnlyC.exe",
"./" + DISTRO_DIR + "2/libgcc_s_seh-1.dll",
"./" + DISTRO_DIR + "2/libstdc++-6.dll",
2019-11-05 13:17:52 +03:00
2020-07-05 13:53:15 +03:00
});
2019-11-05 13:17:52 +03:00
2019-09-26 13:18:10 +03:00
#endif
2019-09-14 15:51:23 +03:00
runTestParams({"-bin", bin, "clear" ,
"-libDir", extraPath,
2020-02-26 14:29:04 +03:00
"-recursiveDepth", "5",
2020-10-13 22:38:16 +03:00
"noCheckRPATH, noCheckPATH", "noQt"}, &comapareTree, {}, true);
2019-11-05 13:17:52 +03:00
runTestParams({"-bin", bin, "clear" ,
2020-02-28 22:01:59 +03:00
"-targetDir", "./" + DISTRO_DIR + "2",
2020-02-26 14:29:04 +03:00
"-extraLibs", "stdc,gcc",
2020-10-13 22:38:16 +03:00
"noCheckRPATH, noCheckPATH", "noQt"}, &comapareTreeExtraLib, {}, true);
2019-11-05 13:17:52 +03:00
2020-07-05 13:53:15 +03:00
//task #258
//https://github.com/QuasarApp/CQtDeployer/issues/258
2020-02-28 22:01:59 +03:00
2020-02-26 14:29:04 +03:00
#ifdef Q_OS_UNIX
2020-02-28 22:01:59 +03:00
comapareTreeExtraLib = utils.createTree(
{
2020-07-05 13:53:15 +03:00
"./" + DISTRO_DIR + "/TestOnlyC.sh",
"./" + DISTRO_DIR + "/bin/qt.conf",
"./" + DISTRO_DIR + "/bin/TestOnlyC",
"./" + DISTRO_DIR + "/lib/libstdc++.so",
"./" + DISTRO_DIR + "/lib/libgcc_s.so"
});
2020-05-13 20:34:20 +03:00
extraPath = "./" + DISTRO_DIR + "2/lib";
2020-02-28 22:01:59 +03:00
2020-05-13 18:08:50 +03:00
2020-02-26 14:29:04 +03:00
#else
2020-02-28 22:01:59 +03:00
comapareTreeExtraLib = utils.createTree(
{
2020-07-05 13:53:15 +03:00
"./" + DISTRO_DIR + "/qt.conf",
"./" + DISTRO_DIR + "/TestOnlyC.exe",
"./" + DISTRO_DIR + "/libgcc_s_seh-1.dll",
"./" + DISTRO_DIR + "/libstdc++-6.dll",
2020-02-28 22:01:59 +03:00
2020-07-05 13:53:15 +03:00
});
2020-05-13 20:34:20 +03:00
extraPath = "./" + DISTRO_DIR + "2";
2020-02-28 22:01:59 +03:00
#endif
2020-02-26 14:29:04 +03:00
runTestParams({"-bin", bin, "clear" ,
2020-05-13 18:08:50 +03:00
"-libDir", extraPath,
2020-10-13 22:38:16 +03:00
"noCheckRPATH, noCheckPATH", "noQt"}, &comapareTreeExtraLib, {}, true);
2020-02-28 22:01:59 +03:00
2020-05-13 18:08:50 +03:00
QDir(extraPath).removeRecursively();
2020-02-28 22:01:59 +03:00
2019-09-14 15:51:23 +03:00
}
2019-09-14 15:51:23 +03:00
void deploytest::testExtraPlugins() {
TestUtils utils;
2019-03-29 23:02:39 +03:00
2019-09-14 15:51:23 +03:00
#ifdef Q_OS_UNIX
QString bin = TestBinDir + "QtWidgetsProject";
QString extraPath = "/usr/lib";
QString qmake = TestQtDir + "bin/qmake";
2019-03-29 23:02:39 +03:00
2019-09-26 13:18:10 +03:00
auto pluginTree = utils.createTree(
{
"./" + DISTRO_DIR + "/plugins/sqldrivers/libqsqlodbc.so",
"./" + DISTRO_DIR + "/plugins/sqldrivers/libqsqlpsql.so",
"./" + DISTRO_DIR + "/plugins/sqldrivers/libqsqlite.so",
"./" + DISTRO_DIR + "/lib/libQt5Sql.so",
2020-10-16 23:07:29 +03:00
"./" + DISTRO_DIR + "/lib/libpq.so",
2019-04-04 18:11:38 +03:00
2020-07-05 13:53:15 +03:00
});
2019-04-04 18:11:38 +03:00
#else
2019-09-14 15:51:23 +03:00
QString bin = TestBinDir + "QtWidgetsProject.exe";
QString extraPath = "/usr/lib";
QString qmake = TestQtDir + "bin/qmake.exe";
2019-03-29 18:05:55 +03:00
2019-09-26 13:18:10 +03:00
auto pluginTree = utils.createTree(
{
"./" + DISTRO_DIR + "/plugins/sqldrivers/qsqlmysql.dll",
"./" + DISTRO_DIR + "/plugins/sqldrivers/qsqlodbc.dll",
"./" + DISTRO_DIR + "/plugins/sqldrivers/qsqlite.dll",
"./" + DISTRO_DIR + "/plugins/sqldrivers/qsqlpsql.dll",
"./" + DISTRO_DIR + "/Qt5Sql.dll",
2019-04-04 18:11:38 +03:00
2020-07-05 13:53:15 +03:00
});
2019-04-04 18:11:38 +03:00
#endif
auto comapareTree = TestModule.qtLibs();
2019-03-29 23:02:39 +03:00
2019-09-14 15:51:23 +03:00
runTestParams({"-bin", bin, "clear" ,
"-qmake", qmake,
}, &comapareTree);
2019-03-29 23:02:39 +03:00
2019-09-14 15:51:23 +03:00
comapareTree = comapareTree + pluginTree;
2019-03-29 23:02:39 +03:00
2019-09-14 15:51:23 +03:00
runTestParams({"-bin", bin, "clear" ,
"-qmake", qmake,
2020-07-07 11:05:27 +03:00
"-enablePlugins", "sqldrivers"}, &comapareTree);
runTestParams({"-bin", bin, "clear" ,
"-qmake", qmake,
"-extraPlugin", TestQtDir + "/plugins/sqldrivers"}, &comapareTree);
2020-07-09 00:27:30 +03:00
comapareTree -= pluginTree;
comapareTree -= utils.createTree(
{
"./" + DISTRO_DIR + "/plugins/platforms/libqxcb.so",
"./" + DISTRO_DIR + "/lib/libxcb-xinerama.so.0",
2020-07-09 00:27:30 +03:00
"./" + DISTRO_DIR + "/plugins/xcbglintegrations/libqxcb-egl-integration.so",
"./" + DISTRO_DIR + "/plugins/xcbglintegrations/libqxcb-glx-integration.so",
"./" + DISTRO_DIR + "/lib/libQt5XcbQpa.so",
});
runTestParams({"-bin", bin, "clear" ,
"-qmake", qmake,
"-disablePlugins", "qxcb,xcbglintegrations"}, &comapareTree);
2019-09-14 15:51:23 +03:00
}
2019-05-14 11:31:13 +03:00
2019-09-14 15:51:23 +03:00
void deploytest::testTargetDir() {
TestUtils utils;
2019-05-14 11:31:13 +03:00
2019-09-14 15:51:23 +03:00
#ifdef Q_OS_UNIX
QString bin = TestBinDir + "TestOnlyC";
2019-09-24 16:30:52 +03:00
auto comapareTree = utils.createTree(
{"./" + DISTRO_DIR + "Z/bin/TestOnlyC",
"./" + DISTRO_DIR + "Z/bin/qt.conf",
"./" + DISTRO_DIR + "Z/TestOnlyC.sh"});
2019-09-26 13:18:10 +03:00
#else
QString bin = TestBinDir + "TestOnlyC.exe";
auto comapareTree = utils.createTree(
{"./" + DISTRO_DIR + "Z/TestOnlyC.exe",
"./" + DISTRO_DIR + "Z/qt.conf"});
#endif
2019-09-14 15:51:23 +03:00
runTestParams({"-bin", bin, "clear" ,
2019-09-16 09:44:19 +03:00
"-targetDir", "./" + DISTRO_DIR + "Z"
2019-09-14 15:51:23 +03:00
}, &comapareTree);
2019-03-29 18:05:55 +03:00
}
2019-09-14 15:51:23 +03:00
void deploytest::testSystemLib() {
TestUtils utils;
2019-01-27 15:37:19 +03:00
2019-09-14 15:51:23 +03:00
#ifdef Q_OS_UNIX
QString bin = TestBinDir + "TestOnlyC";
2019-09-25 18:13:04 +03:00
auto comapareTree = utils.createTree(
{
2020-07-05 13:53:15 +03:00
"./" + DISTRO_DIR + "/TestOnlyC.sh",
"./" + DISTRO_DIR + "/bin/qt.conf",
"./" + DISTRO_DIR + "/bin/TestOnlyC",
"./" + DISTRO_DIR + "/lib/libgcc_s.so",
"./" + DISTRO_DIR + "/lib/libstdc++.so"
});
2019-01-27 15:37:19 +03:00
2019-09-24 16:30:52 +03:00
#else
QString bin = TestBinDir + "TestOnlyC.exe";
2019-09-14 15:51:23 +03:00
auto comapareTree = utils.createTree(
{
2020-07-05 13:53:15 +03:00
"./" + DISTRO_DIR + "/TestOnlyC.exe",
"./" + DISTRO_DIR + "/api-ms-win-core-console-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-datetime-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-debug-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-errorhandling-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-fibers-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-file-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-handle-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-heap-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-localization-l1-2-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-memory-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-namedpipe-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-processenvironment-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-processthreads-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-profile-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-string-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-synch-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-synch-l1-2-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-sysinfo-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-util-l1-1-0.dll",
"./" + DISTRO_DIR + "/API-MS-Win-Core-Heap-Obsolete-L1-1-0.dll",
"./" + DISTRO_DIR + "/API-MS-Win-Core-Kernel32-Private-L1-1-0.dll",
"./" + DISTRO_DIR + "/API-MS-Win-Core-Kernel32-Private-L1-1-1.dll",
"./" + DISTRO_DIR + "/API-MS-Win-core-file-l2-1-0.dll",
"./" + DISTRO_DIR + "/API-MS-Win-core-file-l2-1-1.dll",
"./" + DISTRO_DIR + "/API-MS-Win-core-localization-obsolete-l1-2-0.dll",
"./" + DISTRO_DIR + "/API-MS-Win-core-string-l2-1-0.dll",
"./" + DISTRO_DIR + "/API-MS-Win-core-string-obsolete-l1-1-0.dll",
"./" + DISTRO_DIR + "/API-MS-Win-core-xstate-l2-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-com-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-comm-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-datetime-l1-1-1.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-debug-l1-1-1.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-delayload-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-errorhandling-l1-1-1.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-fibers-l1-1-1.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-file-l1-2-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-file-l1-2-1.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-interlocked-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-io-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-io-l1-1-1.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-kernel32-legacy-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-kernel32-legacy-l1-1-1.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-libraryloader-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-libraryloader-l1-1-1.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-localization-l1-2-1.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-memory-l1-1-1.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-memory-l1-1-2.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-privateprofile-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-privateprofile-l1-1-1.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-processenvironment-l1-2-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-processthreads-l1-1-1.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-processthreads-l1-1-2.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-processtopology-obsolete-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-realtime-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-registry-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-registry-l2-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-rtlsupport-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-shlwapi-legacy-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-shlwapi-obsolete-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-shutdown-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-stringansi-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-stringloader-l1-1-1.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-sysinfo-l1-2-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-sysinfo-l1-2-1.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-threadpool-l1-2-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-threadpool-legacy-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-threadpool-private-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-timezone-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-url-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-version-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-wow64-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-xstate-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-service-core-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-service-core-l1-1-1.dll",
"./" + DISTRO_DIR + "/libgcc_s_seh-1.dll",
"./" + DISTRO_DIR + "/libstdc++-6.dll",
"./" + DISTRO_DIR + "/libwinpthread-1.dll",
"./" + DISTRO_DIR + "/msvcrt.dll",
2020-10-17 11:00:12 +03:00
"./" + DISTRO_DIR + "/qt.conf"
2020-07-05 13:53:15 +03:00
});
2019-09-25 18:13:04 +03:00
#endif
2019-09-14 15:51:23 +03:00
runTestParams({"-bin", bin, "clear" ,
"deploySystem"
2020-02-28 15:12:44 +03:00
}, &comapareTree);
2019-01-27 15:37:19 +03:00
2019-09-14 15:51:23 +03:00
#ifdef Q_OS_UNIX
2019-01-27 15:37:19 +03:00
2019-09-16 09:44:19 +03:00
QFile file("./" + DISTRO_DIR + "/TestOnlyC.sh");
2019-01-27 15:37:19 +03:00
2019-09-14 15:51:23 +03:00
QVERIFY(file.open(QIODevice::ReadOnly));
2019-01-27 15:37:19 +03:00
2019-09-14 15:51:23 +03:00
auto runScript = file.readAll();
file.close();
2019-01-27 15:37:19 +03:00
2019-09-24 16:30:52 +03:00
QVERIFY(!runScript.contains("export LD_PRELOAD="));
comapareTree = utils.createTree(
{
2020-07-05 13:53:15 +03:00
"./" + DISTRO_DIR + "/TestOnlyC.sh",
"./" + DISTRO_DIR + "/bin/qt.conf",
"./" + DISTRO_DIR + "/bin/TestOnlyC",
"./" + DISTRO_DIR + "/lib/libgcc_s.so",
"./" + DISTRO_DIR + "/lib/ld-linux-x86-64.so",
"./" + DISTRO_DIR + "/lib/libc.so",
"./" + DISTRO_DIR + "/lib/libm.so",
2019-09-24 16:30:52 +03:00
2020-07-05 13:53:15 +03:00
"./" + DISTRO_DIR + "/lib/libstdc++.so"
});
2019-09-24 16:30:52 +03:00
runTestParams({"-bin", bin, "clear" ,
"deploySystem-with-libc"
2020-02-28 15:12:44 +03:00
}, &comapareTree);
2019-09-24 16:30:52 +03:00
file.setFileName("./" + DISTRO_DIR + "/TestOnlyC.sh");
QVERIFY(file.open(QIODevice::ReadOnly));
runScript = file.readAll();
file.close();
2019-09-14 15:51:23 +03:00
QVERIFY(runScript.contains("export LD_PRELOAD="));
2019-09-24 16:30:52 +03:00
#else
QString qmake = TestQtDir + "bin/qmake.exe";
bin = TestBinDir + "QtWidgetsProject.exe";
comapareTree += TestModule.qtLibs();
comapareTree -= utils.createTree(
{
2020-07-05 13:53:15 +03:00
"./" + DISTRO_DIR + "/TestOnlyC.exe",
});
comapareTree += utils.createTree(
{
2020-07-05 13:53:15 +03:00
"./" + DISTRO_DIR + "/api-ms-win-core-console-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-datetime-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-debug-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-errorhandling-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-fibers-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-file-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-handle-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-heap-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-localization-l1-2-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-memory-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-namedpipe-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-processenvironment-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-processthreads-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-profile-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-string-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-synch-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-synch-l1-2-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-sysinfo-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-util-l1-1-0.dll",
"./" + DISTRO_DIR + "/libgcc_s_seh-1.dll",
"./" + DISTRO_DIR + "/libstdc++-6.dll",
"./" + DISTRO_DIR + "/libwinpthread-1.dll",
"./" + DISTRO_DIR + "/msvcrt.dll",
"./" + DISTRO_DIR + "/qt.conf",
"./" + DISTRO_DIR + "/API-MS-Win-Core-Heap-Obsolete-L1-1-0.dll",
"./" + DISTRO_DIR + "/API-MS-Win-Core-Kernel32-Private-L1-1-0.dll",
"./" + DISTRO_DIR + "/API-MS-Win-Core-Kernel32-Private-L1-1-1.dll",
"./" + DISTRO_DIR + "/API-MS-Win-Eventing-ClassicProvider-L1-1-0.dll",
"./" + DISTRO_DIR + "/API-MS-Win-Eventing-Provider-L1-1-0.dll",
"./" + DISTRO_DIR + "/API-MS-Win-core-file-l2-1-0.dll",
"./" + DISTRO_DIR + "/API-MS-Win-core-localization-obsolete-l1-2-0.dll",
"./" + DISTRO_DIR + "/API-MS-Win-core-string-l2-1-0.dll",
"./" + DISTRO_DIR + "/API-MS-Win-core-string-obsolete-l1-1-0.dll",
"./" + DISTRO_DIR + "/API-MS-Win-devices-config-L1-1-1.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-delayload-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-file-l1-2-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-file-l1-2-1.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-interlocked-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-io-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-io-l1-1-1.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-kernel32-legacy-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-kernel32-legacy-l1-1-1.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-memory-l1-1-1.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-privateprofile-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-processthreads-l1-1-1.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-realtime-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-registry-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-rtlsupport-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-shlwapi-legacy-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-shlwapi-obsolete-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-stringansi-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-sysinfo-l1-2-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-threadpool-l1-2-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-threadpool-legacy-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-timezone-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-url-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-version-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-wow64-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-crt-math-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-crt-private-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-crt-runtime-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-crt-string-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-crt-time-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-security-base-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-security-cryptoapi-l1-1-0.dll",
"./" + DISTRO_DIR + "/API-MS-Win-Eventing-Controller-L1-1-0.dll",
"./" + DISTRO_DIR + "/API-MS-Win-Eventing-Legacy-L1-1-0.dll",
"./" + DISTRO_DIR + "/API-MS-Win-Security-Lsalookup-L2-1-0.dll",
"./" + DISTRO_DIR + "/API-MS-Win-Security-Lsalookup-L2-1-1.dll",
"./" + DISTRO_DIR + "/API-MS-Win-devices-config-L1-1-0.dll",
"./" + DISTRO_DIR + "/API-MS-Win-security-lsapolicy-l1-1-0.dll",
"./" + DISTRO_DIR + "/API-MS-Win-security-provider-L1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-crt-conio-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-crt-convert-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-crt-environment-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-crt-filesystem-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-crt-heap-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-crt-locale-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-crt-multibyte-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-crt-process-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-crt-stdio-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-crt-utility-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-eventing-consumer-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-security-sddl-l1-1-0.dll",
"./" + DISTRO_DIR + "/mpr.dll",
"./" + DISTRO_DIR + "/profapi.dll",
"./" + DISTRO_DIR + "/rpcrt4.dll",
"./" + DISTRO_DIR + "/shell32.dll",
"./" + DISTRO_DIR + "/userenv.dll",
"./" + DISTRO_DIR + "/uxtheme.dll",
"./" + DISTRO_DIR + "/version.dll",
"./" + DISTRO_DIR + "/ucrtbase.dll",
2020-10-17 11:00:12 +03:00
"./" + DISTRO_DIR + "/oleaut32.dll",
"./" + DISTRO_DIR + "/bcryptprimitives.dll",
"./" + DISTRO_DIR + "/msvcp_win.dll",
"./" + DISTRO_DIR + "/wtsapi32.dll",
"./" + DISTRO_DIR + "/combase.dll",
2020-07-05 13:53:15 +03:00
});
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
comapareTree += utils.createTree(
{
2020-07-05 13:53:15 +03:00
"./" + DISTRO_DIR + "/d3d11.dll",
"./" + DISTRO_DIR + "/dxgi.dll",
"./" + DISTRO_DIR + "/win32u.dll",
});
#endif
runTestParams({"-bin", bin, "clear" ,
"-qmake", qmake,
"deploySystem"
2020-02-29 12:29:02 +03:00
}, &comapareTree, {}, true);
2019-09-24 16:30:52 +03:00
2019-12-24 11:46:11 +03:00
2019-09-24 15:11:30 +03:00
#endif
2019-09-24 16:30:52 +03:00
}
2019-09-24 15:11:30 +03:00
2019-09-24 16:30:52 +03:00
void deploytest::testOutDirs() {
TestUtils utils;
2019-01-27 15:37:19 +03:00
2019-09-24 16:30:52 +03:00
#ifdef Q_OS_UNIX
2019-09-24 18:21:12 +03:00
QString bin = TestBinDir + "TestQMLWidgets";
QString qmake = TestQtDir + "bin/qmake";
2019-09-24 15:11:30 +03:00
#else
2019-09-24 18:21:12 +03:00
QString bin = TestBinDir + "TestQMLWidgets.exe";
QString qmake = TestQtDir + "bin/qmake.exe";
2019-09-24 16:30:52 +03:00
#endif
2020-07-07 11:05:27 +03:00
auto comapareTree = TestModule.testOutLibs();
2019-01-27 15:37:19 +03:00
2019-09-24 16:30:52 +03:00
runTestParams({"-bin", bin, "clear" ,
2019-09-24 18:21:12 +03:00
"-binOut", "/lol",
"-libOut", "/lolLib",
"-trOut", "/lolTr",
"-pluginOut", "/p",
"-qmlOut", "/q",
"-qmake", qmake,
"-qmlDir", TestBinDir + "/../TestQMLWidgets"
2019-09-25 13:23:07 +03:00
}, &comapareTree);
2019-09-24 16:30:52 +03:00
2019-09-25 12:32:05 +03:00
QFile file;
file.setFileName("./" + DISTRO_DIR + "/lol/qt.conf");
QVERIFY(file.open(QIODevice::ReadOnly));
auto runScript = file.readAll();
file.close();
2020-03-19 16:59:16 +03:00
QVERIFY(runScript.contains("Prefix= ./../"));
2019-09-25 12:32:05 +03:00
QVERIFY(runScript.contains("Libraries= ./lolLib/"));
QVERIFY(runScript.contains("Plugins= ./p/"));
QVERIFY(runScript.contains("Imports= ./q/"));
QVERIFY(runScript.contains("Translations= ./lolTr/"));
QVERIFY(runScript.contains("Qml2Imports= ./q/"));
2019-09-25 18:13:04 +03:00
#ifdef Q_OS_WIN
runTestParams({"-bin", bin, "clear" ,
2019-09-26 13:18:10 +03:00
"-binOut", "/lol",
2019-09-25 18:13:04 +03:00
"-libOut", "/lolLib",
"-trOut", "/lolTr",
"-pluginOut", "/p",
"-qmlOut", "/q",
"-qmake", qmake,
"-qmlDir", TestBinDir + "/../TestQMLWidgets"
}, &comapareTree);
file.setFileName( "./" + DISTRO_DIR + "/TestQMLWidgets.bat");
QVERIFY(file.open(QIODevice::ReadOnly));
runScript = file.readAll();
file.close();
2019-09-26 13:18:10 +03:00
QVERIFY(runScript.contains("SET BASE_DIR=%~dp0"));
2020-02-29 13:04:38 +03:00
QVERIFY(runScript.contains("SET PATH=%BASE_DIR%\\lolLib\\;%PATH%"));
2020-03-19 18:00:16 +03:00
QVERIFY(runScript.contains("call \"%BASE_DIR%\\lol\\TestQMLWidgets.exe\" %*"));
2019-09-25 18:13:04 +03:00
#endif
2019-01-27 15:37:19 +03:00
}
2019-01-26 15:34:39 +03:00
QTEST_APPLESS_MAIN(deploytest)
#include "tst_deploytest.moc"