1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 12:41:49 +01:00

[pdb] Fix broken unit tests after r271982.

llvm-svn: 271983
This commit is contained in:
Zachary Turner 2016-06-07 05:32:48 +00:00
parent df1bab5ad7
commit e2db98503c

View File

@ -12,6 +12,8 @@
#include "llvm/DebugInfo/CodeView/StreamReader.h" #include "llvm/DebugInfo/CodeView/StreamReader.h"
#include "llvm/DebugInfo/CodeView/StreamRef.h" #include "llvm/DebugInfo/CodeView/StreamRef.h"
#include "llvm/DebugInfo/PDB/Raw/IPDBFile.h" #include "llvm/DebugInfo/PDB/Raw/IPDBFile.h"
#include "llvm/DebugInfo/PDB/Raw/IPDBStreamData.h"
#include "llvm/DebugInfo/PDB/Raw/IndexedStreamData.h"
#include "llvm/DebugInfo/PDB/Raw/MappedBlockStream.h" #include "llvm/DebugInfo/PDB/Raw/MappedBlockStream.h"
#include "gtest/gtest.h" #include "gtest/gtest.h"
@ -53,10 +55,10 @@ public:
virtual uint32_t getStreamByteSize(uint32_t StreamIndex) const override { virtual uint32_t getStreamByteSize(uint32_t StreamIndex) const override {
return getBlockCount() * getBlockSize(); return getBlockCount() * getBlockSize();
} }
virtual ArrayRef<uint32_t> virtual ArrayRef<support::ulittle32_t>
getStreamBlockList(uint32_t StreamIndex) const override { getStreamBlockList(uint32_t StreamIndex) const override {
if (StreamIndex != 0) if (StreamIndex != 0)
return ArrayRef<uint32_t>(); return ArrayRef<support::ulittle32_t>();
return Blocks; return Blocks;
} }
virtual StringRef getBlockData(uint32_t BlockIndex, virtual StringRef getBlockData(uint32_t BlockIndex,
@ -65,7 +67,7 @@ public:
} }
private: private:
std::vector<uint32_t> Blocks; std::vector<support::ulittle32_t> Blocks;
std::vector<char> Data; std::vector<char> Data;
}; };
@ -73,7 +75,7 @@ private:
// and does not allocate. // and does not allocate.
TEST(MappedBlockStreamTest, ReadBeyondEndOfStreamRef) { TEST(MappedBlockStreamTest, ReadBeyondEndOfStreamRef) {
DiscontiguousFile F; DiscontiguousFile F;
MappedBlockStream S(0, F); MappedBlockStream S(llvm::make_unique<IndexedStreamData>(0, F), F);
StreamReader R(S); StreamReader R(S);
StreamRef SR; StreamRef SR;
EXPECT_NO_ERROR(R.readStreamRef(SR, 0U)); EXPECT_NO_ERROR(R.readStreamRef(SR, 0U));
@ -87,7 +89,7 @@ TEST(MappedBlockStreamTest, ReadBeyondEndOfStreamRef) {
// does not fail due to the length of the output buffer. // does not fail due to the length of the output buffer.
TEST(MappedBlockStreamTest, ReadOntoNonEmptyBuffer) { TEST(MappedBlockStreamTest, ReadOntoNonEmptyBuffer) {
DiscontiguousFile F; DiscontiguousFile F;
MappedBlockStream S(0, F); MappedBlockStream S(llvm::make_unique<IndexedStreamData>(0, F), F);
StreamReader R(S); StreamReader R(S);
StringRef Str = "ZYXWVUTSRQPONMLKJIHGFEDCBA"; StringRef Str = "ZYXWVUTSRQPONMLKJIHGFEDCBA";
EXPECT_NO_ERROR(R.readFixedString(Str, 1)); EXPECT_NO_ERROR(R.readFixedString(Str, 1));
@ -100,7 +102,7 @@ TEST(MappedBlockStreamTest, ReadOntoNonEmptyBuffer) {
// not allocate memory. // not allocate memory.
TEST(MappedBlockStreamTest, ZeroCopyReadContiguousBreak) { TEST(MappedBlockStreamTest, ZeroCopyReadContiguousBreak) {
DiscontiguousFile F; DiscontiguousFile F;
MappedBlockStream S(0, F); MappedBlockStream S(llvm::make_unique<IndexedStreamData>(0, F), F);
StreamReader R(S); StreamReader R(S);
StringRef Str; StringRef Str;
EXPECT_NO_ERROR(R.readFixedString(Str, 2)); EXPECT_NO_ERROR(R.readFixedString(Str, 2));
@ -118,7 +120,7 @@ TEST(MappedBlockStreamTest, ZeroCopyReadContiguousBreak) {
// requested. // requested.
TEST(MappedBlockStreamTest, CopyReadNonContiguousBreak) { TEST(MappedBlockStreamTest, CopyReadNonContiguousBreak) {
DiscontiguousFile F; DiscontiguousFile F;
MappedBlockStream S(0, F); MappedBlockStream S(llvm::make_unique<IndexedStreamData>(0, F), F);
StreamReader R(S); StreamReader R(S);
StringRef Str; StringRef Str;
EXPECT_NO_ERROR(R.readFixedString(Str, 10)); EXPECT_NO_ERROR(R.readFixedString(Str, 10));
@ -130,7 +132,7 @@ TEST(MappedBlockStreamTest, CopyReadNonContiguousBreak) {
// fails and allocates no memory. // fails and allocates no memory.
TEST(MappedBlockStreamTest, InvalidReadSizeNoBreak) { TEST(MappedBlockStreamTest, InvalidReadSizeNoBreak) {
DiscontiguousFile F; DiscontiguousFile F;
MappedBlockStream S(0, F); MappedBlockStream S(llvm::make_unique<IndexedStreamData>(0, F), F);
StreamReader R(S); StreamReader R(S);
StringRef Str; StringRef Str;
@ -143,7 +145,7 @@ TEST(MappedBlockStreamTest, InvalidReadSizeNoBreak) {
// fails and allocates no memory. // fails and allocates no memory.
TEST(MappedBlockStreamTest, InvalidReadSizeContiguousBreak) { TEST(MappedBlockStreamTest, InvalidReadSizeContiguousBreak) {
DiscontiguousFile F; DiscontiguousFile F;
MappedBlockStream S(0, F); MappedBlockStream S(llvm::make_unique<IndexedStreamData>(0, F), F);
StreamReader R(S); StreamReader R(S);
StringRef Str; StringRef Str;
@ -156,7 +158,7 @@ TEST(MappedBlockStreamTest, InvalidReadSizeContiguousBreak) {
// boundary fails and allocates no memory. // boundary fails and allocates no memory.
TEST(MappedBlockStreamTest, InvalidReadSizeNonContiguousBreak) { TEST(MappedBlockStreamTest, InvalidReadSizeNonContiguousBreak) {
DiscontiguousFile F; DiscontiguousFile F;
MappedBlockStream S(0, F); MappedBlockStream S(llvm::make_unique<IndexedStreamData>(0, F), F);
StreamReader R(S); StreamReader R(S);
StringRef Str; StringRef Str;
@ -168,7 +170,7 @@ TEST(MappedBlockStreamTest, InvalidReadSizeNonContiguousBreak) {
// beyond the end of a StreamRef fails. // beyond the end of a StreamRef fails.
TEST(MappedBlockStreamTest, ZeroCopyReadNoBreak) { TEST(MappedBlockStreamTest, ZeroCopyReadNoBreak) {
DiscontiguousFile F; DiscontiguousFile F;
MappedBlockStream S(0, F); MappedBlockStream S(llvm::make_unique<IndexedStreamData>(0, F), F);
StreamReader R(S); StreamReader R(S);
StringRef Str; StringRef Str;
EXPECT_NO_ERROR(R.readFixedString(Str, 1)); EXPECT_NO_ERROR(R.readFixedString(Str, 1));