diff options
author | James Henderson <james.henderson@sony.com> | 2020-02-11 14:11:01 +0000 |
---|---|---|
committer | James Henderson <james.henderson@sony.com> | 2020-02-12 14:49:22 +0000 |
commit | 1da62b51a5f00a4b84843f3ecc8a495de618afc8 (patch) | |
tree | 904317af5cefe47d8e6b43d9eaae281479f59e97 /llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp | |
parent | 61b35e4111160fe834a00c33d040e01150b576ac (diff) | |
download | llvm-1da62b51a5f00a4b84843f3ecc8a495de618afc8.zip llvm-1da62b51a5f00a4b84843f3ecc8a495de618afc8.tar.gz llvm-1da62b51a5f00a4b84843f3ecc8a495de618afc8.tar.bz2 |
[DebugInfo] Print version in error message in decimal
Also remove some test duplication and add a test case that shows the
maximum version is rejected (this also shows that the value in the error
message is actually in decimal, and not just missing an 0x prefix).
Reviewed by: dblaikie
Differential Revision: https://reviews.llvm.org/D74403
Diffstat (limited to 'llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp')
-rw-r--r-- | llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp | 39 |
1 files changed, 18 insertions, 21 deletions
diff --git a/llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp b/llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp index b0fdabb..795b9b4 100644 --- a/llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp +++ b/llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp @@ -339,37 +339,34 @@ TEST_F(DebugLineBasicFixture, ErrorForReservedLength) { "unit length found of value 0xfffffff0"); } -TEST_F(DebugLineBasicFixture, ErrorForLowVersion) { - if (!setupGenerator()) - return; - - LineTable < = Gen->addLineTable(); - LT.setCustomPrologue( - {{LineTable::Half, LineTable::Long}, {1, LineTable::Half}}); - - generate(); +struct DebugLineUnsupportedVersionFixture : public TestWithParam<uint16_t>, + public CommonFixture { + void SetUp() { Version = GetParam(); } - checkGetOrParseLineTableEmitsFatalError( - "parsing line table prologue at offset " - "0x00000000 found unsupported version " - "0x01"); -} + uint16_t Version; +}; -TEST_F(DebugLineBasicFixture, ErrorForHighVersion) { +TEST_P(DebugLineUnsupportedVersionFixture, ErrorForUnsupportedVersion) { if (!setupGenerator()) return; LineTable < = Gen->addLineTable(); LT.setCustomPrologue( - {{LineTable::Half, LineTable::Long}, {6, LineTable::Half}}); + {{LineTable::Half, LineTable::Long}, {Version, LineTable::Half}}); generate(); checkGetOrParseLineTableEmitsFatalError( "parsing line table prologue at offset 0x00000000 found unsupported " - "version 0x06"); + "version " + + std::to_string(Version)); } +INSTANTIATE_TEST_CASE_P(UnsupportedVersionTestParams, + DebugLineUnsupportedVersionFixture, + Values(/*1 below min */ 1, /* 1 above max */ 6, + /* Maximum possible */ 0xffff), ); + TEST_F(DebugLineBasicFixture, ErrorForInvalidV5IncludeDirTable) { if (!setupGenerator(5)) return; @@ -785,9 +782,9 @@ TEST_F(DebugLineBasicFixture, ParserReportsFirstErrorInEachTableWhenParsing) { EXPECT_FALSE(Recoverable); checkError({"parsing line table prologue at offset 0x00000000 found " - "unsupported version 0x00", + "unsupported version 0", "parsing line table prologue at offset 0x00000006 found " - "unsupported version 0x01"}, + "unsupported version 1"}, std::move(Unrecoverable)); } @@ -843,9 +840,9 @@ TEST_F(DebugLineBasicFixture, EXPECT_FALSE(Recoverable); checkError({"parsing line table prologue at offset 0x00000000 found " - "unsupported version 0x00", + "unsupported version 0", "parsing line table prologue at offset 0x00000006 found " - "unsupported version 0x01"}, + "unsupported version 1"}, std::move(Unrecoverable)); } |