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>
2019-09-11 13:09:09 +03:00
# include <QCryptographicHash>
2019-09-15 11:47:51 +03:00
# include <distrostruct.h>
2019-09-29 18:14:41 +03:00
# 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>
2020-07-04 18:13:32 +03:00
# include <pluginsparser.h>
2020-08-14 15:22:48 +03:00
# include <zipcompresser.h>
2021-01-06 19:44:44 +03:00
# include <QStorageInfo>
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
2021-01-06 17:23:28 +03:00
static const QString TestBinDir = TEST_BIN_DIR ;
static 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
2019-03-29 22:12:08 +03:00
private :
2021-01-06 17:23:28 +03:00
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-04-04 15:43:46 +03:00
void runTestParams ( QStringList list ,
2020-02-28 15:12:44 +03:00
QSet < QString > * tree = nullptr ,
2020-01-20 15:43:00 +03:00
bool noWarnings = false ,
2020-12-07 18:30:02 +03:00
bool onlySize = false ,
exitCodes exitCode = exitCodes : : Good ) ;
2019-09-10 18:22:49 +03:00
2020-02-28 15:12:44 +03:00
void checkResults ( const QSet < QString > & tree ,
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 ( ) ;
2019-09-29 18:14:41 +03:00
void testRelativeLink ( ) ;
2019-11-01 19:43:54 +03:00
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
2020-08-14 15:22:48 +03:00
void testZip ( ) ;
2019-12-27 12:51:03 +03:00
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
2019-09-11 13:09:09 +03:00
void testOverwrite ( ) ;
2019-09-12 17:00:50 +03:00
// tested flags binDir
2020-12-04 17:13:12 +03:00
void testextraData ( ) ;
2019-09-11 13:09:09 +03:00
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 ( ) ;
2020-11-12 16:28:08 +03:00
void testQIFMulti ( ) ;
2020-11-11 11:09:10 +03:00
void testQIFCustom ( ) ;
2020-01-14 15:48:35 +03:00
2020-08-16 11:07:38 +03:00
// zip flags
void testZIP ( ) ;
2020-11-12 16:28:08 +03:00
void testZIPMulti ( ) ;
2020-08-16 11:07:38 +03:00
2020-11-09 16:33:50 +03:00
// deb flags
void testDEB ( ) ;
2020-11-12 16:28:08 +03:00
void testDEBMulti ( ) ;
2020-11-11 11:09:10 +03:00
void testDEBCustom ( ) ;
2020-11-09 16:33:50 +03:00
2020-08-16 11:07:38 +03:00
// qif and zip flags
void testMultiPacking ( ) ;
2020-01-24 18:43:59 +03:00
// init flags
void testInit ( ) ;
2019-12-08 13:57:20 +03:00
void testDependencyMap ( ) ;
2020-11-17 16:27:21 +03:00
void testQmlScaner ( ) ;
2020-12-02 13:50:33 +03:00
2020-12-03 20:00:14 +03:00
void testPrefix ( ) ;
2020-12-10 12:36:34 +03:00
// test configure empty packages
2020-12-07 18:30:02 +03:00
void testallowEmptyPackages ( ) ;
2020-12-10 12:36:34 +03:00
// test skip empty packages
void testEmptyPackages ( ) ;
2020-12-03 20:00:14 +03:00
2020-12-02 13:50:33 +03:00
void customTest ( ) ;
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 ) {
2019-03-29 22:12:08 +03:00
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 ) ;
2019-03-29 22:12:08 +03:00
# 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 ) ) {
2019-03-29 22:12:08 +03:00
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 ( ) ;
}
2019-03-29 22:12:08 +03:00
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
2021-01-06 19:44:44 +03:00
for ( const auto & subDir : qAsConst ( 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
2019-09-13 17:44:20 +03:00
deploytest : : deploytest ( ) {
2020-09-09 13:01:06 +03:00
2020-11-13 16:11:36 +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
2021-01-06 17:23:28 +03:00
const QStringList pathList = QProcessEnvironment : : systemEnvironment ( ) .
value ( " PATH " ) . split ( DeployCore : : getEnvSeparator ( ) ) ;
2019-05-14 11:31:13 +03:00
2020-11-13 15:43:05 +03:00
2021-01-06 17:23:28 +03:00
for ( const auto & path : pathList ) {
filesTree + = utils . getTree ( path , 1 ) ;
2020-11-13 15:43:05 +03:00
}
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-08-15 14:38:03 +03:00
Packing pac ( & file ) ;
2020-07-04 18:13:32 +03:00
PluginsParser _pluginParser ;
2020-01-04 16:39:25 +03:00
2020-07-04 18:13:32 +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 ( ) ;
2020-07-04 18:13:32 +03:00
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 ( ) ;
2020-07-04 18:13:32 +03:00
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 ( ) ;
2020-07-04 18:13:32 +03:00
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 ( ) ;
2020-07-04 18:13:32 +03:00
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 ( ) ;
2020-07-04 18:13:32 +03:00
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 = { } ;
2021-01-06 19:44:44 +03:00
for ( const auto & i : libList ) {
2019-01-27 12:30:45 +03:00
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 " ) ) ;
2021-01-06 19:44:44 +03:00
for ( const auto & i : libList ) {
2019-01-27 12:30:45 +03:00
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 " ;
2020-07-08 18:29:31 +03:00
auto comapareTree = TestModule . qtWebEngine ( ) ;
2019-09-15 20:31:31 +03:00
runTestParams ( { " -bin " , bin , " clear " ,
" -qmake " , qmake ,
" -qmlDir " , TestBinDir + " /../quicknanobrowser " } , & comapareTree ) ;
2020-11-27 22:58:51 +03:00
bin = TestBinDir + " webui " ;
qmake = TestQtDir + " bin/qmake " ;
comapareTree = TestModule . qtWebEngineWidgets ( ) ;
runTestParams ( { " -bin " , bin , " clear " ,
" -qmake " , qmake } , & comapareTree ) ;
2019-09-19 09:53:29 +03:00
# 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
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
# else
QString bin = TestBinDir + " TestQMLWidgets.exe " ;
2020-01-16 18:14:48 +03:00
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 " ,
} ) ;
2020-01-14 15:48:35 +03:00
# endif
2020-01-16 18:14:48 +03:00
2020-03-04 17:35:12 +03:00
runTestParams ( { " -bin " , bin , " clear " ,
" -qmake " , qmake ,
" -qmlDir " , TestBinDir + " /../TestQMLWidgets " ,
2020-07-07 11:05:27 +03:00
" qif " , " qifFromSystem " ,
2020-03-04 17:35:12 +03:00
" -qifStyle " , " quasar " ,
2020-08-15 19:29:17 +03:00
" -qifBanner " , TestBinDir + " /../../res/CQtDeployer_banner_web.png " ,
2021-01-06 17:23:28 +03:00
" -qifLogo " , TestBinDir + " /../../res/CQtDeployer defaultIcon_web.png " } , & comapareTree , true ) ;
2020-03-04 17:35:12 +03:00
2020-11-12 16:28:08 +03:00
}
void deploytest : : testQIFMulti ( ) {
TestUtils utils ;
# ifdef Q_OS_UNIX
QString bin = TestBinDir + " TestQMLWidgets " ;
QString target1 = TestBinDir + " TestOnlyC " ;
auto comapareTreeMulti = utils . createTree ( {
" ./ " + DISTRO_DIR + " /InstallerQtWidgetsProject.run " ,
} ) ;
# else
QString bin = TestBinDir + " TestQMLWidgets.exe " ;
QString target1 = TestBinDir + " TestOnlyC.exe " ;
auto comapareTreeMulti = utils . createTree ( {
" ./ " + DISTRO_DIR + " /InstallerQtWidgetsProject.exe " ,
} ) ;
# endif
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 ,
2021-01-06 17:23:28 +03:00
" qif " , " qifFromSystem " } , & comapareTreeMulti , true ) ;
2020-01-20 16:05:23 +03:00
}
2020-11-11 11:09:10 +03:00
void deploytest : : testQIFCustom ( ) {
TestUtils utils ;
# ifdef Q_OS_UNIX
QString bin = TestBinDir + " TestQMLWidgets " ;
QString qmake = TestQtDir + " bin/qmake " ;
auto comapareTreeCustom = utils . createTree ( {
" ./ " + DISTRO_DIR + " /Installerorg.qtproject.ifw.example.stylesheet.run " ,
} ) ;
# else
QString bin = TestBinDir + " TestQMLWidgets.exe " ;
QString qmake = TestQtDir + " bin/qmake.exe " ;
auto comapareTreeCustom = utils . createTree ( {
" ./ " + DISTRO_DIR + " /Installerorg.qtproject.ifw.example.stylesheet.exe " ,
} ) ;
# endif
runTestParams ( { " -bin " , bin , " clear " ,
" -qmake " , qmake ,
" -qmlDir " , TestBinDir + " /../TestQMLWidgets " ,
" -qif " , TestBinDir + " /../../UnitTests/testRes/QIFCustomTemplate " ,
" -name " , " org.qtproject.ifw.example.stylesheet " ,
2021-01-06 17:23:28 +03:00
" qifFromSystem " } , & comapareTreeCustom , true ) ;
2020-11-11 11:09:10 +03:00
}
2020-08-16 11:07:38 +03:00
void deploytest : : testZIP ( ) {
TestUtils utils ;
auto comapareTree = utils . createTree ( {
" ./ " + DISTRO_DIR + " /TestQMLWidgets.zip " ,
} ) ;
# 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
runTestParams ( { " -bin " , bin , " clear " ,
" -qmake " , qmake ,
" -qmlDir " , TestBinDir + " /../TestQMLWidgets " ,
2021-01-06 17:23:28 +03:00
" zip " , " verbose " } , & comapareTree , true ) ;
2020-08-16 11:07:38 +03:00
2020-11-11 11:09:10 +03:00
// test clear for zip
2021-01-06 17:23:28 +03:00
runTestParams ( { " clear " , " verbose " } , nullptr , true ) ;
2020-08-16 11:07:38 +03:00
2020-11-12 16:28:08 +03:00
}
void deploytest : : testZIPMulti ( ) {
TestUtils utils ;
auto comapareTreeMulti = utils . createTree ( {
" ./ " + DISTRO_DIR + " /QtWidgetsProject.zip " ,
" ./ " + DISTRO_DIR + " /package1.zip " ,
" ./ " + DISTRO_DIR + " /package2.zip " ,
} ) ;
2020-08-16 11:07:38 +03:00
# ifdef Q_OS_UNIX
2020-11-12 16:28:08 +03:00
QString bin = TestBinDir + " TestQMLWidgets " ;
QString target1 = TestBinDir + " TestOnlyC " ;
2020-08-16 11:07:38 +03:00
QString target2 = TestBinDir + " TestQMLWidgets " ;
QString target3 = TestBinDir + " QtWidgetsProject " ;
# else
QString target2 = TestBinDir + " TestQMLWidgets.exe " ;
QString target3 = TestBinDir + " QtWidgetsProject.exe " ;
2020-11-12 16:28:08 +03:00
QString bin = TestBinDir + " TestQMLWidgets.exe " ;
QString target1 = TestBinDir + " TestOnlyC.exe " ;
2020-08-16 11:07:38 +03:00
# endif
bin = target1 ;
bin + = " , " + target2 ;
bin + = " , " + target3 ;
auto packageString = " /package1/; " + QFileInfo ( target1 ) . absoluteFilePath ( ) + " ,/package2/; " + QFileInfo ( target2 ) . absoluteFilePath ( ) ;
runTestParams ( { " -bin " , bin , " force-clear " ,
" -binOut " , " /lol " ,
" -libOut " , " /lolLib " ,
" -trOut " , " /lolTr " ,
" -pluginOut " , " /p " ,
" -qmlOut " , " /q " ,
" -qmlDir " , " package2; " + TestBinDir + " /../TestQMLWidgets " ,
" -targetPackage " , packageString ,
2021-01-06 17:23:28 +03:00
" zip " } , & comapareTreeMulti , true ) ;
2020-08-16 11:07:38 +03:00
}
2020-11-09 16:33:50 +03:00
void deploytest : : testDEB ( ) {
# ifdef Q_OS_UNIX
TestUtils utils ;
auto comapareTree = utils . createTree ( {
" ./ " + DISTRO_DIR + " /TestQMLWidgets.deb " ,
} ) ;
QString bin = TestBinDir + " TestQMLWidgets " ;
QString qmake = TestQtDir + " bin/qmake " ;
runTestParams ( { " -bin " , bin , " clear " ,
" -qmake " , qmake ,
" -qmlDir " , TestBinDir + " /../TestQMLWidgets " ,
2021-01-06 17:23:28 +03:00
" deb " , " verbose " } , & comapareTree , true ) ;
2020-11-09 16:33:50 +03:00
2020-11-11 11:09:10 +03:00
// test clear for deb
2021-01-06 17:23:28 +03:00
runTestParams ( { " clear " , " verbose " } , nullptr , true ) ;
2020-11-09 16:33:50 +03:00
2020-11-12 16:28:08 +03:00
# endif
}
void deploytest : : testDEBMulti ( ) {
# ifdef Q_OS_UNIX
TestUtils utils ;
auto comapareTreeMulti = utils . createTree ( {
" ./ " + DISTRO_DIR + " /QtWidgetsProject.deb " ,
" ./ " + DISTRO_DIR + " /package1.deb " ,
" ./ " + DISTRO_DIR + " /package2.deb " ,
} ) ;
QString bin = TestBinDir + " TestQMLWidgets " ;
QString target1 = TestBinDir + " TestOnlyC " ;
2020-11-09 16:33:50 +03:00
QString target2 = TestBinDir + " TestQMLWidgets " ;
QString target3 = TestBinDir + " QtWidgetsProject " ;
bin = target1 ;
bin + = " , " + target2 ;
bin + = " , " + target3 ;
auto packageString = " /package1/; " + QFileInfo ( target1 ) . absoluteFilePath ( ) + " ,/package2/; " + QFileInfo ( target2 ) . absoluteFilePath ( ) ;
runTestParams ( { " -bin " , bin , " force-clear " ,
" -binOut " , " /lol " ,
" -libOut " , " /lolLib " ,
" -trOut " , " /lolTr " ,
" -pluginOut " , " /p " ,
" -qmlOut " , " /q " ,
" -qmlDir " , " package2; " + TestBinDir + " /../TestQMLWidgets " ,
" -targetPackage " , packageString ,
2021-01-06 17:23:28 +03:00
" deb " } , & comapareTreeMulti , true ) ;
2020-11-09 16:33:50 +03:00
# endif
}
2020-11-11 11:09:10 +03:00
void deploytest : : testDEBCustom ( ) {
2020-11-12 15:32:51 +03:00
# ifdef Q_OS_UNIX
2020-11-11 11:09:10 +03:00
TestUtils utils ;
QString bin = TestBinDir + " TestQMLWidgets " ;
QString qmake = TestQtDir + " bin/qmake " ;
auto comapareTreeCustom = utils . createTree ( {
" ./ " + DISTRO_DIR + " /chrome.deb " ,
} ) ;
runTestParams ( { " -bin " , bin , " clear " ,
" -qmake " , qmake ,
" -qmlDir " , TestBinDir + " /../TestQMLWidgets " ,
" -deb " , TestBinDir + " /../../UnitTests/testRes/DEBCustomTemplate " ,
" -name " , " chrome " } ,
2021-01-06 17:23:28 +03:00
& comapareTreeCustom , true ) ;
2020-11-12 15:32:51 +03:00
# endif
2020-11-11 11:09:10 +03:00
}
2020-08-16 11:07:38 +03:00
void deploytest : : testMultiPacking ( ) {
TestUtils utils ;
# ifdef Q_OS_UNIX
auto comapareTree = utils . createTree ( {
" ./ " + DISTRO_DIR + " /TestQMLWidgets.zip " ,
2020-11-10 11:50:54 +03:00
" ./ " + DISTRO_DIR + " /TestQMLWidgets.deb " ,
2020-08-16 11:07:38 +03:00
" ./ " + DISTRO_DIR + " /InstallerTestQMLWidgets.run " ,
} ) ;
QString bin = TestBinDir + " TestQMLWidgets " ;
QString qmake = TestQtDir + " bin/qmake " ;
2020-11-10 11:50:54 +03:00
runTestParams ( { " -bin " , bin , " clear " ,
" -qmake " , qmake ,
" -qmlDir " , TestBinDir + " /../TestQMLWidgets " ,
" zip " ,
" qif " , " qifFromSystem " ,
" deb " ,
2021-01-06 17:23:28 +03:00
" verbose " } , & comapareTree , true ) ;
2020-11-10 11:50:54 +03:00
2020-08-16 11:07:38 +03:00
# else
auto comapareTree = utils . createTree ( {
" ./ " + DISTRO_DIR + " /TestQMLWidgets.zip " ,
" ./ " + DISTRO_DIR + " /InstallerTestQMLWidgets.exe " ,
} ) ;
QString bin = TestBinDir + " TestQMLWidgets.exe " ;
QString qmake = TestQtDir + " bin/qmake.exe " ;
runTestParams ( { " -bin " , bin , " clear " ,
" -qmake " , qmake ,
" -qmlDir " , TestBinDir + " /../TestQMLWidgets " ,
" zip " ,
" qif " , " qifFromSystem " ,
2021-01-06 17:23:28 +03:00
" verbose " } , & comapareTree , true ) ;
2020-11-10 11:50:54 +03:00
# endif
2020-08-16 11:07:38 +03:00
}
2020-01-24 18:43:59 +03:00
void deploytest : : testInit ( )
{
TestUtils utils ;
runTestParams ( { " init " } ) ;
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 " } ) ;
2020-11-12 14:42:51 +03:00
2020-03-08 14:46:17 +03:00
QVERIFY ( QFile ( DEFAULT_COFIGURATION_FILE ) . remove ( ) ) ;
runTestParams ( { " -init " , " single " } ) ;
2020-01-27 19:35:02 +03:00
2020-01-27 20:02:25 +03:00
QVERIFY ( QFile ( DEFAULT_COFIGURATION_FILE ) . remove ( ) ) ;
2020-01-24 18:43:59 +03:00
}
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
2020-11-17 16:27:21 +03:00
}
void deploytest : : testQmlScaner ( ) {
// qt5
auto qmlRoot = QFileInfo ( TestQtDir + " /qml " ) . absoluteFilePath ( ) ;
QML * scaner = new QML ( qmlRoot ) ;
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 ( ) ) ;
2021-01-06 19:44:44 +03:00
for ( const auto & import : qAsConst ( imports ) ) {
2020-11-17 16:27:21 +03:00
auto path = scaner - > getPathFromImport ( import ) ;
QVERIFY ( results . contains ( path ) ) ;
}
// qt6
results = {
{ qmlRoot + " /QtQuick " } ,
{ qmlRoot + " /QtQuick/Controls " } ,
{ qmlRoot + " /QtQuick/Controls/Material " } ,
{ qmlRoot + " /QtQuick/Layouts " } ,
} ;
imports = scaner - > extractImportsFromFile ( " :/qmlFileQt6.qml " ) ;
QVERIFY ( results . size ( ) = = imports . size ( ) ) ;
2021-01-06 19:44:44 +03:00
for ( const auto & import : qAsConst ( imports ) ) {
2020-11-17 16:27:21 +03:00
auto path = scaner - > getPathFromImport ( import ) ;
QVERIFY ( results . contains ( path ) ) ;
}
2019-12-08 13:57:20 +03:00
}
2020-12-03 20:00:14 +03:00
void deploytest : : testPrefix ( ) {
TestUtils utils ;
# ifdef Q_OS_UNIX
QFile f ( " ./ " + DISTRO_DIR + " /bin/TestOnlyC " ) ;
auto comapareTree = utils . createTree (
{
" ./ " + DISTRO_DIR + " /package/TestOnlyC.sh " ,
" ./ " + DISTRO_DIR + " /package/bin/TestOnlyC " ,
" ./ " + DISTRO_DIR + " /package/bin/qt.conf "
} ) ;
QString target1 = TestBinDir + " TestOnlyC " ;
# else
QFile f ( " ./ " + DISTRO_DIR + " /TestOnlyC.exe " ) ;
auto comapareTree = utils . createTree (
{ " ./ " + DISTRO_DIR + " /package/TestOnlyC.exe " ,
" ./ " + DISTRO_DIR + " /package/qt.conf " } ) ;
QString target1 = TestBinDir + " TestOnlyC.exe " ;
# endif
QString bin = target1 ;
comapareTree = TestModule . replace ( comapareTree , { { " package " , " prefix " } } ) ;
runTestParams ( { " -bin " , bin , " force-clear " ,
" -targetPackage " , " /package/;TestOn " ,
" -prefix " , " package;prefix " } , & comapareTree ) ;
}
2020-12-07 18:30:02 +03:00
void deploytest : : testallowEmptyPackages ( ) {
TestUtils utils ;
# ifdef Q_OS_UNIX
QString bin = TestBinDir + " TestOnlyC " ;
# else
QString bin = TestBinDir + " TestOnlyC.exe " ;
# endif
runTestParams ( { " -bin " , bin , " force-clear " ,
2021-01-06 17:23:28 +03:00
" -prefix " , " package;prefix " } , nullptr , false , false ,
2020-12-07 18:30:02 +03:00
exitCodes : : PrepareError ) ;
runTestParams ( { " -bin " , bin , " force-clear " ,
" -prefix " , " package;prefix " ,
2020-12-10 12:36:34 +03:00
" allowEmptyPackages " } ) ;
}
void deploytest : : testEmptyPackages ( ) {
TestUtils utils ;
auto comapareTree = TestModule . onlyC ( ) ;
# ifdef Q_OS_UNIX
QString bin = TestBinDir + " TestOnlyC " ;
# else
QString bin = TestBinDir + " TestOnlyC.exe " ;
# endif
runTestParams ( { " -bin " , bin , " force-clear " ,
2021-01-06 17:23:28 +03:00
" -prefix " , " package;prefix " } , nullptr , false , false ,
2020-12-10 12:36:34 +03:00
exitCodes : : PrepareError ) ;
runTestParams ( { " -bin " , bin , " force-clear " ,
" -targetPackage " , " /package/;NONE " ,
2020-12-10 16:04:37 +03:00
" -libDir " , TestQtDir + " bin " ,
2020-12-10 12:36:34 +03:00
" -prefix " , " package;prefix " ,
" allowEmptyPackages " } , & comapareTree ) ;
# ifdef Q_OS_UNIX
bin = TestBinDir + " QtWidgetsProject " ;
comapareTree = utils . createTree (
{
" ./ " + DISTRO_DIR + " /QtWidgetsProject.zip " ,
" ./ " + DISTRO_DIR + " /QtWidgetsProject.deb " ,
" ./ " + DISTRO_DIR + " /InstallerQtWidgetsProject.run " ,
} ) ;
runTestParams ( { " -bin " , bin , " force-clear " ,
" -targetPackage " , " /package/;NONE " ,
" -prefix " , " package;prefix " ,
" allowEmptyPackages " ,
" qif " , " qifFromSystem " ,
" zip " ,
" deb " } , & comapareTree ) ;
# else
bin = TestBinDir + " QtWidgetsProject.exe " ;
comapareTree = utils . createTree (
{
" ./ " + DISTRO_DIR + " /QtWidgetsProject.zip " ,
" ./ " + DISTRO_DIR + " /InstallerQtWidgetsProject.exe " ,
} ) ;
runTestParams ( { " -bin " , bin , " force-clear " ,
" -targetPackage " , " /package/;NONE " ,
" -prefix " , " package;prefix " ,
" allowEmptyPackages " ,
" qif " , " qifFromSystem " ,
" zip "
} , & comapareTree ) ;
# endif
2020-12-07 18:30:02 +03:00
}
2020-12-02 13:50:33 +03:00
void deploytest : : customTest ( ) {
2021-01-07 13:31:11 +03:00
// runTestParams({"-confFile", "path",
// "qifFromSystem"});
2020-12-02 13:50:33 +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 ( " ./ " ) ;
2021-01-06 19:44:44 +03:00
for ( const auto & file : qAsConst ( 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
2021-01-06 19:44:44 +03:00
for ( const auto & i : qAsConst ( 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
}
2019-09-29 18:14:41 +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
} ;
2019-09-29 18:14:41 +03:00
2021-01-06 19:44:44 +03:00
for ( const auto & i : qAsConst ( cases ) ) {
2020-02-26 14:29:04 +03:00
if ( PathUtils : : getRelativeLink ( i [ 0 ] , i [ 1 ] ) ! = i [ 2 ] )
QVERIFY ( false ) ;
2019-09-29 18:14:41 +03:00
}
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
}
2019-09-29 18:14:41 +03:00
}
2019-11-01 19:43:54 +03:00
void deploytest : : testCheckQt ( ) {
Deploy * deployer = new Deploy ( ) ;
2020-12-04 17:13:12 +03:00
QuasarAppUtils : : Params : : parseParams ( { " -bin " , TestBinDir , " clear " ,
2020-10-14 14:54:35 +03:00
" noCheckRPATH " , " noCheckPATH " , " noQt " } ) ;
2019-11-01 19:43:54 +03:00
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 } ,
2019-11-01 19:43:54 +03:00
} ;
2021-01-06 19:44:44 +03:00
for ( const auto & i : qAsConst ( cases ) ) {
2019-11-01 19:43:54 +03:00
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 } ,
2019-11-01 19:43:54 +03:00
} ;
2021-01-06 19:44:44 +03:00
for ( const auto & i : qAsConst ( 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 ( ) ) ;
2019-11-01 19:43:54 +03:00
}
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-08-15 14:38:03 +03:00
Packing pac ( & file ) ;
2020-07-04 18:13:32 +03:00
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-08-14 15:22:48 +03:00
void deploytest : : testZip ( ) {
TestUtils utils ;
ZipCompresser zip ;
auto befor = utils . getTree ( " ./test " ) ;
QVERIFY ( zip . compress ( " ./test " , " ./arr.zip " ) ) ;
QVERIFY ( QDir ( " ./test " ) . removeRecursively ( ) ) ;
QVERIFY ( zip . extract ( " ./arr.zip " , " ./test " ) ) ;
auto after = utils . getTree ( " ./test " ) ;
QVERIFY ( utils . compareTree ( befor , after ) . size ( ) = = 0 ) ;
}
2020-04-04 15:43:46 +03:00
void deploytest : : runTestParams ( QStringList list ,
2020-02-28 15:12:44 +03:00
QSet < QString > * tree ,
2020-12-07 18:30:02 +03:00
bool noWarnings , bool onlySize ,
exitCodes exitCode ) {
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 ;
2020-12-07 18:30:02 +03:00
if ( deploy . run ( ) ! = exitCode )
2020-02-07 17:33:36 +03:00
QVERIFY ( false ) ;
2019-09-10 18:22:49 +03:00
if ( tree ) {
2021-01-06 17:23:28 +03:00
checkResults ( * tree , 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 ,
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-13 14:43:32 +03:00
2021-01-06 19:44:44 +03:00
# ifdef Q_OS_WIN
2021-01-06 21:27:43 +03:00
// Remove all API-MS-Win libs, because each OS Windows have a own bundle of this api libs.
2021-01-06 19:44:44 +03:00
// See the https://github.com/QuasarApp/CQtDeployer/issues/481#issuecomment-755156875 post for more information.
resultTree = TestModule . ignoreFilter ( resultTree , " API-MS-Win " ) ;
# endif
2019-09-27 20:18:45 +03:00
auto comapre = utils . compareTree ( resultTree , tree ) ;
2019-09-13 14:43:32 +03:00
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-13 14:43:32 +03:00
2019-09-27 20:18:45 +03:00
bool bug = false ;
2019-11-02 01:00:05 +03:00
QJsonObject comapreResult ;
2019-09-13 14:43:32 +03:00
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 ;
2021-01-06 17:23:28 +03:00
} else if ( filesTree . 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-13 14:43:32 +03:00
2019-09-27 20:18:45 +03:00
QJsonObject obj ;
2021-01-06 17:23:28 +03:00
for ( const auto & i : qAsConst ( resultTree ) ) {
2019-09-27 20:18:45 +03:00
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
}
2019-09-11 13:09:09 +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 " ) ;
2019-09-11 13:09:09 +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 + " /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-11 13:09:09 +03:00
2019-09-14 13:59:11 +03:00
runTestParams ( { " -bin " , bin , " force-clear " , " noOverwrite " } , & comapareTree ) ;
2019-09-11 13:09:09 +03:00
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 ) ;
2019-09-11 13:09:09 +03:00
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 ) ;
2019-09-11 13:09:09 +03:00
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
}
2020-12-04 17:13:12 +03:00
void deploytest : : testextraData ( ) {
2019-09-12 10:23:49 +03:00
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 (
2020-12-04 17:13:12 +03:00
{ " ./ " + DISTRO_DIR + " /build/TestOnlyC " ,
" ./ " + DISTRO_DIR + " /build/QtWidgetsProject " ,
" ./ " + DISTRO_DIR + " /build/TestQMLWidgets " } ) ;
2019-09-12 17:00:50 +03:00
# else
auto comapareTree = utils . createTree (
2020-12-04 17:13:12 +03:00
{ " ./ " + DISTRO_DIR + " /build/TestOnlyC.exe " ,
" ./ " + DISTRO_DIR + " /build/QtWidgetsProject.exe " ,
" ./ " + DISTRO_DIR + " /build/TestQMLWidgets.exe " } ) ;
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-12-04 17:13:12 +03:00
{ " ./ " + DISTRO_DIR + " /build/quicknanobrowser " ,
" ./ " + DISTRO_DIR + " /build/webui " } ) ;
2019-09-19 11:13:28 +03:00
# endif
2019-04-04 18:11:38 +03:00
2020-12-04 17:13:12 +03:00
runTestParams ( { " -extraData " , TestBinDir , " clear " ,
2020-10-13 22:38:16 +03:00
" noCheckRPATH " , " noCheckPATH " , " noQt " } , & comapareTree ) ;
2020-12-04 17:13:12 +03:00
comapareTree = TestModule . replace ( comapareTree , {
{ " DistributionKit/build " ,
" DistributionKit/myExtraData/build " } } ) ;
runTestParams ( { " -extraData " , TestBinDir , " clear " ,
" noCheckRPATH " , " noCheckPATH " , " noQt " ,
" -extraDataOut " , " myExtraData " } , & 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 + " /TestOnlyC.sh " ,
" ./ " + DISTRO_DIR + " /QtWidgetsProject.sh " ,
" ./ " + DISTRO_DIR + " /TestQMLWidgets.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 " ,
2019-09-23 17:59:36 +03:00
" ./ " + DISTRO_DIR + " /qt.conf " ,
2019-09-16 09:44:19 +03:00
" ./ " + DISTRO_DIR + " /QtWidgetsProject.exe " ,
2019-09-23 17:59:36 +03:00
" ./ " + DISTRO_DIR + " /TestQMLWidgets.exe " } ) ;
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-03-29 22:12:08 +03:00
2019-09-12 17:00:50 +03:00
QFile confFile ( TestBinDir + " /TestConf.json " ) ;
QVERIFY ( confFile . open ( QIODevice : : ReadOnly ) ) ;
2019-03-29 22:12:08 +03:00
2019-09-12 17:00:50 +03:00
auto data = confFile . readAll ( ) ;
2019-09-12 21:42:10 +03:00
confFile . close ( ) ;
2019-03-29 22:12:08 +03:00
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 ( ) ) ;
2019-09-29 18:14:41 +03:00
# ifdef Q_OS_UNIX
2019-09-12 21:42:10 +03:00
QVERIFY ( data . contains ( " \" bin \" : [ " ) ) ;
2019-09-29 18:14:41 +03:00
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
2019-09-29 18:14:41 +03:00
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 \" " ) ) ;
2019-09-29 18:14:41 +03:00
QVERIFY ( data . contains ( " \" clear \" : true " ) ) ;
2019-09-12 21:42:10 +03:00
runTestParams ( { " -confFile " , TestBinDir + " /TestConf.json " } , & comapareTree ) ;
2019-03-29 22:12:08 +03:00
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
2019-09-13 14:43:32 +03:00
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
2020-07-08 18:29:31 +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
2020-07-08 18:29:31 +03:00
comapareTree = TestModule . qtLibs ( ) ;
2020-01-09 23:47:57 +03:00
2020-07-08 18:29:31 +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 " ;
QVERIFY ( utils . deployFile ( " :/testResurces/testRes/testMultiPackageConfig.json " , file ,
2020-07-05 13:53:15 +03:00
{ { " $BIN_DIR " , TestBinDir . toLatin1 ( ) } } ) ) ;
2020-03-13 21:49:13 +03:00
2020-07-08 18:29:31 +03:00
comapareTree = TestModule . onlyC ( DISTRO_DIR + " /Dstro1 " ) +
TestModule . qtLibs ( DISTRO_DIR + " /Dstro2 " ) +
TestModule . qmlLibs ( DISTRO_DIR + " /Dstro2 " ) +
2020-11-28 23:19:21 +03:00
TestModule . qtWebEngine ( DISTRO_DIR + " /Dstro2 " ) +
TestModule . qtWebEngineWidgets ( 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-07-05 13:53:15 +03:00
" -qmlDir " , " Dstro2; " + qmlDir } ,
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 ( ) {
2019-12-29 02:52:43 +03:00
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 " ;
2019-12-29 02:52:43 +03:00
# 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 " ;
2019-12-29 02:52:43 +03:00
# endif
2019-12-29 14:19:07 +03:00
QString bin = target1 ;
2019-12-29 02:52:43 +03:00
runTestParams ( { " -bin " , bin , " force-clear " ,
2020-07-05 13:53:15 +03:00
" -targetPackage " , " /package/;TestOn " } , & comapareTree ) ;
2019-12-29 02:52:43 +03:00
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 ;
2019-12-29 02:52:43 +03:00
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
2020-07-08 18:29:31 +03:00
comapareTree = TestModule . testDistroLibs ( DISTRO_DIR ) ;
2020-01-02 19:27:40 +03:00
2019-12-29 02:52:43 +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-07 17:33:36 +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
}
2019-09-13 14:43:32 +03:00
void deploytest : : testQt ( ) {
TestUtils utils ;
2019-03-29 18:05:55 +03:00
2019-09-13 14:43:32 +03:00
# ifdef Q_OS_UNIX
2020-07-05 13:53:15 +03:00
QString bin = TestBinDir + " QtWidgetsProject " ;
2019-09-13 14:43:32 +03:00
QString qmake = TestQtDir + " bin/qmake " ;
# else
2020-07-05 13:53:15 +03:00
QString bin = TestBinDir + " QtWidgetsProject.exe " ;
2019-09-13 14:43:32 +03:00
QString qmake = TestQtDir + " bin/qmake.exe " ;
# endif
2020-07-08 18:29:31 +03:00
auto comapareTree = TestModule . qtLibs ( ) ;
2019-09-13 14:43:32 +03:00
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
2020-07-08 18:29:31 +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
2020-07-08 18:29:31 +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
2019-03-29 22:12:08 +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-03-29 22:12:08 +03:00
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 " ,
2020-10-14 17:22:41 +03:00
" ./ " + 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
2021-01-06 17:23:28 +03:00
bin = TestBinDir + " QtWidgetsProject " ;
qmake = TestQtDir + " bin/qmake " ;
2019-09-26 13:18:10 +03:00
# else
2021-01-06 17:23:28 +03:00
bin = TestBinDir + " QtWidgetsProject.exe " ;
qmake = TestQtDir + " bin/qmake.exe " ;
2019-09-26 13:18:10 +03:00
# 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
2021-01-07 13:31:11 +03:00
runTestParams ( { " -bin " , bin , " clear " ,
" -qmake " , qmake ,
" -recursiveDepth " , " 3 " ,
" -ignoreEnv " , TestQtDir + " /lib, " + TestQtDir + " /bin, " + TestQtDir + " /../../Tools " } ,
& comapareTree ) ;
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
2021-01-06 21:27:43 +03:00
// Ignore all posoble locations with libstdc++-6. See tests log https://github.com/QuasarApp/CQtDeployer/issues/481#issuecomment-755156875 for more information.
2021-01-06 19:44:44 +03:00
// On github actions all gcc libs locate in the program files. So we need to add this path to ignore for testing ignore option.
2021-01-07 13:31:11 +03:00
QString winRoot = QStorageInfo : : root ( ) . rootPath ( ) ;
2021-01-06 19:44:44 +03:00
QString programmFiles = winRoot + " /Program Files " ;
QString programmFiles86 = winRoot + " /Program Files (x86) " ;
2019-09-26 13:18:10 +03:00
2019-09-14 15:51:23 +03:00
runTestParams ( { " -bin " , bin , " clear " ,
" -qmake " , qmake ,
2020-10-14 21:47:37 +03:00
" -recursiveDepth " , " 3 " ,
2021-01-07 13:31:11 +03:00
" -ignoreEnv " , TestQtDir + " /lib, " + TestQtDir + " /bin, " + TestQtDir + " /../../Tools " ,
" -ignore " , programmFiles + " , " + programmFiles86 } ,
2020-10-14 13:17:26 +03:00
& comapareTree ) ;
2019-03-29 22:12:08 +03:00
2021-01-07 13:31:11 +03:00
# endif
2019-09-26 13:18:10 +03:00
2020-07-08 18:29:31 +03:00
comapareTree = TestModule . qtLibs ( ) - removeTree ;
2019-03-29 22:12:08 +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 " , " 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-03-29 22:12:08 +03:00
2019-09-14 15:51:23 +03:00
runTestParams ( { " -bin " , bin , " clear " ,
" -libDir " , extraPath ,
} , & comapareTree ) ;
2019-03-29 22:12:08 +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 (
{
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-03-29 22:12:08 +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/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-03-29 22:12:08 +03:00
2019-09-14 15:51:23 +03:00
runTestParams ( { " -bin " , bin , " clear " ,
" -libDir " , extraPath ,
2020-02-26 14:29:04 +03:00
" -recursiveDepth " , " 5 " ,
2021-01-06 17:23:28 +03:00
" noCheckRPATH, noCheckPATH " , " noQt " } , & comapareTree , true ) ;
2019-03-29 22:12:08 +03:00
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 " ,
2021-01-06 17:23:28 +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
2019-03-29 22:12:08 +03:00
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 ,
2021-01-06 17:23:28 +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-03-29 22:12:08 +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 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 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 " ,
2021-01-06 19:44:44 +03:00
" ./ " + DISTRO_DIR + " /libpq.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
2020-07-08 18:29:31 +03:00
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 " ,
2020-11-05 14:51:37 +03:00
" ./ " + 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-03-29 22:12:08 +03:00
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 + " /libgcc_s_seh-1.dll " ,
" ./ " + DISTRO_DIR + " /libstdc++-6.dll " ,
" ./ " + DISTRO_DIR + " /libwinpthread-1.dll " ,
" ./ " + DISTRO_DIR + " /msvcrt.dll " ,
" ./ " + DISTRO_DIR + " /qt.conf "
} ) ;
2019-03-29 22:12:08 +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
2019-12-18 17:59:38 +03:00
# else
QString qmake = TestQtDir + " bin/qmake.exe " ;
bin = TestBinDir + " QtWidgetsProject.exe " ;
2020-07-08 18:29:31 +03:00
comapareTree + = TestModule . qtLibs ( ) ;
2019-12-18 17:59:38 +03:00
comapareTree - = utils . createTree (
{
2020-07-05 13:53:15 +03:00
" ./ " + DISTRO_DIR + " /TestOnlyC.exe " ,
} ) ;
2019-12-18 17:59:38 +03:00
comapareTree + = utils . createTree (
{
2020-07-05 13:53:15 +03:00
" ./ " + 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 + " /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
} ) ;
2019-12-18 17:59:38 +03:00
2020-02-07 18:09:53 +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 " ,
} ) ;
2020-02-07 18:09:53 +03:00
# endif
2019-12-18 17:59:38 +03:00
runTestParams ( { " -bin " , bin , " clear " ,
" -qmake " , qmake ,
" deploySystem "
2020-11-30 14:43:39 +03:00
} , & comapareTree ) ;
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
2020-07-08 18:29:31 +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"