diff options
author | Daniel Smith <daniel.smith@qt.io> | 2018-11-16 13:42:16 +0100 |
---|---|---|
committer | Daniel Smith <Daniel.Smith@qt.io> | 2019-09-04 13:09:39 +0000 |
commit | 651dd26403052f98397783927ad02e008acf0552 (patch) | |
tree | c50176e1f6165bf5b0e6da44b0f224c96aea78db | |
parent | db57af5a0d7aa0687a19fef1cd385bee0f26f7b6 (diff) |
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>
-rw-r--r-- | tests/baselineserver/shared/qbaselinetest.cpp | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/tests/baselineserver/shared/qbaselinetest.cpp b/tests/baselineserver/shared/qbaselinetest.cpp index 11fb208f20..3587cd01ea 100644 --- a/tests/baselineserver/shared/qbaselinetest.cpp +++ b/tests/baselineserver/shared/qbaselinetest.cpp @@ -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) - - 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? + QFile file("hostinfo.txt"); + if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) + return; + QTextStream in(&file); + + 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) } |