CQtDeployer/UnitTests/tst_deploytest.cpp

765 lines
18 KiB
C++
Raw Normal View History

2019-01-26 15:34:39 +03:00
/*
* Copyright (C) 2018-2019 QuasarApp.
* 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>
#include <cqt.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-03-26 22:12:20 +03:00
#include "qmlcreator.h"
2019-09-10 18:22:49 +03:00
#include "testutils.h"
2019-01-26 15:34:39 +03:00
// add necessary includes here
class deploytest : public QObject
{
Q_OBJECT
private:
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
2019-09-10 18:22:49 +03:00
void runTestParams(const QStringList &list, QSet<QString> *tree = nullptr);
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-04-01 12:45:12 +03:00
bool mainTestOnlyC();
bool mainTestQMake();
bool mainTestQML();
2019-05-14 11:31:13 +03:00
bool testEnvIgnore();
2019-04-01 12:45:12 +03:00
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();
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-04-01 12:45:12 +03:00
void mainTests();
2019-09-10 18:22:49 +03:00
// end old tests
void testHelp();
2019-03-28 10:32:46 +03:00
void testMSVC();
2019-09-10 18:22:49 +03:00
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) {
QDir dir(path);
QStringList res;
auto list = dir.entryInfoList(QDir::Dirs| QDir::Files| QDir::NoDotAndDotDot);
for (auto &&subDir: list) {
if (subDir.isFile()) {
res.push_back(subDir.fileName());
} else {
res.append(getFilesFromDir(subDir.absoluteFilePath()));
}
}
return res;
}
2019-05-14 11:31:13 +03:00
bool deploytest::testEnvIgnore()
{
#ifdef WITH_ALL_TESTS
QFileInfo QtDir = QFileInfo(QT_BASE_DIR);
if (!QtDir.isDir()) {
return false;
}
int argc = 9;
std::string qmakePath = (QtDir.absoluteFilePath() + "bin/qmake.exe").toStdString();
2019-05-25 17:41:37 +03:00
#ifdef Q_OS_WIN
std::string qtPath = (QtDir.absoluteFilePath() + "bin/").toStdString();
#else
std::string qtPath = (QtDir.absoluteFilePath() + "lib/").toStdString();
#endif
2019-05-14 11:31:13 +03:00
const char *qmake = qmakePath.c_str();
const char *qt = qtPath.c_str();
#ifdef Q_OS_WIN
const char * argv[] = {"./",
"-bin", "./../../../tests/build/QtWidgetsProject.exe",
"-qmake", qmake,
"-ignoreEnv", qt,
"-targetDir", "./Distro"};
#else
const char * argv[] = {"./",
"-bin", "./../../../tests/build/QtWidgetsProject",
"-qmake", qmake,
"-ignoreEnv", qt,
"-targetDir", "./Distro"};
#endif
if (!QuasarAppUtils::Params::parseParams(argc, argv)) {
return false;
}
Deploy deploy;
2019-09-09 18:12:39 +03:00
if (deploy.run()) {
2019-05-14 11:31:13 +03:00
return false;
}
if (!QFileInfo("./Distro").isDir()) {
return false;
}
#ifdef Q_OS_WIN
QDir info("./Distro");
#else
QDir info("./Distro/lib");
#endif
for (auto &i :info.entryInfoList()) {
if (i.fileName().contains("Qt")) {
return false;
}
}
if (!info.removeRecursively()) {
return false;
}
return true;
#else
return false;
#endif
}
2019-01-26 15:34:39 +03:00
deploytest::deploytest(){}
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;
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;
CQT *deploy = new CQT(&file);
2019-01-26 17:39:19 +03:00
QStringList targets;
targets << "./test/bins/execTarget.exe";
QVERIFY(deploy->setTargets(targets));
delete deploy;
targets.clear();
2019-09-08 19:30:01 +03:00
deploy = new CQT(&file);
2019-01-26 17:39:19 +03:00
targets << "./test/bins/execTarget";
QVERIFY(deploy->setTargets(targets));
delete deploy;
targets.clear();
2019-09-08 19:30:01 +03:00
deploy = new CQT(&file);
2019-01-26 17:39:19 +03:00
targets << "./test/bins/execTarget.exe" << "./test/bins/execTarget";
QVERIFY(deploy->setTargets(targets));
delete deploy;
targets.clear();
2019-09-08 19:30:01 +03:00
deploy = new CQT(&file);
2019-01-26 17:39:19 +03:00
targets << "./test/bns/execTarget.exe";
QVERIFY(!deploy->setTargets(targets));
delete deploy;
targets.clear();
2019-09-08 19:30:01 +03:00
deploy = new CQT(&file);
2019-01-26 17:39:19 +03:00
targets << "./test/bins/";
QVERIFY(deploy->setTargets(targets));
delete deploy;
targets.clear();
2019-09-08 19:30:01 +03:00
deploy = new CQT(&file);
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;
for (auto &&lib : libs) {
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
for (auto &dep : deb.value(lib)) {
2019-04-05 16:52:53 +03:00
bool test = info.getDependncies().contains(dep.toUpper());
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/";
QString testqmakepath = testPath +"qmake";
QDir d;
QDir oldDir("./Qt");
oldDir.removeRecursively();
QVERIFY(d.mkpath(testPath));
QFile file(testqmakepath);
QVERIFY(file.open(QIODevice::ReadWrite | QIODevice::Truncate));
QVERIFY(file.write("test"));
file.close();
2019-09-03 18:15:05 +03:00
auto msvc = DeployCore::getMSVC(testqmakepath);
2019-03-28 10:32:46 +03:00
QVERIFY(msvc & MSVCVersion::MSVC_17);
QVERIFY(msvc & MSVCVersion::MSVC_x64);
QVERIFY(file.remove());
2019-04-01 12:54:07 +03:00
QDir dir("./Qt");
dir.removeRecursively();
2019-03-28 10:32:46 +03:00
}
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("./");
for (auto &&file : qmlFiles) {
auto fileImports = scaner.extractImportsFromFile(file);
2019-04-02 12:46:14 +03:00
for (auto &fil : imports.value(file)) {
QVERIFY(fileImports.contains(fil, Qt::CaseInsensitive));
2019-03-26 22:12:20 +03:00
}
}
}
2019-08-27 11:07:12 +03:00
void deploytest::testSetTargetDir() {
2019-09-09 09:56:57 +03:00
FileManager file;
CQT dep(&file);
2019-08-27 11:07:12 +03:00
dep.setTargetDir();
2019-09-09 09:56:57 +03:00
QVERIFY(dep.config()->targetDir == QFileInfo("./Distro").absoluteFilePath());
2019-08-27 11:07:12 +03:00
dep.setTargetDir("./ff");
2019-09-09 09:56:57 +03:00
QVERIFY(dep.config()->targetDir == QFileInfo("./ff").absoluteFilePath());
2019-08-27 11:07:12 +03:00
int argc = 3;
const char * argv[] = {"", "-targetDir", "./Distro2"};
QuasarAppUtils::Params::parseParams(argc, argv);
dep.setTargetDir();
2019-09-09 09:56:57 +03:00
QVERIFY(dep.config()->targetDir == QFileInfo("./Distro2").absoluteFilePath());
2019-08-27 11:07:12 +03:00
dep.setTargetDir("./ff");
2019-09-09 09:56:57 +03:00
QVERIFY(dep.config()->targetDir == QFileInfo("./Distro2").absoluteFilePath());
2019-08-27 11:07:12 +03:00
}
2019-04-01 12:45:12 +03:00
void deploytest::mainTests() {
#ifdef WITH_ALL_TESTS
QVERIFY(mainTestOnlyC());
QVERIFY(mainTestQMake());
QVERIFY(mainTestQML());
2019-05-14 11:31:13 +03:00
QVERIFY(testEnvIgnore());
2019-04-06 14:42:22 +03:00
2019-04-01 12:45:12 +03:00
#endif
}
2019-09-10 18:22:49 +03:00
void deploytest::runTestParams(const QStringList &list, QSet<QString>* tree) {
QuasarAppUtils::Params::parseParams(list);
Deploy deploy;
QVERIFY(deploy.run() == 0);
if (tree) {
TestUtils utils;
QVERIFY(DeployCore::_config);
QVERIFY(!DeployCore::_config->targetDir.isEmpty());
auto resultTree = utils.getTree(DeployCore::_config->targetDir);
auto comapre = utils.compareTree(resultTree, *tree);
QVERIFY(comapre.size() == 0);
}
}
void deploytest::testHelp() {
runTestParams({"h"});
runTestParams({"v"});
for (auto &key: DeployCore::helpKeys()) {
QVERIFY(DeployCore::help().contains(key));
}
}
2019-04-01 12:45:12 +03:00
bool deploytest::mainTestOnlyC() {
2019-03-28 19:23:22 +03:00
#ifdef WITH_ALL_TESTS
int argc = 5;
2019-04-04 18:11:38 +03:00
#ifdef Q_OS_WIN
QFileInfo QtDir = QFileInfo(QT_BASE_DIR);
if (!QtDir.isDir()) {
return false;
}
argc += 2;
std::string path = (QtDir.absoluteFilePath() + "bin/").toStdString();
const char *string = path.c_str();
const char * argv[] = {"./",
"-bin", "./../../../tests/build/TestOnlyC.exe",
"-targetDir", "./Distro",
"-libDir", string};
#else
const char * argv[] = {"./",
"-bin", "./../../../tests/build/TestOnlyC",
"-targetDir", "./Distro"};
2019-04-04 18:11:38 +03:00
#endif
2019-03-28 19:23:22 +03:00
2019-04-01 12:45:12 +03:00
if (!QuasarAppUtils::Params::parseParams(argc, argv)) {
return false;
}
2019-03-28 19:23:22 +03:00
Deploy deploy;
2019-09-09 18:12:39 +03:00
if (deploy.run()) {
2019-04-01 12:45:12 +03:00
return false;
}
2019-03-28 19:23:22 +03:00
2019-04-01 12:45:12 +03:00
if (!QFileInfo("./Distro").isDir()) {
return false;
}
2019-03-28 19:23:22 +03:00
QDir info("./Distro");
bool run = runProcess("./Distro", "TestOnlyC");
2019-04-01 12:45:12 +03:00
if (!info.removeRecursively()) {
return false;
}
2019-04-01 12:45:12 +03:00
return run;
2019-04-01 22:03:37 +03:00
#else
return false;
2019-03-28 19:23:22 +03:00
#endif
}
2019-04-01 12:45:12 +03:00
bool deploytest::mainTestQMake() {
2019-03-29 18:05:55 +03:00
#ifdef WITH_ALL_TESTS
2019-04-01 12:45:12 +03:00
QFileInfo QtDir = QFileInfo(QT_BASE_DIR);
2019-03-29 18:05:55 +03:00
2019-04-01 12:45:12 +03:00
if (!QtDir.isDir()) {
return false;
}
2019-03-29 18:05:55 +03:00
int argc = 7;
2019-04-04 18:11:38 +03:00
#ifdef Q_OS_WIN
2019-04-05 14:23:42 +03:00
std::string qmakePath = (QtDir.absoluteFilePath() + "bin/qmake.exe").toStdString();
const char *qmake = qmakePath.c_str();
2019-04-04 18:11:38 +03:00
const char * argv[] = {"./",
"-bin", "./../../../tests/build/QtWidgetsProject.exe",
2019-04-05 14:23:42 +03:00
"-qmake", qmake,
2019-04-04 18:11:38 +03:00
"-targetDir", "./Distro"};
#else
2019-03-29 18:05:55 +03:00
const char * argv[] = {"./",
"-bin", "./../../../tests/build/QtWidgetsProject",
2019-04-01 12:45:12 +03:00
"-qmake", (QtDir.absoluteFilePath() + "/bin/qmake").toLatin1(),
"-targetDir", "./Distro"};
2019-04-04 18:11:38 +03:00
#endif
2019-04-01 12:45:12 +03:00
if (!QuasarAppUtils::Params::parseParams(argc, argv)) {
return false;
}
2019-03-29 18:05:55 +03:00
Deploy deploy;
2019-09-09 18:12:39 +03:00
if (deploy.run()) {
2019-04-01 12:45:12 +03:00
return false;
}
2019-03-29 18:05:55 +03:00
QDir info("./Distro");
2019-04-01 12:45:12 +03:00
if (!QFileInfo("./Distro").isDir()) {
return false;
}
2019-04-01 12:45:12 +03:00
bool run = runProcess("./Distro", "QtWidgetsProject", QtDir.absoluteFilePath());
2019-03-29 18:05:55 +03:00
2019-04-01 12:45:12 +03:00
if (!info.removeRecursively()) {
return false;
}
2019-03-29 23:02:39 +03:00
2019-04-01 12:45:12 +03:00
return run;
2019-04-01 22:03:37 +03:00
#else
return false;
2019-03-29 18:05:55 +03:00
#endif
2019-05-14 11:31:13 +03:00
2019-03-29 18:05:55 +03:00
}
2019-04-01 12:45:12 +03:00
bool deploytest::mainTestQML() {
2019-03-29 18:05:55 +03:00
#ifdef WITH_ALL_TESTS
2019-04-01 12:45:12 +03:00
QFileInfo QtDir = QFileInfo(QT_BASE_DIR);
2019-04-01 12:45:12 +03:00
if (!QtDir.isDir()) {
return false;
}
int argc = 9;
2019-04-04 18:11:38 +03:00
#ifdef Q_OS_WIN
2019-04-05 14:23:42 +03:00
std::string qmakePath = (QtDir.absoluteFilePath() + "bin/qmake.exe").toStdString();
const char *qmake = qmakePath.c_str();
2019-04-04 18:11:38 +03:00
const char * argv[] = {"./",
"-bin", "./../../../tests/build/TestQMLWidgets.exe",
"-qmlDir", "./../../../tests/TestQMLWidgets",
2019-04-05 14:23:42 +03:00
"-qmake", qmake,
2019-04-04 18:11:38 +03:00
"-targetDir", "./Distro"};
#else
const char * argv[] = {"./",
"-bin", "./../../../tests/build/TestQMLWidgets",
"-qmlDir", "./../../../tests/TestQMLWidgets",
2019-04-01 12:45:12 +03:00
"-qmake", (QtDir.absoluteFilePath() + "/bin/qmake").toLatin1(),
"-targetDir", "./Distro"};
2019-04-04 18:11:38 +03:00
#endif
2019-04-01 12:45:12 +03:00
if (!QuasarAppUtils::Params::parseParams(argc, argv)) {
return false;
}
Deploy deploy;
2019-09-09 18:12:39 +03:00
if (deploy.run()) {
2019-04-01 12:45:12 +03:00
return false;
}
QDir info("./Distro");
2019-04-01 12:45:12 +03:00
bool run = runProcess("./Distro", "TestQMLWidgets", QtDir.absoluteFilePath());
2019-04-01 12:45:12 +03:00
if (!info.removeRecursively()) {
return false;
}
2019-04-01 12:45:12 +03:00
if (!run ) {
return false;
}
2019-03-29 23:02:39 +03:00
2019-04-01 12:45:12 +03:00
if (!QFileInfo(QtDir).isDir()) {
return false;
}
2019-03-29 23:02:39 +03:00
argc = 10;
2019-04-04 18:11:38 +03:00
#ifdef Q_OS_WIN
const char * argv2[] = {"./",
"-bin", "./../../../tests/build/TestQMLWidgets.exe",
"-qmlDir", "./../../../tests/TestQMLWidgets",
2019-04-05 14:23:42 +03:00
"-qmake", qmake,
2019-04-04 18:11:38 +03:00
"-targetDir", "./Distro", "qmlExtern"};
#else
2019-03-29 23:02:39 +03:00
const char * argv2[] = {"./",
"-bin", "./../../../tests/build/TestQMLWidgets",
"-qmlDir", "./../../../tests/TestQMLWidgets",
2019-04-01 12:45:12 +03:00
"-qmake", (QtDir.absoluteFilePath() + "/bin/qmake").toLatin1(),
2019-03-29 23:02:39 +03:00
"-targetDir", "./Distro", "qmlExtern"};
2019-04-04 18:11:38 +03:00
#endif
2019-03-29 23:02:39 +03:00
2019-04-01 12:45:12 +03:00
if (!QuasarAppUtils::Params::parseParams(argc, argv2)) {
return false;
}
2019-03-29 23:02:39 +03:00
Deploy deploy2;
2019-09-09 18:12:39 +03:00
if (deploy.run()) {
2019-04-01 12:45:12 +03:00
return false;
}
run = runProcess("./Distro", "TestQMLWidgets", QtDir.absoluteFilePath());
2019-03-29 23:02:39 +03:00
2019-04-01 12:45:12 +03:00
if (!info.removeRecursively()) {
return false;
}
2019-03-29 23:02:39 +03:00
2019-04-01 12:45:12 +03:00
return run;
2019-04-01 22:03:37 +03:00
#else
return false;
2019-03-29 23:02:39 +03:00
#endif
2019-03-29 18:05:55 +03:00
}
2019-01-26 15:34:39 +03:00
QTEST_APPLESS_MAIN(deploytest)
#include "tst_deploytest.moc"