Update lancelot tests to use non-system-specific host info collection
Change the lancelot baseline test runner to use generic text files for host info data collection. This also avoids relying on QProcess and scraping the bash scripts output from stdout. Fixes: QTBUG-71836 Change-Id: I88a46c99dbb11f71afc18cae5a6d2fbebcbe76c5 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
This commit is contained in:
parent
db57af5a0d
commit
651dd26403
@ -28,10 +28,8 @@
|
||||
|
||||
#include "qbaselinetest.h"
|
||||
#include "baselineprotocol.h"
|
||||
#if QT_CONFIG(process)
|
||||
# include <QtCore/QProcess>
|
||||
#endif
|
||||
#include <QtCore/QDir>
|
||||
#include <QFile>
|
||||
|
||||
#define MAXCMDLINEARGS 128
|
||||
|
||||
@ -146,20 +144,15 @@ void addClientProperty(const QString& key, const QString& value)
|
||||
*/
|
||||
void fetchCustomClientProperties()
|
||||
{
|
||||
#if !QT_CONFIG(process)
|
||||
QSKIP("This test requires QProcess support");
|
||||
#else
|
||||
QString script = "hostinfo.sh"; //### TBD: Windows implementation (hostinfo.bat)
|
||||
QFile file("hostinfo.txt");
|
||||
if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
|
||||
return;
|
||||
QTextStream in(&file);
|
||||
|
||||
QProcess runScript;
|
||||
runScript.setWorkingDirectory(QCoreApplication::applicationDirPath());
|
||||
runScript.start("sh", QStringList() << script, QIODevice::ReadOnly);
|
||||
if (!runScript.waitForFinished(5000) || runScript.error() != QProcess::UnknownError) {
|
||||
qWarning() << "QBaselineTest: Error running script" << runScript.workingDirectory() + QDir::separator() + script << ":" << runScript.errorString();
|
||||
qDebug() << " stderr:" << runScript.readAllStandardError().trimmed();
|
||||
}
|
||||
while (!runScript.atEnd()) {
|
||||
QByteArray line = runScript.readLine().trimmed(); // ###local8bit? utf8?
|
||||
while (!in.atEnd()) {
|
||||
QString line = in.readLine().trimmed(); // ###local8bit? utf8?
|
||||
if (line.startsWith(QLatin1Char('#'))) // Ignore comments in file
|
||||
continue;
|
||||
QString key, val;
|
||||
int colonPos = line.indexOf(':');
|
||||
if (colonPos > 0) {
|
||||
@ -171,7 +164,6 @@ void fetchCustomClientProperties()
|
||||
else
|
||||
qDebug() << "Unparseable script output ignored:" << line;
|
||||
}
|
||||
#endif // QT_CONFIG(process)
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user