summaryrefslogtreecommitdiffstats
path: root/tests/arthur/common
diff options
context:
space:
mode:
authoraavit <qt-info@nokia.com>2010-10-18 13:37:59 (GMT)
committeraavit <qt-info@nokia.com>2010-10-18 13:37:59 (GMT)
commite7f0288bd9a57c25a7e482f4b058769d7147270a (patch)
treee47e93fce72f7a303732ff2a5b8e4bb060edb080 /tests/arthur/common
parent5c92ff774eadca40e6f33b5e096df01ecc5da717 (diff)
downloadQt-e7f0288bd9a57c25a7e482f4b058769d7147270a.zip
Qt-e7f0288bd9a57c25a7e482f4b058769d7147270a.tar.gz
Qt-e7f0288bd9a57c25a7e482f4b058769d7147270a.tar.bz2
Add OS and git data to PlatformInfo
Diffstat (limited to 'tests/arthur/common')
-rw-r--r--tests/arthur/common/baselineprotocol.cpp38
-rw-r--r--tests/arthur/common/baselineprotocol.h11
2 files changed, 40 insertions, 9 deletions
diff --git a/tests/arthur/common/baselineprotocol.cpp b/tests/arthur/common/baselineprotocol.cpp
index 697ce58..78c80f1 100644
--- a/tests/arthur/common/baselineprotocol.cpp
+++ b/tests/arthur/common/baselineprotocol.cpp
@@ -3,25 +3,53 @@
#include <QImage>
#include <QBuffer>
#include <QHostInfo>
+#include <QSysInfo>
+#include <QProcess>
PlatformInfo::PlatformInfo(bool useLocal)
{
if (useLocal) {
buildKey = QLibraryInfo::buildKey();
qtVersion = QLatin1String(qVersion());
- hostname = QHostInfo::localHostName();
+ hostName = QHostInfo::localHostName();
+ osVersion = -1;
+#if defined(Q_OS_LINUX)
+ osName = QLatin1String("Linux");
+#elif defined(Q_OS_WINCE)
+ osName = QLatin1String("WinCE");
+ osVersion = QSysInfo::windowsVersion();
+#elif defined(Q_OS_WIN)
+ osName = QLatin1String("Windows");
+ osVersion = QSysInfo::windowsVersion();
+#elif defined(Q_OS_MAC)
+ osName = QLatin1String("MacOS");
+ osVersion = qMacVersion();
+#elif defined(Q_OS_SYMBIAN)
+ osName = QLatin1String("Symbian");
+ osVersion = QSysInfo::symbianVersion();
+#else
+ osName = QLatin1String("Other");
+#endif
+
+ QProcess git;
+ git.start(QLS("git"), QStringList() << QLS("log") << QLS("--max-count=1") << QLS("--pretty=%H"));
+ git.waitForFinished(3000);
+ if (!git.exitCode())
+ gitCommit = QString::fromLocal8Bit(git.readAllStandardOutput().constData()).trimmed();
+ else
+ gitCommit = QLS("Unknown");
}
}
-QDataStream & operator<< (QDataStream &stream, const PlatformInfo &pinfo)
+QDataStream & operator<< (QDataStream &stream, const PlatformInfo &p)
{
- stream << pinfo.buildKey << pinfo.qtVersion << pinfo.hostname;
+ stream << p.hostName << p.osName << p.osVersion << p.qtVersion << p.buildKey << p.gitCommit;
return stream;
}
-QDataStream & operator>> (QDataStream& stream, PlatformInfo& pinfo)
+QDataStream & operator>> (QDataStream& stream, PlatformInfo& p)
{
- stream >> pinfo.buildKey >> pinfo.qtVersion >> pinfo.hostname;
+ stream >> p.hostName >> p.osName >> p.osVersion >> p.qtVersion >> p.buildKey >> p.gitCommit;
return stream;
}
diff --git a/tests/arthur/common/baselineprotocol.h b/tests/arthur/common/baselineprotocol.h
index 6af4f22..42f9729 100644
--- a/tests/arthur/common/baselineprotocol.h
+++ b/tests/arthur/common/baselineprotocol.h
@@ -15,12 +15,15 @@ struct PlatformInfo
{
PlatformInfo(bool useLocal = false);
- QString buildKey;
+ QString hostName;
+ QString osName;
+ int osVersion;
QString qtVersion;
- QString hostname;
+ QString buildKey;
+ QString gitCommit;
};
-QDataStream & operator<< (QDataStream &stream, const PlatformInfo &pinfo);
-QDataStream & operator>> (QDataStream& stream, PlatformInfo& pinfo);
+QDataStream & operator<< (QDataStream &stream, const PlatformInfo &p);
+QDataStream & operator>> (QDataStream& stream, PlatformInfo& p);
struct ImageItem
{