mirror of
https://github.com/QuasarApp/CQtDeployer.git
synced 2025-05-07 15:09:35 +00:00
fix tests
This commit is contained in:
parent
102bbd6909
commit
ebafb0cdca
@ -27,7 +27,6 @@ class DEPLOYSHARED_EXPORT DependenciesScanner {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
QStringList _env;
|
|
||||||
QMultiHash<QString, QString> _EnvLibs;
|
QMultiHash<QString, QString> _EnvLibs;
|
||||||
QHash<QString, LibInfo> _scanedLibs;
|
QHash<QString, LibInfo> _scanedLibs;
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ class deploytest : public QObject
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QSet<QString> qtFilesTree;
|
QHash<QString, QSet<QString>> filesTree;
|
||||||
|
|
||||||
|
|
||||||
bool runProcess(const QString& DistroPath,
|
bool runProcess(const QString& DistroPath,
|
||||||
@ -45,12 +45,18 @@ private:
|
|||||||
const QString &qt = "");
|
const QString &qt = "");
|
||||||
QStringList getFilesFromDir(const QString& dir);
|
QStringList getFilesFromDir(const QString& dir);
|
||||||
|
|
||||||
|
QSet<QString> getFilesTree(const QStringList& keys = {});
|
||||||
|
|
||||||
void runTestParams(const QStringList &list, QSet<QString> *tree = nullptr,
|
void runTestParams(const QStringList &list,
|
||||||
|
QSet<QString> *tree = nullptr,
|
||||||
|
const QStringList &checkableKeys = {},
|
||||||
bool noWarnings = false,
|
bool noWarnings = false,
|
||||||
bool onlySize = false);
|
bool onlySize = false);
|
||||||
|
|
||||||
void checkResults(const QSet<QString> &tree, bool noWarnings, bool onlySize = false);
|
void checkResults(const QSet<QString> &tree,
|
||||||
|
const QStringList &checkagbleKeys,
|
||||||
|
bool noWarnings,
|
||||||
|
bool onlySize = false);
|
||||||
public:
|
public:
|
||||||
deploytest();
|
deploytest();
|
||||||
/**
|
/**
|
||||||
@ -211,16 +217,39 @@ QStringList deploytest::getFilesFromDir(const QString &path) {
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QSet<QString> deploytest::getFilesTree(const QStringList &keys) {
|
||||||
|
QSet<QString> result;
|
||||||
|
|
||||||
|
if (keys.isEmpty()) {
|
||||||
|
for (auto it = filesTree.begin(); it != filesTree.end(); ++it) {
|
||||||
|
result += filesTree[it.key()];
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const auto& i: keys) {
|
||||||
|
result += filesTree[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
deploytest::deploytest() {
|
deploytest::deploytest() {
|
||||||
TestUtils utils;
|
TestUtils utils;
|
||||||
|
|
||||||
auto tempTree = utils.getTree(TestQtDir);
|
auto tempTree = utils.getTree(TestQtDir);
|
||||||
|
|
||||||
tempTree += utils.getTree("/lib", 5);
|
|
||||||
tempTree += utils.getTree("/usr/lib", 5);
|
|
||||||
|
|
||||||
for (const QString &i: tempTree) {
|
for (const QString &i: tempTree) {
|
||||||
qtFilesTree.insert(QFileInfo(i).fileName());
|
filesTree["Qt"].insert(QFileInfo(i).fileName());
|
||||||
|
}
|
||||||
|
|
||||||
|
tempTree = utils.getTree("/lib", 5);
|
||||||
|
for (const QString &i: tempTree) {
|
||||||
|
filesTree["/lib"].insert(QFileInfo(i).fileName());
|
||||||
|
}
|
||||||
|
|
||||||
|
tempTree = utils.getTree("/usr/lib", 5);
|
||||||
|
for (const QString &i: tempTree) {
|
||||||
|
filesTree["/usr/lib"].insert(QFileInfo(i).fileName());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -550,7 +579,7 @@ void deploytest::testExtractPlugins() {
|
|||||||
QVERIFY(comapre.size());
|
QVERIFY(comapre.size());
|
||||||
#endif
|
#endif
|
||||||
for (auto i = comapre.begin(); i != comapre.end(); ++i) {
|
for (auto i = comapre.begin(); i != comapre.end(); ++i) {
|
||||||
if (i.value() != 1 && qtFilesTree.contains(QFileInfo(i.key()).fileName())) {
|
if (i.value() != 1 && getFilesTree().contains(QFileInfo(i.key()).fileName())) {
|
||||||
qCritical() << "missing library found " << i.key();
|
qCritical() << "missing library found " << i.key();
|
||||||
QVERIFY(false);
|
QVERIFY(false);
|
||||||
}
|
}
|
||||||
@ -880,7 +909,9 @@ void deploytest::testSetTargetDir() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void deploytest::runTestParams(const QStringList &list, QSet<QString>* tree,
|
void deploytest::runTestParams(const QStringList &list,
|
||||||
|
QSet<QString>* tree,
|
||||||
|
const QStringList &checkableKeys,
|
||||||
bool noWarnings, bool onlySize) {
|
bool noWarnings, bool onlySize) {
|
||||||
|
|
||||||
QuasarAppUtils::Params::parseParams(list);
|
QuasarAppUtils::Params::parseParams(list);
|
||||||
@ -890,7 +921,7 @@ void deploytest::runTestParams(const QStringList &list, QSet<QString>* tree,
|
|||||||
QVERIFY(false);
|
QVERIFY(false);
|
||||||
|
|
||||||
if (tree) {
|
if (tree) {
|
||||||
checkResults(*tree, noWarnings, onlySize);
|
checkResults(*tree, checkableKeys, noWarnings, onlySize);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WITH_SNAP
|
#ifdef WITH_SNAP
|
||||||
@ -928,7 +959,10 @@ void deploytest::runTestParams(const QStringList &list, QSet<QString>* tree,
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void deploytest::checkResults(const QSet<QString> &tree, bool noWarnings , bool onlySize) {
|
void deploytest::checkResults(const QSet<QString> &tree,
|
||||||
|
const QStringList& checkagbleKeys,
|
||||||
|
bool noWarnings,
|
||||||
|
bool onlySize) {
|
||||||
TestUtils utils;
|
TestUtils utils;
|
||||||
|
|
||||||
QVERIFY(DeployCore::_config);
|
QVERIFY(DeployCore::_config);
|
||||||
@ -954,7 +988,7 @@ void deploytest::checkResults(const QSet<QString> &tree, bool noWarnings , bool
|
|||||||
comapreResult[ i.key()] = "Added unnecessary file";
|
comapreResult[ i.key()] = "Added unnecessary file";
|
||||||
qCritical() << "added unnecessary file : " + i.key();
|
qCritical() << "added unnecessary file : " + i.key();
|
||||||
bug = true;
|
bug = true;
|
||||||
} else if (qtFilesTree.contains(QFileInfo(i.key()).fileName())) {
|
} else if (getFilesTree(checkagbleKeys).contains(QFileInfo(i.key()).fileName())) {
|
||||||
comapreResult[ i.key()] = "Missing";
|
comapreResult[ i.key()] = "Missing";
|
||||||
qCritical() << "Missing file : " + i.key();
|
qCritical() << "Missing file : " + i.key();
|
||||||
bug = true;
|
bug = true;
|
||||||
@ -1685,29 +1719,32 @@ void deploytest::testLibDir() {
|
|||||||
runTestParams({"-bin", bin, "clear" ,
|
runTestParams({"-bin", bin, "clear" ,
|
||||||
"-libDir", extraPath,
|
"-libDir", extraPath,
|
||||||
"-recursiveDepth", "5",
|
"-recursiveDepth", "5",
|
||||||
"noCheckRPATH, noCheckPATH"}, &comapareTree, true);
|
"noCheckRPATH, noCheckPATH"}, &comapareTree, {}, true);
|
||||||
|
|
||||||
runTestParams({"-bin", bin, "clear" ,
|
runTestParams({"-bin", bin, "clear" ,
|
||||||
"-extraLibs", "stdc,gcc",
|
"-extraLibs", "stdc,gcc",
|
||||||
"noCheckRPATH, noCheckPATH"}, &comapareTreeExtraLib, true);
|
"noCheckRPATH, noCheckPATH"}, &comapareTreeExtraLib, {}, true);
|
||||||
|
|
||||||
//task #258
|
//task #258
|
||||||
//https://github.com/QuasarApp/CQtDeployer/issues/258
|
//https://github.com/QuasarApp/CQtDeployer/issues/258
|
||||||
|
|
||||||
#ifdef Q_OS_UNIX
|
#ifdef Q_OS_UNIX
|
||||||
extraPath = "/lib/";
|
auto checkKeys = "/usr/lib";
|
||||||
|
extraPath = "/usr/lib/";
|
||||||
|
comapareTree = comapareTreeExtraLib;
|
||||||
#else
|
#else
|
||||||
|
auto checkKeys = "Qt";
|
||||||
extraPath = TestQtDir + "/";
|
extraPath = TestQtDir + "/";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
runTestParams({"-bin", bin, "clear" ,
|
runTestParams({"-bin", bin, "clear" ,
|
||||||
"-libDir", extraPath,
|
"-libDir", extraPath,
|
||||||
"-recursiveDepth", "5",
|
"-recursiveDepth", "5",
|
||||||
"noCheckRPATH, noCheckPATH"}, &comapareTree, true);
|
"noCheckRPATH, noCheckPATH"}, &comapareTree, {checkKeys});
|
||||||
|
|
||||||
runTestParams({"-bin", bin, "clear" ,
|
runTestParams({"-bin", bin, "clear" ,
|
||||||
"-extraLibs", "stdc,gcc",
|
"-extraLibs", "stdc,gcc",
|
||||||
"noCheckRPATH, noCheckPATH"}, &comapareTreeExtraLib, true);
|
"noCheckRPATH, noCheckPATH"}, &comapareTreeExtraLib, {checkKeys});
|
||||||
}
|
}
|
||||||
|
|
||||||
void deploytest::testExtraPlugins() {
|
void deploytest::testExtraPlugins() {
|
||||||
@ -1885,7 +1922,7 @@ void deploytest::testSystemLib() {
|
|||||||
|
|
||||||
runTestParams({"-bin", bin, "clear" ,
|
runTestParams({"-bin", bin, "clear" ,
|
||||||
"deploySystem"
|
"deploySystem"
|
||||||
}, &comapareTree, true);
|
}, &comapareTree);
|
||||||
|
|
||||||
#ifdef Q_OS_UNIX
|
#ifdef Q_OS_UNIX
|
||||||
|
|
||||||
@ -1913,7 +1950,7 @@ void deploytest::testSystemLib() {
|
|||||||
|
|
||||||
runTestParams({"-bin", bin, "clear" ,
|
runTestParams({"-bin", bin, "clear" ,
|
||||||
"deploySystem-with-libc"
|
"deploySystem-with-libc"
|
||||||
}, &comapareTree, true);
|
}, &comapareTree);
|
||||||
|
|
||||||
file.setFileName("./" + DISTRO_DIR + "/TestOnlyC.sh");
|
file.setFileName("./" + DISTRO_DIR + "/TestOnlyC.sh");
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user