summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMilian Wolff <milian.wolff@kdab.com>2019-08-09 10:49:58 +0200
committerMilian Wolff <milian.wolff@kdab.com>2019-08-13 12:02:52 +0000
commit9fa06beebcd695cfb18bb2a94cf7fa2f0ff33912 (patch)
treef0d226dc3cc847547ec49f54a5b4de7b64ee5a99
parent1555c41b5a5cf154f00c6a581f4a9120e91a54cd (diff)
Fix test failures in tst_perfdata after recent API changes
Change-Id: I99af373bef39584f51746c3a270a5d946518fb18 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
-rw-r--r--tests/auto/perfdata/tst_perfdata.cpp9
-rw-r--r--tests/auto/shared/perfparsertestclient.cpp21
-rw-r--r--tests/auto/shared/perfparsertestclient.h48
3 files changed, 41 insertions, 37 deletions
diff --git a/tests/auto/perfdata/tst_perfdata.cpp b/tests/auto/perfdata/tst_perfdata.cpp
index 41f80d3..9ed3388 100644
--- a/tests/auto/perfdata/tst_perfdata.cpp
+++ b/tests/auto/perfdata/tst_perfdata.cpp
@@ -91,8 +91,8 @@ void TestPerfData::testTracingData_data()
QTest::addColumn<uint>("flushes");
QTest::addColumn<quint64>("maxTime");
QTest::addColumn<bool>("stats");
- QTest::newRow("stream stats") << ":/probe.data.stream" << 1u << 13780586522722ull << true;
- QTest::newRow("file stats") << ":/probe.data.file" << 1u << 13732862219876ull << true;
+ QTest::newRow("stream stats") << ":/probe.data.stream" << 1u << 13780586573357ull << true;
+ QTest::newRow("file stats") << ":/probe.data.file" << 1u << 13732862274100ull << true;
QTest::newRow("stream data") << ":/probe.data.stream" << 2u << 13780586522722ull << false;
QTest::newRow("file data") << ":/probe.data.file" << 3u << 13732862219876ull << false;
}
@@ -148,7 +148,7 @@ void TestPerfData::testTracingData()
QCOMPARE(stats.numBufferFlushes, flushes);
QCOMPARE(stats.numTimeViolatingSamples, 0u);
QCOMPARE(stats.numTimeViolatingMmaps, 0u);
- QCOMPARE(stats.maxBufferSize, 15488u);
+ QCOMPARE(stats.maxBufferSize, 15584u);
QCOMPARE(stats.maxTime, maxTime);
return;
}
@@ -162,8 +162,9 @@ void TestPerfData::testTracingData()
const QVector<PerfParserTestClient::SampleEvent> samples = client.samples();
QVERIFY(samples.length() > 0);
for (const PerfParserTestClient::SampleEvent &sample : samples) {
+ QCOMPARE(sample.values.size(), 1);
const PerfParserTestClient::AttributeEvent attribute
- = client.attribute(sample.attributeId);
+ = client.attribute(sample.values[0].first);
QCOMPARE(attribute.type, 2u);
QVERIFY(attribute.config <= quint64(std::numeric_limits<qint32>::max()));
const PerfParserTestClient::TracePointFormatEvent format
diff --git a/tests/auto/shared/perfparsertestclient.cpp b/tests/auto/shared/perfparsertestclient.cpp
index 9c103d1..55feb2d 100644
--- a/tests/auto/shared/perfparsertestclient.cpp
+++ b/tests/auto/shared/perfparsertestclient.cpp
@@ -74,13 +74,13 @@ void PerfParserTestClient::extractTrace(QIODevice *device)
switch (eventType) {
case ThreadEnd: {
ThreadEndEvent threadEnd;
- stream >> threadEnd.pid >> threadEnd.tid >> threadEnd.time;
+ stream >> threadEnd.pid >> threadEnd.tid >> threadEnd.time >> threadEnd.cpu;
m_threadEnds.append(threadEnd);
break;
}
case Command: {
CommandEvent command;
- stream >> command.pid >> command.tid >> command.time >> command.name;
+ stream >> command.pid >> command.tid >> command.time >> command.cpu >> command.name;
checkString(command.name);
m_commands.append(command);
break;
@@ -101,19 +101,20 @@ void PerfParserTestClient::extractTrace(QIODevice *device)
case SymbolDefinition: {
qint32 id;
SymbolEvent symbol;
- stream >> id >> symbol.name >> symbol.binary >> symbol.isKernel;
+ stream >> id >> symbol.name >> symbol.binary >> symbol.path >> symbol.isKernel;
if (symbol.name != -1)
checkString(symbol.name);
if (symbol.binary != -1)
checkString(symbol.binary);
- QCOMPARE(id, m_symbols.length());
- m_symbols.append(symbol);
+ QVERIFY(id < m_locations.size());
+ m_symbols.insert(id, symbol);
break;
}
case AttributesDefinition: {
qint32 id;
AttributeEvent attribute;
- stream >> id >> attribute.type >> attribute.config >> attribute.name;
+ stream >> id >> attribute.type >> attribute.config >> attribute.name
+ >> attribute.usesFrequency >> attribute.frequencyOrPeriod;
checkString(attribute.name);
QCOMPARE(id, m_attributes.length());
m_attributes.append(attribute);
@@ -137,12 +138,12 @@ void PerfParserTestClient::extractTrace(QIODevice *device)
case Sample:
case TracePointSample: {
SampleEvent sample;
- stream >> sample.pid >> sample.tid >> sample.time >> sample.frames
- >> sample.numGuessedFrames >> sample.attributeId >> sample.period
- >> sample.weight;
+ stream >> sample.pid >> sample.tid >> sample.time >> sample.cpu >> sample.frames
+ >> sample.numGuessedFrames >> sample.values;
for (qint32 locationId : qAsConst(sample.frames))
checkLocation(locationId);
- checkAttribute(sample.attributeId);
+ for (const auto &value : qAsConst(sample.values))
+ checkAttribute(value.first);
if (eventType == TracePointSample) {
stream >> sample.tracePointData;
diff --git a/tests/auto/shared/perfparsertestclient.h b/tests/auto/shared/perfparsertestclient.h
index b9c1dde..821cee8 100644
--- a/tests/auto/shared/perfparsertestclient.h
+++ b/tests/auto/shared/perfparsertestclient.h
@@ -30,15 +30,18 @@ class PerfParserTestClient : public QObject
Q_OBJECT
public:
struct AttributeEvent {
- quint32 type;
- qint32 name;
- quint64 config;
+ quint32 type = 0;
+ qint32 name = -1;
+ quint64 config = 0;
+ bool usesFrequency = false;
+ quint64 frequencyOrPeriod = 0;
};
struct ThreadEvent {
- qint32 pid;
- qint32 tid;
- quint64 time;
+ qint32 pid = -1;
+ qint32 tid = -1;
+ quint64 time = 0;
+ quint32 cpu = 0;
};
struct ThreadEndEvent : public ThreadEvent
@@ -46,37 +49,36 @@ public:
};
struct CommandEvent : public ThreadEvent {
- qint32 name;
+ qint32 name = -1;
};
struct LocationEvent {
- quint64 address;
- qint32 file;
- quint32 pid;
- qint32 line;
- qint32 column;
- qint32 parentLocationId;
+ quint64 address = 0;
+ qint32 file = -1;
+ quint32 pid = 0;
+ qint32 line = -1;
+ qint32 column = -1;
+ qint32 parentLocationId = -1;
};
struct SymbolEvent {
- qint32 name;
- qint32 binary;
- bool isKernel;
+ qint32 name = -1;
+ qint32 binary = -1;
+ qint32 path = -1;
+ bool isKernel = false;
};
struct SampleEvent : public ThreadEvent {
QVector<qint32> frames;
+ QVector<QPair<qint32, quint64>> values;
QHash<qint32, QVariant> tracePointData;
- quint64 period;
- quint64 weight;
- qint32 attributeId;
- quint8 numGuessedFrames;
+ quint8 numGuessedFrames = 0;
};
struct TracePointFormatEvent {
- qint32 system;
- qint32 name;
- quint32 flags;
+ qint32 system = -1;
+ qint32 name = -1;
+ quint32 flags = 0;
};
// Repeated here, as we want to check against accidental changes in enum values.