Chromium Code Reviews| Index: unittests/Bitcode/NaClAbbrevErrorTests.cpp |
| diff --git a/unittests/Bitcode/NaClAbbrevErrorTests.cpp b/unittests/Bitcode/NaClAbbrevErrorTests.cpp |
| index 38ceb42b2e79f8737d76f117183f51434a9ddb68..a858c07f0027ee9f6453f462bcde8da0e19bf48a 100644 |
| --- a/unittests/Bitcode/NaClAbbrevErrorTests.cpp |
| +++ b/unittests/Bitcode/NaClAbbrevErrorTests.cpp |
| @@ -75,15 +75,27 @@ TEST(MyDeathNaClAbbrevErrorTests, BadAbbreviationIndex) { |
| ReplaceIndex, NaClMungedBitcode::Replace, |
| 4, naclbitc::TYPE_CODE_VOID, Terminator, |
| }; |
| + |
| + // Show that by default, one can't write a bad abbreviation index. |
| DumpMunger.setRunAsDeathTest(true); |
| EXPECT_DEATH( |
| DumpMunger.runTest("Bad abbreviation index 4", |
| AbbrevIndex4, array_lengthof(AbbrevIndex4)), |
| + ".*Error \\(Block 17\\)\\: Uses illegal abbreviation index\\:" |
| + " 4\\: \\[2\\].*"); |
| + |
| + // Show that the corresponding error is generated when reading |
| + // bitcode with a bad abbreviation index. |
| + DumpMunger.WriteFlags.SaveBadAbbrevIndices = true; |
| + EXPECT_DEATH( |
| + DumpMunger.runTest("Bad abbreviation index 4", |
| + AbbrevIndex4, array_lengthof(AbbrevIndex4)), |
| ".*Fatal\\(35\\:0\\)\\: Invalid abbreviation \\# 4 defined for record.*"); |
| // Test that bitcode reader reports problem correctly. |
| NaClParseBitcodeMunger Munger(BitcodeRecords, |
| array_lengthof(BitcodeRecords), Terminator); |
| + Munger.WriteFlags.SaveBadAbbrevIndices = true; |
|
jvoung (off chromium)
2015/05/06 22:08:09
It looks like there you could also separately test
Karl
2015/05/07 20:09:18
Added recovery cases. Also refactored the RunAsDea
|
| EXPECT_DEATH( |
| Munger.runTest("Bad abbreviation index", |
| AbbrevIndex4, array_lengthof(AbbrevIndex4), true), |