OLD | NEW |
1 //===- unittest/IceParseInstsTest.cpp - test instruction errors -----------===// | 1 //===- unittest/IceParseInstsTest.cpp - test instruction errors -----------===// |
2 // | 2 // |
3 // The Subzero Code Generator | 3 // The Subzero Code Generator |
4 // | 4 // |
5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
7 // | 7 // |
8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
9 | 9 |
10 #include "llvm/ADT/STLExtras.h" | 10 #include "llvm/ADT/STLExtras.h" |
(...skipping 45 matching lines...) Loading... |
56 "%p0, i32 @f0);\n" | 56 "%p0, i32 @f0);\n" |
57 "Error(66:4): Invalid relative value id: 100 (Must be <= 4)\n", | 57 "Error(66:4): Invalid relative value id: 100 (Must be <= 4)\n", |
58 DumpMunger.getLinesWithSubstring("66:4")); | 58 DumpMunger.getLinesWithSubstring("66:4")); |
59 | 59 |
60 // Show that we get appropriate error when parsing in Subzero. | 60 // Show that we get appropriate error when parsing in Subzero. |
61 IceTest::SubzeroBitcodeMunger Munger( | 61 IceTest::SubzeroBitcodeMunger Munger( |
62 BitcodeRecords, array_lengthof(BitcodeRecords), Terminator); | 62 BitcodeRecords, array_lengthof(BitcodeRecords), Terminator); |
63 EXPECT_FALSE(Munger.runTest("Nonexistent call arg")); | 63 EXPECT_FALSE(Munger.runTest("Nonexistent call arg")); |
64 EXPECT_EQ("Error(66:4): Invalid function record: <34 0 4 2 100>\n", | 64 EXPECT_EQ("Error(66:4): Invalid function record: <34 0 4 2 100>\n", |
65 Munger.getTestResults()); | 65 Munger.getTestResults()); |
| 66 |
| 67 // Show that we generate a fatal error when not allowing error recovery. |
| 68 Munger.Flags.setAllowErrorRecovery(false); |
| 69 EXPECT_DEATH( |
| 70 Munger.runTest("Nonexistent call arg"), |
| 71 ".*ERROR: Unable to continue.*"); |
66 } | 72 } |
67 | 73 |
68 /// Test how we recognize alignments in alloca instructions. | 74 /// Test how we recognize alignments in alloca instructions. |
69 TEST(IceParseInstsTests, AllocaAlignment) { | 75 TEST(IceParseInstsTests, AllocaAlignment) { |
70 const uint64_t BitcodeRecords[] = { | 76 const uint64_t BitcodeRecords[] = { |
71 1, naclbitc::BLK_CODE_ENTER, naclbitc::MODULE_BLOCK_ID, 2, Terminator, | 77 1, naclbitc::BLK_CODE_ENTER, naclbitc::MODULE_BLOCK_ID, 2, Terminator, |
72 1, naclbitc::BLK_CODE_ENTER, naclbitc::TYPE_BLOCK_ID_NEW, 2, Terminator, | 78 1, naclbitc::BLK_CODE_ENTER, naclbitc::TYPE_BLOCK_ID_NEW, 2, Terminator, |
73 3, naclbitc::TYPE_CODE_NUMENTRY, 4, Terminator, | 79 3, naclbitc::TYPE_CODE_NUMENTRY, 4, Terminator, |
74 3, naclbitc::TYPE_CODE_INTEGER, 32, Terminator, | 80 3, naclbitc::TYPE_CODE_INTEGER, 32, Terminator, |
75 3, naclbitc::TYPE_CODE_VOID, Terminator, | 81 3, naclbitc::TYPE_CODE_VOID, Terminator, |
(...skipping 348 matching lines...) Loading... |
424 Munger.getTestResults()); | 430 Munger.getTestResults()); |
425 EXPECT_FALSE(DumpMunger.runTestForAssembly("Bad Store alignment 30", Align30, | 431 EXPECT_FALSE(DumpMunger.runTestForAssembly("Bad Store alignment 30", Align30, |
426 array_lengthof(Align30))); | 432 array_lengthof(Align30))); |
427 EXPECT_EQ( | 433 EXPECT_EQ( |
428 " store float %p1, float* %p0, align 0;\n" | 434 " store float %p1, float* %p0, align 0;\n" |
429 "Error(62:4): store: Illegal alignment for float. Expects: 1 or 4\n", | 435 "Error(62:4): store: Illegal alignment for float. Expects: 1 or 4\n", |
430 DumpMunger.getLinesWithSubstring("store")); | 436 DumpMunger.getLinesWithSubstring("store")); |
431 } | 437 } |
432 | 438 |
433 } // end of anonymous namespace | 439 } // end of anonymous namespace |
OLD | NEW |