diff options
Diffstat (limited to 'unittests/DebugInfo/CodeView')
4 files changed, 13 insertions, 78 deletions
diff --git a/unittests/DebugInfo/CodeView/CMakeLists.txt b/unittests/DebugInfo/CodeView/CMakeLists.txt index 9576d45e77ba..6f504d8149b5 100644 --- a/unittests/DebugInfo/CodeView/CMakeLists.txt +++ b/unittests/DebugInfo/CodeView/CMakeLists.txt @@ -10,3 +10,5 @@ set(DebugInfoCodeViewSources add_llvm_unittest(DebugInfoCodeViewTests ${DebugInfoCodeViewSources} ) + +target_link_libraries(DebugInfoCodeViewTests LLVMTestingSupport)
\ No newline at end of file diff --git a/unittests/DebugInfo/CodeView/ErrorChecking.h b/unittests/DebugInfo/CodeView/ErrorChecking.h deleted file mode 100644 index 4ca74c487b3e..000000000000 --- a/unittests/DebugInfo/CodeView/ErrorChecking.h +++ /dev/null @@ -1,70 +0,0 @@ -//===- ErrorChecking.h - Helpers for verifying llvm::Errors -----*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_UNITTESTS_DEBUGINFO_CODEVIEW_ERRORCHECKING_H -#define LLVM_UNITTESTS_DEBUGINFO_CODEVIEW_ERRORCHECKING_H - -#define EXPECT_NO_ERROR(Err) \ - { \ - auto E = Err; \ - EXPECT_FALSE(static_cast<bool>(E)); \ - if (E) \ - consumeError(std::move(E)); \ - } - -#define EXPECT_ERROR(Err) \ - { \ - auto E = Err; \ - EXPECT_TRUE(static_cast<bool>(E)); \ - if (E) \ - consumeError(std::move(E)); \ - } - -#define ASSERT_EXPECTED(Exp) \ - { \ - auto E = Exp.takeError(); \ - bool Success = static_cast<bool>(E); \ - if (!Success) \ - consumeError(std::move(E)); \ - ASSERT_FALSE(Success); \ - } - -#define EXPECT_EXPECTED(Exp) \ - { \ - auto E = Exp.takeError(); \ - EXPECT_FALSE(static_cast<bool>(E)); \ - if (E) { \ - consumeError(std::move(E)); \ - return; \ - } \ - } - -#define EXPECT_EXPECTED_EQ(Val, Exp) \ - { \ - auto Result = Exp; \ - auto E = Result.takeError(); \ - EXPECT_FALSE(static_cast<bool>(E)); \ - if (E) { \ - consumeError(std::move(E)); \ - return; \ - } \ - EXPECT_EQ(Val, *Result); \ - } - -#define EXPECT_UNEXPECTED(Exp) \ - { \ - auto E = Exp.takeError(); \ - EXPECT_TRUE(static_cast<bool>(E)); \ - if (E) { \ - consumeError(std::move(E)); \ - return; \ - } \ - } - -#endif diff --git a/unittests/DebugInfo/CodeView/RandomAccessVisitorTest.cpp b/unittests/DebugInfo/CodeView/RandomAccessVisitorTest.cpp index 0ca24c716d1d..4fa172a37ef2 100644 --- a/unittests/DebugInfo/CodeView/RandomAccessVisitorTest.cpp +++ b/unittests/DebugInfo/CodeView/RandomAccessVisitorTest.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -#include "ErrorChecking.h" - #include "llvm/ADT/SmallBitVector.h" #include "llvm/DebugInfo/CodeView/CVTypeVisitor.h" #include "llvm/DebugInfo/CodeView/LazyRandomTypeCollection.h" @@ -22,6 +20,7 @@ #include "llvm/Support/Allocator.h" #include "llvm/Support/BinaryItemStream.h" #include "llvm/Support/Error.h" +#include "llvm/Testing/Support/Error.h" #include "gtest/gtest.h" @@ -219,7 +218,8 @@ TEST_F(RandomAccessVisitorTest, MultipleVisits) { for (uint32_t I : IndicesToVisit) { TypeIndex TI = TypeIndex::fromArrayIndex(I); CVType T = Types.getType(TI); - EXPECT_NO_ERROR(codeview::visitTypeRecord(T, TI, TestState->Callbacks)); + EXPECT_THAT_ERROR(codeview::visitTypeRecord(T, TI, TestState->Callbacks), + Succeeded()); } // [0,8) should be present @@ -247,7 +247,8 @@ TEST_F(RandomAccessVisitorTest, DescendingWithinChunk) { for (uint32_t I : IndicesToVisit) { TypeIndex TI = TypeIndex::fromArrayIndex(I); CVType T = Types.getType(TI); - EXPECT_NO_ERROR(codeview::visitTypeRecord(T, TI, TestState->Callbacks)); + EXPECT_THAT_ERROR(codeview::visitTypeRecord(T, TI, TestState->Callbacks), + Succeeded()); } // [0, 7] @@ -275,7 +276,8 @@ TEST_F(RandomAccessVisitorTest, AscendingWithinChunk) { for (uint32_t I : IndicesToVisit) { TypeIndex TI = TypeIndex::fromArrayIndex(I); CVType T = Types.getType(TI); - EXPECT_NO_ERROR(codeview::visitTypeRecord(T, TI, TestState->Callbacks)); + EXPECT_THAT_ERROR(codeview::visitTypeRecord(T, TI, TestState->Callbacks), + Succeeded()); } // [0, 7] @@ -305,7 +307,8 @@ TEST_F(RandomAccessVisitorTest, StopPrematurelyInChunk) { for (uint32_t I : IndicesToVisit) { TypeIndex TI = TypeIndex::fromArrayIndex(I); CVType T = Types.getType(TI); - EXPECT_NO_ERROR(codeview::visitTypeRecord(T, TI, TestState->Callbacks)); + EXPECT_THAT_ERROR(codeview::visitTypeRecord(T, TI, TestState->Callbacks), + Succeeded()); } // [0, 8) should be visited. @@ -334,7 +337,8 @@ TEST_F(RandomAccessVisitorTest, InnerChunk) { for (uint32_t I : IndicesToVisit) { TypeIndex TI = TypeIndex::fromArrayIndex(I); CVType T = Types.getType(TI); - EXPECT_NO_ERROR(codeview::visitTypeRecord(T, TI, TestState->Callbacks)); + EXPECT_THAT_ERROR(codeview::visitTypeRecord(T, TI, TestState->Callbacks), + Succeeded()); } // [4, 9) diff --git a/unittests/DebugInfo/CodeView/TypeIndexDiscoveryTest.cpp b/unittests/DebugInfo/CodeView/TypeIndexDiscoveryTest.cpp index 4eca7777a1e2..99c84906be9c 100644 --- a/unittests/DebugInfo/CodeView/TypeIndexDiscoveryTest.cpp +++ b/unittests/DebugInfo/CodeView/TypeIndexDiscoveryTest.cpp @@ -9,7 +9,6 @@ #include "llvm/DebugInfo/CodeView/TypeIndexDiscovery.h" -#include "ErrorChecking.h" #include "llvm/DebugInfo/CodeView/TypeTableBuilder.h" #include "llvm/Support/Allocator.h" |