1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00

[XRay] Improve test matching granularity (NFC)

Simplify matchers for unittest to better isolate which differences there
are that we're finding in failures.

llvm-svn: 341237
This commit is contained in:
Dean Michael Berris 2018-08-31 18:56:42 +00:00
parent 4c86539c67
commit debd460b0e

View File

@ -63,16 +63,17 @@ TEST(FDRTraceWriterTest, WriteToStringBufferVersion3) {
auto &Trace = TraceOrErr.get(); auto &Trace = TraceOrErr.get();
ASSERT_THAT(Trace, Not(IsEmpty())); ASSERT_THAT(Trace, Not(IsEmpty()));
ASSERT_THAT( ASSERT_THAT(Trace, ElementsAre(Field(&XRayRecord::FuncId, Eq(1)),
Trace, Field(&XRayRecord::FuncId, Eq(1))));
ElementsAre(AllOf(Field(&XRayRecord::FuncId, Eq(1)), ASSERT_THAT(Trace, ElementsAre(Field(&XRayRecord::TId, Eq(1u)),
Field(&XRayRecord::TId, Eq(1u)), Field(&XRayRecord::TId, Eq(1u))));
Field(&XRayRecord::CPU, Eq(1u)), ASSERT_THAT(Trace, ElementsAre(Field(&XRayRecord::PId, Eq(1u)),
Field(&XRayRecord::Type, Eq(RecordTypes::ENTER))), Field(&XRayRecord::PId, Eq(1u))));
AllOf(Field(&XRayRecord::FuncId, Eq(1)), ASSERT_THAT(Trace, ElementsAre(Field(&XRayRecord::CPU, Eq(1u)),
Field(&XRayRecord::TId, Eq(1u)), Field(&XRayRecord::CPU, Eq(1u))));
Field(&XRayRecord::CPU, Eq(1u)), ASSERT_THAT(Trace,
Field(&XRayRecord::Type, Eq(RecordTypes::EXIT))))); ElementsAre(Field(&XRayRecord::Type, Eq(RecordTypes::ENTER)),
Field(&XRayRecord::Type, Eq(RecordTypes::EXIT))));
} }
// This version is almost exactly the same as above, except writing version 2 // This version is almost exactly the same as above, except writing version 2
@ -107,16 +108,15 @@ TEST(FDRTraceWriterTest, WriteToStringBufferVersion2) {
auto &Trace = TraceOrErr.get(); auto &Trace = TraceOrErr.get();
ASSERT_THAT(Trace, Not(IsEmpty())); ASSERT_THAT(Trace, Not(IsEmpty()));
ASSERT_THAT( ASSERT_THAT(Trace, ElementsAre(Field(&XRayRecord::FuncId, Eq(1)),
Trace, Field(&XRayRecord::FuncId, Eq(1))));
ElementsAre(AllOf(Field(&XRayRecord::FuncId, Eq(1)), ASSERT_THAT(Trace, ElementsAre(Field(&XRayRecord::TId, Eq(1u)),
Field(&XRayRecord::TId, Eq(1u)), Field(&XRayRecord::TId, Eq(1u))));
Field(&XRayRecord::CPU, Eq(1u)), ASSERT_THAT(Trace, ElementsAre(Field(&XRayRecord::CPU, Eq(1u)),
Field(&XRayRecord::Type, Eq(RecordTypes::ENTER))), Field(&XRayRecord::CPU, Eq(1u))));
AllOf(Field(&XRayRecord::FuncId, Eq(1)), ASSERT_THAT(Trace,
Field(&XRayRecord::TId, Eq(1u)), ElementsAre(Field(&XRayRecord::Type, Eq(RecordTypes::ENTER)),
Field(&XRayRecord::CPU, Eq(1u)), Field(&XRayRecord::Type, Eq(RecordTypes::EXIT))));
Field(&XRayRecord::Type, Eq(RecordTypes::EXIT)))));
} }
// This covers version 1 of the log, without a BufferExtents record but has an // This covers version 1 of the log, without a BufferExtents record but has an
@ -167,16 +167,16 @@ TEST(FDRTraceWriterTest, WriteToStringBufferVersion1) {
auto &Trace = TraceOrErr.get(); auto &Trace = TraceOrErr.get();
ASSERT_THAT(Trace, Not(IsEmpty())); ASSERT_THAT(Trace, Not(IsEmpty()));
ASSERT_THAT( ASSERT_THAT(Trace, Not(IsEmpty()));
Trace, ASSERT_THAT(Trace, ElementsAre(Field(&XRayRecord::FuncId, Eq(1)),
ElementsAre(AllOf(Field(&XRayRecord::FuncId, Eq(1)), Field(&XRayRecord::FuncId, Eq(1))));
Field(&XRayRecord::TId, Eq(1u)), ASSERT_THAT(Trace, ElementsAre(Field(&XRayRecord::TId, Eq(1u)),
Field(&XRayRecord::CPU, Eq(1u)), Field(&XRayRecord::TId, Eq(1u))));
Field(&XRayRecord::Type, Eq(RecordTypes::ENTER))), ASSERT_THAT(Trace, ElementsAre(Field(&XRayRecord::CPU, Eq(1u)),
AllOf(Field(&XRayRecord::FuncId, Eq(1)), Field(&XRayRecord::CPU, Eq(1u))));
Field(&XRayRecord::TId, Eq(1u)), ASSERT_THAT(Trace,
Field(&XRayRecord::CPU, Eq(1u)), ElementsAre(Field(&XRayRecord::Type, Eq(RecordTypes::ENTER)),
Field(&XRayRecord::Type, Eq(RecordTypes::EXIT))))); Field(&XRayRecord::Type, Eq(RecordTypes::EXIT))));
} }
} // namespace } // namespace