diff options
Diffstat (limited to 'llvm/unittests/XRay/FDRTraceWriterTest.cpp')
-rw-r--r-- | llvm/unittests/XRay/FDRTraceWriterTest.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/unittests/XRay/FDRTraceWriterTest.cpp b/llvm/unittests/XRay/FDRTraceWriterTest.cpp index 9d7da50f0ab..97a011977b1 100644 --- a/llvm/unittests/XRay/FDRTraceWriterTest.cpp +++ b/llvm/unittests/XRay/FDRTraceWriterTest.cpp @@ -135,6 +135,11 @@ TEST(FDRTraceWriterTest, WriteToStringBufferVersion1) { std::memcpy(H.FreeFormData, reinterpret_cast<const char *>(&BufferSize), sizeof(BufferSize)); FDRTraceWriter Writer(OS, H); + OS.flush(); + + // Ensure that at this point the Data buffer has the file header serialized + // size. + ASSERT_THAT(Data.size(), Eq(32u)); auto L = LogBuilder() .add<NewBufferRecord>(1) .add<WallclockRecord>(1, 1) @@ -150,6 +155,10 @@ TEST(FDRTraceWriterTest, WriteToStringBufferVersion1) { OS.write_zeros(4016); OS.flush(); + // For version 1 of the log, we need the whole buffer to be the size of the + // file header plus 32. + ASSERT_THAT(Data.size(), Eq(BufferSize + 32)); + // Then from here we load the Trace file. DataExtractor DE(Data, true, 8); auto TraceOrErr = loadTrace(DE, true); |