//===- llvm/unittest/DebugInfo/MSF/MappedBlockStreamTest.cpp --------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// #include "llvm/DebugInfo/MSF/MappedBlockStream.h" #include "llvm/Support/BinaryByteStream.h" #include "llvm/Support/BinaryStreamReader.h" #include "llvm/Support/BinaryStreamRef.h" #include "llvm/Support/BinaryStreamWriter.h" #include "llvm/Testing/Support/Error.h" #include "gmock/gmock.h" #include "gtest/gtest.h" usingnamespacellvm; usingnamespacellvm::msf; usingnamespacellvm::support; namespace { static const uint32_t BlocksAry[] = …; static uint8_t DataAry[] = …; class DiscontiguousStream : public WritableBinaryStream { … }; TEST(MappedBlockStreamTest, NumBlocks) { … } // Tests that a read which is entirely contained within a single block works // and does not allocate. TEST(MappedBlockStreamTest, ReadBeyondEndOfStreamRef) { … } // Tests that a read which outputs into a full destination buffer works and // does not fail due to the length of the output buffer. TEST(MappedBlockStreamTest, ReadOntoNonEmptyBuffer) { … } // Tests that a read which crosses a block boundary, but where the subsequent // blocks are still contiguous in memory to the previous block works and does // not allocate memory. TEST(MappedBlockStreamTest, ZeroCopyReadContiguousBreak) { … } // Tests that a read which crosses a block boundary and cannot be referenced // contiguously works and allocates only the precise amount of bytes // requested. TEST(MappedBlockStreamTest, CopyReadNonContiguousBreak) { … } // Test that an out of bounds read which doesn't cross a block boundary // fails and allocates no memory. TEST(MappedBlockStreamTest, InvalidReadSizeNoBreak) { … } // Test that an out of bounds read which crosses a contiguous block boundary // fails and allocates no memory. TEST(MappedBlockStreamTest, InvalidReadSizeContiguousBreak) { … } // Test that an out of bounds read which crosses a discontiguous block // boundary fails and allocates no memory. TEST(MappedBlockStreamTest, InvalidReadSizeNonContiguousBreak) { … } // Tests that a read which is entirely contained within a single block but // beyond the end of a StreamRef fails. TEST(MappedBlockStreamTest, ZeroCopyReadNoBreak) { … } // Tests that a read which is not aligned on the same boundary as a previous // cached request, but which is known to overlap that request, shares the // previous allocation. TEST(MappedBlockStreamTest, UnalignedOverlappingRead) { … } // Tests that a read which is not aligned on the same boundary as a previous // cached request, but which only partially overlaps a previous cached request, // still works correctly and allocates again from the shared pool. TEST(MappedBlockStreamTest, UnalignedOverlappingReadFail) { … } TEST(MappedBlockStreamTest, WriteBeyondEndOfStream) { … } TEST(MappedBlockStreamTest, TestWriteBytesNoBreakBoundary) { … } TEST(MappedBlockStreamTest, TestWriteBytesBreakBoundary) { … } TEST(MappedBlockStreamTest, TestWriteThenRead) { … } TEST(MappedBlockStreamTest, TestWriteContiguousStreamRef) { … } TEST(MappedBlockStreamTest, TestWriteDiscontiguousStreamRef) { … } TEST(MappedBlockStreamTest, DataLivesAfterStreamDestruction) { … } } // namespace MATCHER_P3(BlockIsFilledWith, Layout, BlockIndex, Byte, "succeeded") { … } namespace { TEST(MappedBlockStreamTest, CreateFpmStream) { … } } // end anonymous namespace