diff options
author | Dean Michael Berris <dberris@google.com> | 2018-08-31 10:03:52 +0000 |
---|---|---|
committer | Dean Michael Berris <dberris@google.com> | 2018-08-31 10:03:52 +0000 |
commit | 7a07a41cbb4c48db19c49bda99479cfdec7d3a0d (patch) | |
tree | 32d0d503a533856292dff5505de57fbf94c09424 /llvm/unittests/XRay/FDRTraceWriterTest.cpp | |
parent | a26a364e757162faf29b8db435305c4471d49d86 (diff) | |
download | bcm5719-llvm-7a07a41cbb4c48db19c49bda99479cfdec7d3a0d.tar.gz bcm5719-llvm-7a07a41cbb4c48db19c49bda99479cfdec7d3a0d.zip |
[XRay] Attempt to fix failure on Windows
Original version of the code relied on implementation-defined order of bitfields.
Follow-up on D51210.
llvm-svn: 341194
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); |