| Index: unittests/Bitcode/NaClObjDumpTypesTest.cpp
|
| diff --git a/unittests/Bitcode/NaClObjDumpTypesTest.cpp b/unittests/Bitcode/NaClObjDumpTypesTest.cpp
|
| index 43ea21a50411a9a424044d16931153c698257e62..91e2fbb6765f80877bbe35384b637b46ef9bec39 100644
|
| --- a/unittests/Bitcode/NaClObjDumpTypesTest.cpp
|
| +++ b/unittests/Bitcode/NaClObjDumpTypesTest.cpp
|
| @@ -10,16 +10,11 @@
|
|
|
| // Tests record errors in the types block when dumping PNaCl bitcode.
|
|
|
| -#include "llvm/ADT/STLExtras.h"
|
| -#include "llvm/Bitcode/NaCl/NaClBitcodeMunge.h"
|
| -
|
| -#include "gtest/gtest.h"
|
| +#include "NaClMungeTest.h"
|
|
|
| using namespace llvm;
|
|
|
| -namespace {
|
| -
|
| -static const uint64_t Terminator = 0x5768798008978675LL;
|
| +namespace naclmungetest {
|
|
|
| static const char ErrorPrefix[] = "Error";
|
|
|
| @@ -38,9 +33,8 @@ TEST(NaClObjDumpTypesTest, BadTypeReferences) {
|
| const uint64_t ReplaceIndex = 4;
|
|
|
| // Show base input.
|
| - NaClObjDumpMunger Munger(BitcodeRecords,
|
| - array_lengthof(BitcodeRecords), Terminator);
|
| - EXPECT_TRUE(Munger.runTestForAssembly("Bad type references base"));
|
| + NaClObjDumpMunger Munger(ARRAY_TERM(BitcodeRecords));
|
| + EXPECT_TRUE(Munger.runTestForAssembly());
|
| EXPECT_EQ(
|
| "module { // BlockID = 8\n"
|
| " types { // BlockID = 17\n"
|
| @@ -55,8 +49,7 @@ TEST(NaClObjDumpTypesTest, BadTypeReferences) {
|
| const uint64_t AddSelfReference[] = {
|
| ReplaceIndex, NaClMungedBitcode::Replace, 3, 12, 4, 1, Terminator
|
| };
|
| - EXPECT_FALSE(Munger.runTestForAssembly(
|
| - "@t1 = <4 x @t1>", AddSelfReference, array_lengthof(AddSelfReference)));
|
| + EXPECT_FALSE(Munger.runTestForAssembly(ARRAY(AddSelfReference)));
|
| // Note: Because @t1 is not defined until after this instruction,
|
| // the initial lookup of @t1 in <4 x @t1> is not found. To error
|
| // recover, type "void" is returned as the type of @t1.
|
| @@ -73,9 +66,7 @@ TEST(NaClObjDumpTypesTest, BadTypeReferences) {
|
| const uint64_t AddForwardReference[] = {
|
| ReplaceIndex, NaClMungedBitcode::Replace, 3, 12, 4, 5, Terminator
|
| };
|
| - EXPECT_FALSE(Munger.runTestForAssembly(
|
| - "@t1 = <4 x @t5>", AddForwardReference,
|
| - array_lengthof(AddForwardReference)));
|
| + EXPECT_FALSE(Munger.runTestForAssembly(ARRAY(AddForwardReference)));
|
| // Note: Because @t5 is not defined, type "void" is used to error recover.
|
| EXPECT_EQ(
|
| "Error(37:6): Can't find definition for @t5\n"
|
| @@ -102,11 +93,10 @@ TEST(NaClObjDumpTypesTest, TestCountRecord) {
|
| const uint64_t AddBeforeIndex = 5;
|
| const uint64_t ReplaceIndex = 2;
|
|
|
| - NaClObjDumpMunger Munger(BitcodeRecords,
|
| - array_lengthof(BitcodeRecords), Terminator);
|
| + NaClObjDumpMunger Munger(ARRAY_TERM(BitcodeRecords));
|
|
|
| // Test case where count is correct.
|
| - EXPECT_TRUE(Munger.runTestForAssembly("Good case"));
|
| + EXPECT_TRUE(Munger.runTestForAssembly());
|
| EXPECT_EQ(
|
| "module { // BlockID = 8\n"
|
| " types { // BlockID = 17\n"
|
| @@ -122,8 +112,7 @@ TEST(NaClObjDumpTypesTest, TestCountRecord) {
|
| const uint64_t AddDoubleType[] = {
|
| AddBeforeIndex, NaClMungedBitcode::AddBefore, 3, 4, Terminator
|
| };
|
| - EXPECT_FALSE(Munger.runTestForAssembly(
|
| - "Add double type", AddDoubleType, array_lengthof(AddDoubleType)));
|
| + EXPECT_FALSE(Munger.runTestForAssembly(ARRAY(AddDoubleType)));
|
| EXPECT_EQ("Error(41:2): Expected 2 types but found: 3\n",
|
| Munger.getLinesWithPrefix(ErrorPrefix));
|
| EXPECT_EQ(
|
| @@ -135,8 +124,7 @@ TEST(NaClObjDumpTypesTest, TestCountRecord) {
|
| // Test case where fewer types are defined then specified by the count
|
| // record.
|
| const uint64_t DeleteI32Type[] = { 3, NaClMungedBitcode::Remove };
|
| - EXPECT_FALSE(Munger.runTestForAssembly(
|
| - "Delete I32 type", DeleteI32Type, array_lengthof(DeleteI32Type)));
|
| + EXPECT_FALSE(Munger.runTestForAssembly(ARRAY(DeleteI32Type)));
|
| EXPECT_EQ("Error(36:2): Expected 2 types but found: 1\n",
|
| Munger.getLinesWithPrefix(ErrorPrefix));
|
| EXPECT_EQ(
|
| @@ -146,9 +134,7 @@ TEST(NaClObjDumpTypesTest, TestCountRecord) {
|
| // Test if we generate an error message if the count record isn't first.
|
| const uint64_t AddI16BeforeCount[] = {
|
| ReplaceIndex, NaClMungedBitcode::AddBefore, 3, 7, 16, Terminator };
|
| - EXPECT_FALSE(Munger.runTestForAssembly(
|
| - "Add I16 before count", AddI16BeforeCount,
|
| - array_lengthof(AddI16BeforeCount)));
|
| + EXPECT_FALSE(Munger.runTestForAssembly(ARRAY(AddI16BeforeCount)));
|
| EXPECT_EQ(
|
| "module { // BlockID = 8\n"
|
| " types { // BlockID = 17\n"
|
| @@ -165,9 +151,7 @@ TEST(NaClObjDumpTypesTest, TestCountRecord) {
|
| // Test if count record doesn't contain enough elements.
|
| const uint64_t CountRecordEmpty[] = {
|
| ReplaceIndex, NaClMungedBitcode::Replace, 3, 1, Terminator };
|
| - EXPECT_FALSE(Munger.runTestForErrors(
|
| - "Count record empty", CountRecordEmpty,
|
| - array_lengthof(CountRecordEmpty)));
|
| + EXPECT_FALSE(Munger.runTestForErrors(ARRAY(CountRecordEmpty)));
|
| EXPECT_EQ("Error(32:0): Count record should have 1 argument. Found: 0\n"
|
| "Error(38:6): Expected 0 types but found: 2\n",
|
| Munger.getTestResults());
|
| @@ -176,9 +160,7 @@ TEST(NaClObjDumpTypesTest, TestCountRecord) {
|
| const uint64_t CountRecordTooLong[] = {
|
| ReplaceIndex, NaClMungedBitcode::Replace, 3, 1, 14, 2, Terminator
|
| };
|
| - EXPECT_FALSE(Munger.runTestForErrors(
|
| - "Count record too long", CountRecordTooLong,
|
| - array_lengthof(CountRecordTooLong)));
|
| + EXPECT_FALSE(Munger.runTestForErrors(ARRAY(CountRecordTooLong)));
|
| EXPECT_EQ("Error(32:0): Count record should have 1 argument. Found: 2\n"
|
| "Error(40:2): Expected 0 types but found: 2\n",
|
| Munger.getTestResults());
|
| @@ -197,11 +179,10 @@ TEST(NaClObjDumpTypesTest, TestVoidRecord) {
|
|
|
| const uint64_t ReplaceIndex = 3;
|
|
|
| - NaClObjDumpMunger Munger(BitcodeRecords,
|
| - array_lengthof(BitcodeRecords), Terminator);
|
| + NaClObjDumpMunger Munger(ARRAY_TERM(BitcodeRecords));
|
|
|
| // Test where void is properly specified.
|
| - EXPECT_TRUE(Munger.runTestForAssembly("Good case"));
|
| + EXPECT_TRUE(Munger.runTestForAssembly());
|
| EXPECT_EQ(
|
| "module { // BlockID = 8\n"
|
| " types { // BlockID = 17\n"
|
| @@ -215,9 +196,7 @@ TEST(NaClObjDumpTypesTest, TestVoidRecord) {
|
| const uint64_t VoidRecordTooLong[] = {
|
| ReplaceIndex, NaClMungedBitcode::Replace, 3, 2, 5, Terminator
|
| };
|
| - EXPECT_FALSE(Munger.runTestForAssembly(
|
| - "Void record too long", VoidRecordTooLong,
|
| - array_lengthof(VoidRecordTooLong)));
|
| + EXPECT_FALSE(Munger.runTestForAssembly(ARRAY(VoidRecordTooLong)));
|
| EXPECT_EQ("Error(34:4): Void record shouldn't have arguments. Found: 1\n",
|
| Munger.getLinesWithPrefix(ErrorPrefix));
|
| EXPECT_EQ(
|
| @@ -238,11 +217,10 @@ TEST(NaClObjDumpTypesTest, TestIntegerRecord) {
|
|
|
| const uint64_t ReplaceIndex = 3;
|
|
|
| - NaClObjDumpMunger Munger(BitcodeRecords,
|
| - array_lengthof(BitcodeRecords), Terminator);
|
| + NaClObjDumpMunger Munger(ARRAY_TERM(BitcodeRecords));
|
|
|
| // Tests that we accept i1.
|
| - EXPECT_TRUE(Munger.runTestForAssembly("Test type i1"));
|
| + EXPECT_TRUE(Munger.runTestForAssembly());
|
| EXPECT_EQ(
|
| "module { // BlockID = 8\n"
|
| " types { // BlockID = 17\n"
|
| @@ -256,8 +234,7 @@ TEST(NaClObjDumpTypesTest, TestIntegerRecord) {
|
| const uint64_t TestTypeI2[] = {
|
| ReplaceIndex, NaClMungedBitcode::Replace, 3, 7, 2, Terminator
|
| };
|
| - EXPECT_FALSE(Munger.runTestForAssembly(
|
| - "Type type i2", TestTypeI2, array_lengthof(TestTypeI2)));
|
| + EXPECT_FALSE(Munger.runTestForAssembly(ARRAY(TestTypeI2)));
|
| EXPECT_EQ(
|
| "Error(34:4): Integer record contains bad integer size: 2\n",
|
| Munger.getLinesWithPrefix(ErrorPrefix));
|
| @@ -270,36 +247,31 @@ TEST(NaClObjDumpTypesTest, TestIntegerRecord) {
|
| const uint64_t TestTypeI8[] = {
|
| ReplaceIndex, NaClMungedBitcode::Replace, 3, 7, 8, Terminator
|
| };
|
| - EXPECT_TRUE(Munger.runTest(
|
| - "Type type i8", TestTypeI8, array_lengthof(TestTypeI8)));
|
| + EXPECT_TRUE(Munger.runTest(ARRAY(TestTypeI8)));
|
|
|
| // Tests that we accept i16.
|
| const uint64_t TestTypeI16[] = {
|
| ReplaceIndex, NaClMungedBitcode::Replace, 3, 7, 16, Terminator
|
| };
|
| - EXPECT_TRUE(Munger.runTest(
|
| - "Type type i16", TestTypeI16, array_lengthof(TestTypeI16)));
|
| + EXPECT_TRUE(Munger.runTest(ARRAY(TestTypeI16)));
|
|
|
| // Tests that we accept i32.
|
| const uint64_t TestTypeI32[] = {
|
| ReplaceIndex, NaClMungedBitcode::Replace, 3, 7, 32, Terminator
|
| };
|
| - EXPECT_TRUE(Munger.runTest(
|
| - "Type type i32", TestTypeI32, array_lengthof(TestTypeI32)));
|
| + EXPECT_TRUE(Munger.runTest(ARRAY(TestTypeI32)));
|
|
|
| // Tests that we accept i64.
|
| const uint64_t TestTypeI64[] = {
|
| ReplaceIndex, NaClMungedBitcode::Replace, 3, 7, 64, Terminator
|
| };
|
| - EXPECT_TRUE(Munger.runTest(
|
| - "Type type i64", TestTypeI64, array_lengthof(TestTypeI64)));
|
| + EXPECT_TRUE(Munger.runTest(ARRAY(TestTypeI64)));
|
|
|
| // Tests that we reject i128.
|
| const uint64_t TestTypeI128[] = {
|
| ReplaceIndex, NaClMungedBitcode::Replace, 3, 7, 128, Terminator
|
| };
|
| - EXPECT_FALSE(Munger.runTestForAssembly(
|
| - "Type type i128", TestTypeI128, array_lengthof(TestTypeI128)));
|
| + EXPECT_FALSE(Munger.runTestForAssembly(ARRAY(TestTypeI128)));
|
| EXPECT_EQ(
|
| "Error(34:4): Integer record contains bad integer size: 128\n",
|
| Munger.getLinesWithPrefix(ErrorPrefix));
|
| @@ -312,9 +284,7 @@ TEST(NaClObjDumpTypesTest, TestIntegerRecord) {
|
| const uint64_t RecordTooShort[] = {
|
| ReplaceIndex, NaClMungedBitcode::Replace, 3, 7, Terminator
|
| };
|
| - EXPECT_FALSE(Munger.runTestForAssembly(
|
| - "Integer record too short", RecordTooShort,
|
| - array_lengthof(RecordTooShort)));
|
| + EXPECT_FALSE(Munger.runTestForAssembly(ARRAY(RecordTooShort)));
|
| EXPECT_EQ(
|
| "Error(34:4): Integer record should have one argument. Found: 0\n",
|
| Munger.getLinesWithPrefix(ErrorPrefix));
|
| @@ -327,8 +297,7 @@ TEST(NaClObjDumpTypesTest, TestIntegerRecord) {
|
| const uint64_t RecordTooLong[] = {
|
| ReplaceIndex, NaClMungedBitcode::Replace, 3, 7, 32, 0, Terminator
|
| };
|
| - EXPECT_FALSE(Munger.runTestForErrors(
|
| - "Integer record too long", RecordTooLong, array_lengthof(RecordTooLong)));
|
| + EXPECT_FALSE(Munger.runTestForErrors(ARRAY(RecordTooLong)));
|
| EXPECT_EQ(
|
| "Error(34:4): Integer record should have one argument. Found: 2\n",
|
| Munger.getTestResults());
|
| @@ -347,11 +316,10 @@ TEST(NaClObjDumpTypesTest, TestFloatRecord) {
|
|
|
| const uint64_t ReplaceIndex = 3;
|
|
|
| - NaClObjDumpMunger Munger(BitcodeRecords,
|
| - array_lengthof(BitcodeRecords), Terminator);
|
| + NaClObjDumpMunger Munger(ARRAY_TERM(BitcodeRecords));
|
|
|
| // Test that we accept the float record.
|
| - EXPECT_TRUE(Munger.runTestForAssembly("Good case"));
|
| + EXPECT_TRUE(Munger.runTestForAssembly());
|
| EXPECT_EQ(
|
| "module { // BlockID = 8\n"
|
| " types { // BlockID = 17\n"
|
| @@ -365,9 +333,7 @@ TEST(NaClObjDumpTypesTest, TestFloatRecord) {
|
| const uint64_t FloatRecordTooLong[] = {
|
| ReplaceIndex, NaClMungedBitcode::Replace, 3, 3, 5, Terminator
|
| };
|
| - EXPECT_FALSE(Munger.runTestForAssembly(
|
| - "Float record too long", FloatRecordTooLong,
|
| - array_lengthof(FloatRecordTooLong)));
|
| + EXPECT_FALSE(Munger.runTestForAssembly(ARRAY(FloatRecordTooLong)));
|
| EXPECT_EQ(
|
| "Error(34:4): Float record shoudn't have arguments. Found: 1\n",
|
| Munger.getLinesWithPrefix(ErrorPrefix));
|
| @@ -389,11 +355,10 @@ TEST(NaClObjDumpTypesTest, TestDoubleRecord) {
|
|
|
| const uint64_t ReplaceIndex = 3;
|
|
|
| - NaClObjDumpMunger Munger(BitcodeRecords,
|
| - array_lengthof(BitcodeRecords), Terminator);
|
| + NaClObjDumpMunger Munger(ARRAY_TERM(BitcodeRecords));
|
|
|
| // Test that we accept the double record.
|
| - EXPECT_TRUE(Munger.runTestForAssembly("Good case"));
|
| + EXPECT_TRUE(Munger.runTestForAssembly());
|
| EXPECT_EQ(
|
| "module { // BlockID = 8\n"
|
| " types { // BlockID = 17\n"
|
| @@ -407,9 +372,7 @@ TEST(NaClObjDumpTypesTest, TestDoubleRecord) {
|
| const uint64_t DoubleRecordTooLong[] = {
|
| ReplaceIndex, NaClMungedBitcode::Replace, 3, 4, 5, Terminator
|
| };
|
| - EXPECT_FALSE(Munger.runTestForAssembly(
|
| - "Double record too long", DoubleRecordTooLong,
|
| - array_lengthof(DoubleRecordTooLong)));
|
| + EXPECT_FALSE(Munger.runTestForAssembly(ARRAY(DoubleRecordTooLong)));
|
| EXPECT_EQ(
|
| "Error(34:4): Double record shound't have arguments. Found: 1\n",
|
| Munger.getLinesWithPrefix(ErrorPrefix));
|
| @@ -432,11 +395,10 @@ TEST(NaClObjDumpTypesTest, TestVectorRecordLength) {
|
|
|
| const uint64_t ReplaceIndex = 4;
|
|
|
| - NaClObjDumpMunger Munger(BitcodeRecords,
|
| - array_lengthof(BitcodeRecords), Terminator);
|
| + NaClObjDumpMunger Munger(ARRAY_TERM(BitcodeRecords));
|
|
|
| // Test correct length vector record.
|
| - EXPECT_TRUE(Munger.runTestForAssembly("Test valid vector record"));
|
| + EXPECT_TRUE(Munger.runTestForAssembly());
|
| EXPECT_EQ(
|
| "module { // BlockID = 8\n"
|
| " types { // BlockID = 17\n"
|
| @@ -451,8 +413,7 @@ TEST(NaClObjDumpTypesTest, TestVectorRecordLength) {
|
| uint64_t RecordTooShort[] = {
|
| ReplaceIndex, NaClMungedBitcode::Replace, 3, 12, 4, Terminator
|
| };
|
| - EXPECT_FALSE(Munger.runTestForAssembly(
|
| - "Record too short", RecordTooShort, array_lengthof(RecordTooShort)));
|
| + EXPECT_FALSE(Munger.runTestForAssembly(ARRAY(RecordTooShort)));
|
| EXPECT_EQ(
|
| "Error(37:6): Vector record should contain two arguments. Found: 1\n",
|
| Munger.getLinesWithPrefix(ErrorPrefix));
|
| @@ -464,8 +425,7 @@ TEST(NaClObjDumpTypesTest, TestVectorRecordLength) {
|
| uint64_t RecordTooLong[] = {
|
| ReplaceIndex, NaClMungedBitcode::Replace, 3, 12, 4, 0, 0, Terminator
|
| };
|
| - EXPECT_FALSE(Munger.runTestForAssembly(
|
| - "Record too long", RecordTooLong, array_lengthof(RecordTooLong)));
|
| + EXPECT_FALSE(Munger.runTestForAssembly(ARRAY(RecordTooLong)));
|
| EXPECT_EQ(
|
| "Error(37:6): Vector record should contain two arguments. Found: 3\n",
|
| Munger.getLinesWithPrefix(ErrorPrefix));
|
| @@ -488,11 +448,10 @@ TEST(NaClObjDumpTypesTest, TestI1VectorRecord) {
|
|
|
| const uint64_t ReplaceIndex = 4;
|
|
|
| - NaClObjDumpMunger Munger(BitcodeRecords,
|
| - array_lengthof(BitcodeRecords), Terminator);
|
| + NaClObjDumpMunger Munger(ARRAY_TERM(BitcodeRecords));
|
|
|
| // Test that we accept <4 x i1>.
|
| - EXPECT_TRUE(Munger.runTestForAssembly("Type <4 x i1>"));
|
| + EXPECT_TRUE(Munger.runTestForAssembly());
|
| EXPECT_EQ(
|
| "module { // BlockID = 8\n"
|
| " types { // BlockID = 17\n"
|
| @@ -507,8 +466,7 @@ TEST(NaClObjDumpTypesTest, TestI1VectorRecord) {
|
| const uint64_t Vector1xI1[] = {
|
| ReplaceIndex, NaClMungedBitcode::Replace, 3, 12, 1, 0, Terminator
|
| };
|
| - EXPECT_FALSE(Munger.runTestForAssembly(
|
| - "Type <1 x i1>", Vector1xI1, array_lengthof(Vector1xI1)));
|
| + EXPECT_FALSE(Munger.runTestForAssembly(ARRAY(Vector1xI1)));
|
| EXPECT_EQ(
|
| "Error(37:0): Vector type <1 x i1> not allowed.\n",
|
| Munger.getLinesWithPrefix(ErrorPrefix));
|
| @@ -520,8 +478,7 @@ TEST(NaClObjDumpTypesTest, TestI1VectorRecord) {
|
| const uint64_t Vector2xI1[] = {
|
| ReplaceIndex, NaClMungedBitcode::Replace, 3, 12, 2, 0, Terminator
|
| };
|
| - EXPECT_FALSE(Munger.runTestForAssembly(
|
| - "Type <2 x i1>", Vector2xI1, array_lengthof(Vector2xI1)));
|
| + EXPECT_FALSE(Munger.runTestForAssembly(ARRAY(Vector2xI1)));
|
| EXPECT_EQ(
|
| "Error(37:0): Vector type <2 x i1> not allowed.\n",
|
| Munger.getLinesWithPrefix(ErrorPrefix));
|
| @@ -533,8 +490,7 @@ TEST(NaClObjDumpTypesTest, TestI1VectorRecord) {
|
| const uint64_t Vector3xI1[] = {
|
| ReplaceIndex, NaClMungedBitcode::Replace, 3, 12, 3, 0, Terminator
|
| };
|
| - EXPECT_FALSE(Munger.runTestForAssembly(
|
| - "Type <3 x i1>", Vector3xI1, array_lengthof(Vector3xI1)));
|
| + EXPECT_FALSE(Munger.runTestForAssembly(ARRAY(Vector3xI1)));
|
| EXPECT_EQ(
|
| "Error(37:0): Vector type <3 x i1> not allowed.\n",
|
| Munger.getLinesWithPrefix(ErrorPrefix));
|
| @@ -546,22 +502,19 @@ TEST(NaClObjDumpTypesTest, TestI1VectorRecord) {
|
| const uint64_t Vector8xI1[] = {
|
| ReplaceIndex, NaClMungedBitcode::Replace, 3, 12, 8, 0, Terminator
|
| };
|
| - EXPECT_TRUE(Munger.runTest(
|
| - "Type <8 x i1>", Vector8xI1, array_lengthof(Vector8xI1)));
|
| + EXPECT_TRUE(Munger.runTest(ARRAY(Vector8xI1)));
|
|
|
| // Test that we handle <16 x i1>.
|
| const uint64_t Vector16xI1[] = {
|
| ReplaceIndex, NaClMungedBitcode::Replace, 3, 12, 16, 0, Terminator
|
| };
|
| - EXPECT_TRUE(Munger.runTest(
|
| - "Type <16 x i1>", Vector16xI1, array_lengthof(Vector16xI1)));
|
| + EXPECT_TRUE(Munger.runTest(ARRAY(Vector16xI1)));
|
|
|
| // Test that we reject <32 x i1>.
|
| const uint64_t Vector32xI1[] = {
|
| ReplaceIndex, NaClMungedBitcode::Replace, 3, 12, 32, 0, Terminator
|
| };
|
| - EXPECT_FALSE(Munger.runTestForAssembly(
|
| - "Type <32 x i1>", Vector32xI1, array_lengthof(Vector32xI1)));
|
| + EXPECT_FALSE(Munger.runTestForAssembly(ARRAY(Vector32xI1)));
|
| EXPECT_EQ(
|
| "Error(37:0): Vector type <32 x i1> not allowed.\n",
|
| Munger.getLinesWithPrefix(ErrorPrefix));
|
| @@ -584,11 +537,10 @@ TEST(NaClObjDumpTypesTest, TestI8VectorRecord) {
|
|
|
| const uint64_t ReplaceIndex = 4;
|
|
|
| - NaClObjDumpMunger Munger(BitcodeRecords,
|
| - array_lengthof(BitcodeRecords), Terminator);
|
| + NaClObjDumpMunger Munger(ARRAY_TERM(BitcodeRecords));
|
|
|
| // Test that we accept <16 x i8>.
|
| - EXPECT_TRUE(Munger.runTestForAssembly("Type <16 x i8>"));
|
| + EXPECT_TRUE(Munger.runTestForAssembly());
|
| EXPECT_EQ(
|
| "module { // BlockID = 8\n"
|
| " types { // BlockID = 17\n"
|
| @@ -603,8 +555,7 @@ TEST(NaClObjDumpTypesTest, TestI8VectorRecord) {
|
| const uint64_t Vector1xI8[] = {
|
| ReplaceIndex, NaClMungedBitcode::Replace, 3, 12, 1, 0, Terminator
|
| };
|
| - EXPECT_FALSE(Munger.runTestForAssembly(
|
| - "Type <1 x i8>", Vector1xI8, array_lengthof(Vector1xI8)));
|
| + EXPECT_FALSE(Munger.runTestForAssembly(ARRAY(Vector1xI8)));
|
| EXPECT_EQ(
|
| "Error(37:0): Vector type <1 x i8> not allowed.\n",
|
| Munger.getLinesWithPrefix(ErrorPrefix));
|
| @@ -616,8 +567,7 @@ TEST(NaClObjDumpTypesTest, TestI8VectorRecord) {
|
| const uint64_t Vector2xI8[] = {
|
| ReplaceIndex, NaClMungedBitcode::Replace, 3, 12, 2, 0, Terminator
|
| };
|
| - EXPECT_FALSE(Munger.runTestForAssembly(
|
| - "Type <2 x i8>", Vector2xI8, array_lengthof(Vector2xI8)));
|
| + EXPECT_FALSE(Munger.runTestForAssembly(ARRAY(Vector2xI8)));
|
| EXPECT_EQ(
|
| "Error(37:0): Vector type <2 x i8> not allowed.\n",
|
| Munger.getLinesWithPrefix(ErrorPrefix));
|
| @@ -629,8 +579,7 @@ TEST(NaClObjDumpTypesTest, TestI8VectorRecord) {
|
| const uint64_t Vector3xI8[] = {
|
| ReplaceIndex, NaClMungedBitcode::Replace, 3, 12, 3, 0, Terminator
|
| };
|
| - EXPECT_FALSE(Munger.runTestForAssembly(
|
| - "Type <3 x i8>", Vector3xI8, array_lengthof(Vector3xI8)));
|
| + EXPECT_FALSE(Munger.runTestForAssembly(ARRAY(Vector3xI8)));
|
| EXPECT_EQ(
|
| "Error(37:0): Vector type <3 x i8> not allowed.\n",
|
| Munger.getLinesWithPrefix(ErrorPrefix));
|
| @@ -642,8 +591,7 @@ TEST(NaClObjDumpTypesTest, TestI8VectorRecord) {
|
| const uint64_t Vector4xI8[] = {
|
| ReplaceIndex, NaClMungedBitcode::Replace, 3, 12, 4, 0, Terminator
|
| };
|
| - EXPECT_FALSE(Munger.runTestForAssembly(
|
| - "Type <4 x i8>", Vector4xI8, array_lengthof(Vector4xI8)));
|
| + EXPECT_FALSE(Munger.runTestForAssembly(ARRAY(Vector4xI8)));
|
| EXPECT_EQ(
|
| "Error(37:0): Vector type <4 x i8> not allowed.\n",
|
| Munger.getLinesWithPrefix(ErrorPrefix));
|
| @@ -655,8 +603,7 @@ TEST(NaClObjDumpTypesTest, TestI8VectorRecord) {
|
| const uint64_t Vector8xI8[] = {
|
| ReplaceIndex, NaClMungedBitcode::Replace, 3, 12, 8, 0, Terminator
|
| };
|
| - EXPECT_FALSE(Munger.runTestForAssembly(
|
| - "Type <8 x i8>", Vector8xI8, array_lengthof(Vector8xI8)));
|
| + EXPECT_FALSE(Munger.runTestForAssembly(ARRAY(Vector8xI8)));
|
| EXPECT_EQ(
|
| "Error(37:0): Vector type <8 x i8> not allowed.\n",
|
| Munger.getLinesWithPrefix(ErrorPrefix));
|
| @@ -668,8 +615,7 @@ TEST(NaClObjDumpTypesTest, TestI8VectorRecord) {
|
| const uint64_t Vector32xI8[] = {
|
| ReplaceIndex, NaClMungedBitcode::Replace, 3, 12, 32, 0, Terminator
|
| };
|
| - EXPECT_FALSE(Munger.runTestForAssembly(
|
| - "Type <32 x i8>", Vector32xI8, array_lengthof(Vector32xI8)));
|
| + EXPECT_FALSE(Munger.runTestForAssembly(ARRAY(Vector32xI8)));
|
| EXPECT_EQ(
|
| "Error(37:0): Vector type <32 x i8> not allowed.\n",
|
| Munger.getLinesWithPrefix(ErrorPrefix));
|
| @@ -692,11 +638,10 @@ TEST(NaClObjDumpTypesTest, TestI16VectorRecord) {
|
|
|
| const uint64_t ReplaceIndex = 4;
|
|
|
| - NaClObjDumpMunger Munger(BitcodeRecords,
|
| - array_lengthof(BitcodeRecords), Terminator);
|
| + NaClObjDumpMunger Munger(ARRAY_TERM(BitcodeRecords));
|
|
|
| // Test that we accept <8 x i16>.
|
| - EXPECT_TRUE(Munger.runTestForAssembly("Type <16 x i16>"));
|
| + EXPECT_TRUE(Munger.runTestForAssembly());
|
| EXPECT_EQ(
|
| "module { // BlockID = 8\n"
|
| " types { // BlockID = 17\n"
|
| @@ -711,8 +656,7 @@ TEST(NaClObjDumpTypesTest, TestI16VectorRecord) {
|
| const uint64_t Vector1xI16[] = {
|
| ReplaceIndex, NaClMungedBitcode::Replace, 3, 12, 1, 0, Terminator
|
| };
|
| - EXPECT_FALSE(Munger.runTestForAssembly(
|
| - "Type <1 x i16>", Vector1xI16, array_lengthof(Vector1xI16)));
|
| + EXPECT_FALSE(Munger.runTestForAssembly(ARRAY(Vector1xI16)));
|
| EXPECT_EQ(
|
| "Error(37:0): Vector type <1 x i16> not allowed.\n",
|
| Munger.getLinesWithPrefix(ErrorPrefix));
|
| @@ -724,8 +668,7 @@ TEST(NaClObjDumpTypesTest, TestI16VectorRecord) {
|
| const uint64_t Vector2xI16[] = {
|
| ReplaceIndex, NaClMungedBitcode::Replace, 3, 12, 2, 0, Terminator
|
| };
|
| - EXPECT_FALSE(Munger.runTestForAssembly(
|
| - "Type <2 x i16>", Vector2xI16, array_lengthof(Vector2xI16)));
|
| + EXPECT_FALSE(Munger.runTestForAssembly(ARRAY(Vector2xI16)));
|
| EXPECT_EQ(
|
| "Error(37:0): Vector type <2 x i16> not allowed.\n",
|
| Munger.getLinesWithPrefix(ErrorPrefix));
|
| @@ -737,8 +680,7 @@ TEST(NaClObjDumpTypesTest, TestI16VectorRecord) {
|
| const uint64_t Vector3xI16[] = {
|
| ReplaceIndex, NaClMungedBitcode::Replace, 3, 12, 3, 0, Terminator
|
| };
|
| - EXPECT_FALSE(Munger.runTestForAssembly(
|
| - "Type <3 x i16>", Vector3xI16, array_lengthof(Vector3xI16)));
|
| + EXPECT_FALSE(Munger.runTestForAssembly(ARRAY(Vector3xI16)));
|
| EXPECT_EQ(
|
| "Error(37:0): Vector type <3 x i16> not allowed.\n",
|
| Munger.getLinesWithPrefix(ErrorPrefix));
|
| @@ -750,8 +692,7 @@ TEST(NaClObjDumpTypesTest, TestI16VectorRecord) {
|
| const uint64_t Vector4xI16[] = {
|
| ReplaceIndex, NaClMungedBitcode::Replace, 3, 12, 4, 0, Terminator
|
| };
|
| - EXPECT_FALSE(Munger.runTestForAssembly(
|
| - "Type <4 x i16>", Vector4xI16, array_lengthof(Vector4xI16)));
|
| + EXPECT_FALSE(Munger.runTestForAssembly(ARRAY(Vector4xI16)));
|
| EXPECT_EQ(
|
| "Error(37:0): Vector type <4 x i16> not allowed.\n",
|
| Munger.getLinesWithPrefix(ErrorPrefix));
|
| @@ -763,8 +704,7 @@ TEST(NaClObjDumpTypesTest, TestI16VectorRecord) {
|
| const uint64_t Vector16xI16[] = {
|
| ReplaceIndex, NaClMungedBitcode::Replace, 3, 12, 16, 0, Terminator
|
| };
|
| - EXPECT_FALSE(Munger.runTestForAssembly(
|
| - "Type <16 x i16>", Vector16xI16, array_lengthof(Vector16xI16)));
|
| + EXPECT_FALSE(Munger.runTestForAssembly(ARRAY(Vector16xI16)));
|
| EXPECT_EQ(
|
| "Error(37:0): Vector type <16 x i16> not allowed.\n",
|
| Munger.getLinesWithPrefix(ErrorPrefix));
|
| @@ -776,8 +716,7 @@ TEST(NaClObjDumpTypesTest, TestI16VectorRecord) {
|
| const uint64_t Vector32xI16[] = {
|
| ReplaceIndex, NaClMungedBitcode::Replace, 3, 12, 32, 0, Terminator
|
| };
|
| - EXPECT_FALSE(Munger.runTestForAssembly(
|
| - "Type <32 x i16>", Vector32xI16, array_lengthof(Vector32xI16)));
|
| + EXPECT_FALSE(Munger.runTestForAssembly(ARRAY(Vector32xI16)));
|
| EXPECT_EQ(
|
| "Error(37:0): Vector type <32 x i16> not allowed.\n",
|
| Munger.getLinesWithPrefix(ErrorPrefix));
|
| @@ -800,11 +739,10 @@ TEST(NaClObjDumpTypesTest, TestI32VectorRecord) {
|
|
|
| const uint64_t ReplaceIndex = 4;
|
|
|
| - NaClObjDumpMunger Munger(BitcodeRecords,
|
| - array_lengthof(BitcodeRecords), Terminator);
|
| + NaClObjDumpMunger Munger(ARRAY_TERM(BitcodeRecords));
|
|
|
| // Test that we accept <4 x i32>.
|
| - EXPECT_TRUE(Munger.runTestForAssembly("Type <4 x i32>"));
|
| + EXPECT_TRUE(Munger.runTestForAssembly());
|
| EXPECT_EQ(
|
| "module { // BlockID = 8\n"
|
| " types { // BlockID = 17\n"
|
| @@ -819,8 +757,7 @@ TEST(NaClObjDumpTypesTest, TestI32VectorRecord) {
|
| const uint64_t Vector1xI32[] = {
|
| ReplaceIndex, NaClMungedBitcode::Replace, 3, 12, 1, 0, Terminator
|
| };
|
| - EXPECT_FALSE(Munger.runTestForAssembly(
|
| - "Type <1 x i32>", Vector1xI32, array_lengthof(Vector1xI32)));
|
| + EXPECT_FALSE(Munger.runTestForAssembly(ARRAY(Vector1xI32)));
|
| EXPECT_EQ(
|
| "Error(37:6): Vector type <1 x i32> not allowed.\n",
|
| Munger.getLinesWithPrefix(ErrorPrefix));
|
| @@ -832,8 +769,7 @@ TEST(NaClObjDumpTypesTest, TestI32VectorRecord) {
|
| const uint64_t Vector2xI32[] = {
|
| ReplaceIndex, NaClMungedBitcode::Replace, 3, 12, 2, 0, Terminator
|
| };
|
| - EXPECT_FALSE(Munger.runTestForAssembly(
|
| - "Type <2 x i32>", Vector2xI32, array_lengthof(Vector2xI32)));
|
| + EXPECT_FALSE(Munger.runTestForAssembly(ARRAY(Vector2xI32)));
|
| EXPECT_EQ(
|
| "Error(37:6): Vector type <2 x i32> not allowed.\n",
|
| Munger.getLinesWithPrefix(ErrorPrefix));
|
| @@ -845,8 +781,7 @@ TEST(NaClObjDumpTypesTest, TestI32VectorRecord) {
|
| const uint64_t Vector3xI32[] = {
|
| ReplaceIndex, NaClMungedBitcode::Replace, 3, 12, 3, 0, Terminator
|
| };
|
| - EXPECT_FALSE(Munger.runTestForAssembly(
|
| - "Type <3 x i32>", Vector3xI32, array_lengthof(Vector3xI32)));
|
| + EXPECT_FALSE(Munger.runTestForAssembly(ARRAY(Vector3xI32)));
|
| EXPECT_EQ(
|
| "Error(37:6): Vector type <3 x i32> not allowed.\n",
|
| Munger.getLinesWithPrefix(ErrorPrefix));
|
| @@ -858,8 +793,7 @@ TEST(NaClObjDumpTypesTest, TestI32VectorRecord) {
|
| const uint64_t Vector8xI32[] = {
|
| ReplaceIndex, NaClMungedBitcode::Replace, 3, 12, 8, 0, Terminator
|
| };
|
| - EXPECT_FALSE(Munger.runTestForAssembly(
|
| - "Type <8 x i32>", Vector8xI32, array_lengthof(Vector8xI32)));
|
| + EXPECT_FALSE(Munger.runTestForAssembly(ARRAY(Vector8xI32)));
|
| EXPECT_EQ(
|
| "Error(37:6): Vector type <8 x i32> not allowed.\n",
|
| Munger.getLinesWithPrefix(ErrorPrefix));
|
| @@ -871,8 +805,7 @@ TEST(NaClObjDumpTypesTest, TestI32VectorRecord) {
|
| const uint64_t Vector16xI32[] = {
|
| ReplaceIndex, NaClMungedBitcode::Replace, 3, 12, 16, 0, Terminator
|
| };
|
| - EXPECT_FALSE(Munger.runTestForAssembly(
|
| - "Type <16 x i32>", Vector16xI32, array_lengthof(Vector16xI32)));
|
| + EXPECT_FALSE(Munger.runTestForAssembly(ARRAY(Vector16xI32)));
|
| EXPECT_EQ(
|
| "Error(37:6): Vector type <16 x i32> not allowed.\n",
|
| Munger.getLinesWithPrefix(ErrorPrefix));
|
| @@ -884,8 +817,7 @@ TEST(NaClObjDumpTypesTest, TestI32VectorRecord) {
|
| const uint64_t Vector32xI32[] = {
|
| ReplaceIndex, NaClMungedBitcode::Replace, 3, 12, 32, 0, Terminator
|
| };
|
| - EXPECT_FALSE(Munger.runTestForAssembly(
|
| - "Type <32 x i32>", Vector32xI32, array_lengthof(Vector32xI32)));
|
| + EXPECT_FALSE(Munger.runTestForAssembly(ARRAY(Vector32xI32)));
|
| EXPECT_EQ(
|
| "Error(37:6): Vector type <32 x i32> not allowed.\n",
|
| Munger.getLinesWithPrefix(ErrorPrefix));
|
| @@ -908,11 +840,10 @@ TEST(NaClObjDumpTypesTest, TestI64VectorRecord) {
|
|
|
| const uint64_t ReplaceIndex = 4;
|
|
|
| - NaClObjDumpMunger Munger(BitcodeRecords,
|
| - array_lengthof(BitcodeRecords), Terminator);
|
| + NaClObjDumpMunger Munger(ARRAY_TERM(BitcodeRecords));
|
|
|
| // Test that we reject <1 x i64>.
|
| - EXPECT_FALSE(Munger.runTestForAssembly("Type <1 x i64>"));
|
| + EXPECT_FALSE(Munger.runTestForAssembly());
|
| EXPECT_EQ(
|
| "module { // BlockID = 8\n"
|
| " types { // BlockID = 17\n"
|
| @@ -928,8 +859,7 @@ TEST(NaClObjDumpTypesTest, TestI64VectorRecord) {
|
| const uint64_t Vector2xI64[] = {
|
| ReplaceIndex, NaClMungedBitcode::Replace, 3, 12, 2, 0, Terminator
|
| };
|
| - EXPECT_FALSE(Munger.runTestForAssembly(
|
| - "Type <2 x i64>", Vector2xI64, array_lengthof(Vector2xI64)));
|
| + EXPECT_FALSE(Munger.runTestForAssembly(ARRAY(Vector2xI64)));
|
| EXPECT_EQ(
|
| "Error(37:6): Vector type <2 x i64> not allowed.\n",
|
| Munger.getLinesWithPrefix(ErrorPrefix));
|
| @@ -941,8 +871,7 @@ TEST(NaClObjDumpTypesTest, TestI64VectorRecord) {
|
| const uint64_t Vector3xI64[] = {
|
| ReplaceIndex, NaClMungedBitcode::Replace, 3, 12, 3, 0, Terminator
|
| };
|
| - EXPECT_FALSE(Munger.runTestForAssembly(
|
| - "Type <3 x i64>", Vector3xI64, array_lengthof(Vector3xI64)));
|
| + EXPECT_FALSE(Munger.runTestForAssembly(ARRAY(Vector3xI64)));
|
| EXPECT_EQ(
|
| "Error(37:6): Vector type <3 x i64> not allowed.\n",
|
| Munger.getLinesWithPrefix(ErrorPrefix));
|
| @@ -954,8 +883,7 @@ TEST(NaClObjDumpTypesTest, TestI64VectorRecord) {
|
| const uint64_t Vector4xI64[] = {
|
| ReplaceIndex, NaClMungedBitcode::Replace, 3, 12, 4, 0, Terminator
|
| };
|
| - EXPECT_FALSE(Munger.runTestForAssembly(
|
| - "Type <4 x i64>", Vector4xI64, array_lengthof(Vector4xI64)));
|
| + EXPECT_FALSE(Munger.runTestForAssembly(ARRAY(Vector4xI64)));
|
| EXPECT_EQ(
|
| "Error(37:6): Vector type <4 x i64> not allowed.\n",
|
| Munger.getLinesWithPrefix(ErrorPrefix));
|
| @@ -967,8 +895,7 @@ TEST(NaClObjDumpTypesTest, TestI64VectorRecord) {
|
| const uint64_t Vector8xI64[] = {
|
| ReplaceIndex, NaClMungedBitcode::Replace, 3, 12, 8, 0, Terminator
|
| };
|
| - EXPECT_FALSE(Munger.runTestForAssembly(
|
| - "Type <8 x i64>", Vector8xI64, array_lengthof(Vector8xI64)));
|
| + EXPECT_FALSE(Munger.runTestForAssembly(ARRAY(Vector8xI64)));
|
| EXPECT_EQ(
|
| "Error(37:6): Vector type <8 x i64> not allowed.\n",
|
| Munger.getLinesWithPrefix(ErrorPrefix));
|
| @@ -980,8 +907,7 @@ TEST(NaClObjDumpTypesTest, TestI64VectorRecord) {
|
| const uint64_t Vector16xI64[] = {
|
| ReplaceIndex, NaClMungedBitcode::Replace, 3, 12, 16, 0, Terminator
|
| };
|
| - EXPECT_FALSE(Munger.runTestForAssembly(
|
| - "Type <16 x i64>", Vector16xI64, array_lengthof(Vector16xI64)));
|
| + EXPECT_FALSE(Munger.runTestForAssembly(ARRAY(Vector16xI64)));
|
| EXPECT_EQ(
|
| "Error(37:6): Vector type <16 x i64> not allowed.\n",
|
| Munger.getLinesWithPrefix(ErrorPrefix));
|
| @@ -993,8 +919,7 @@ TEST(NaClObjDumpTypesTest, TestI64VectorRecord) {
|
| const uint64_t Vector32xI64[] = {
|
| ReplaceIndex, NaClMungedBitcode::Replace, 3, 12, 32, 0, Terminator
|
| };
|
| - EXPECT_FALSE(Munger.runTestForAssembly(
|
| - "Type <32 x i64>", Vector32xI64, array_lengthof(Vector32xI64)));
|
| + EXPECT_FALSE(Munger.runTestForAssembly(ARRAY(Vector32xI64)));
|
| EXPECT_EQ(
|
| "Error(37:6): Vector type <32 x i64> not allowed.\n",
|
| Munger.getLinesWithPrefix(ErrorPrefix));
|
| @@ -1017,11 +942,10 @@ TEST(NaClObjDumpTypesTest, TestFloatVectorRecord) {
|
|
|
| const uint64_t ReplaceIndex = 4;
|
|
|
| - NaClObjDumpMunger Munger(BitcodeRecords,
|
| - array_lengthof(BitcodeRecords), Terminator);
|
| + NaClObjDumpMunger Munger(ARRAY_TERM(BitcodeRecords));
|
|
|
| // Test that we accept <4 x float>.
|
| - EXPECT_TRUE(Munger.runTestForAssembly("Type <4 x float>"));
|
| + EXPECT_TRUE(Munger.runTestForAssembly());
|
| EXPECT_EQ(
|
| "module { // BlockID = 8\n"
|
| " types { // BlockID = 17\n"
|
| @@ -1036,8 +960,7 @@ TEST(NaClObjDumpTypesTest, TestFloatVectorRecord) {
|
| const uint64_t Vector1xFloat[] = {
|
| ReplaceIndex, NaClMungedBitcode::Replace, 3, 12, 1, 0, Terminator
|
| };
|
| - EXPECT_FALSE(Munger.runTestForAssembly(
|
| - "Type <1 x float>", Vector1xFloat, array_lengthof(Vector1xFloat)));
|
| + EXPECT_FALSE(Munger.runTestForAssembly(ARRAY(Vector1xFloat)));
|
| EXPECT_EQ(
|
| "Error(36:2): Vector type <1 x float> not allowed.\n",
|
| Munger.getLinesWithPrefix(ErrorPrefix));
|
| @@ -1049,8 +972,7 @@ TEST(NaClObjDumpTypesTest, TestFloatVectorRecord) {
|
| const uint64_t Vector2xFloat[] = {
|
| ReplaceIndex, NaClMungedBitcode::Replace, 3, 12, 2, 0, Terminator
|
| };
|
| - EXPECT_FALSE(Munger.runTestForAssembly(
|
| - "Type <2 x float>", Vector2xFloat, array_lengthof(Vector2xFloat)));
|
| + EXPECT_FALSE(Munger.runTestForAssembly(ARRAY(Vector2xFloat)));
|
| EXPECT_EQ(
|
| "Error(36:2): Vector type <2 x float> not allowed.\n",
|
| Munger.getLinesWithPrefix(ErrorPrefix));
|
| @@ -1062,8 +984,7 @@ TEST(NaClObjDumpTypesTest, TestFloatVectorRecord) {
|
| const uint64_t Vector3xFloat[] = {
|
| ReplaceIndex, NaClMungedBitcode::Replace, 3, 12, 3, 0, Terminator
|
| };
|
| - EXPECT_FALSE(Munger.runTestForAssembly(
|
| - "Type <3 x float>", Vector3xFloat, array_lengthof(Vector3xFloat)));
|
| + EXPECT_FALSE(Munger.runTestForAssembly(ARRAY(Vector3xFloat)));
|
| EXPECT_EQ(
|
| "Error(36:2): Vector type <3 x float> not allowed.\n",
|
| Munger.getLinesWithPrefix(ErrorPrefix));
|
| @@ -1075,8 +996,7 @@ TEST(NaClObjDumpTypesTest, TestFloatVectorRecord) {
|
| const uint64_t Vector8xFloat[] = {
|
| ReplaceIndex, NaClMungedBitcode::Replace, 3, 12, 8, 0, Terminator
|
| };
|
| - EXPECT_FALSE(Munger.runTestForAssembly(
|
| - "Type <8 x float>", Vector8xFloat, array_lengthof(Vector8xFloat)));
|
| + EXPECT_FALSE(Munger.runTestForAssembly(ARRAY(Vector8xFloat)));
|
| EXPECT_EQ(
|
| "Error(36:2): Vector type <8 x float> not allowed.\n",
|
| Munger.getLinesWithPrefix(ErrorPrefix));
|
| @@ -1099,11 +1019,10 @@ TEST(NaClObjDumpTypesTest, TestDoubleVectorRecord) {
|
|
|
| const uint64_t ReplaceIndex = 4;
|
|
|
| - NaClObjDumpMunger Munger(BitcodeRecords,
|
| - array_lengthof(BitcodeRecords), Terminator);
|
| + NaClObjDumpMunger Munger(ARRAY_TERM(BitcodeRecords));
|
|
|
| // Test that we reject <4 x double>.
|
| - EXPECT_FALSE(Munger.runTestForAssembly("Type <4 x double>"));
|
| + EXPECT_FALSE(Munger.runTestForAssembly());
|
| EXPECT_EQ(
|
| "module { // BlockID = 8\n"
|
| " types { // BlockID = 17\n"
|
| @@ -1119,8 +1038,7 @@ TEST(NaClObjDumpTypesTest, TestDoubleVectorRecord) {
|
| const uint64_t Vector1xDouble[] = {
|
| ReplaceIndex, NaClMungedBitcode::Replace, 3, 12, 1, 0, Terminator
|
| };
|
| - EXPECT_FALSE(Munger.runTestForAssembly(
|
| - "Type <1 x double>", Vector1xDouble, array_lengthof(Vector1xDouble)));
|
| + EXPECT_FALSE(Munger.runTestForAssembly(ARRAY(Vector1xDouble)));
|
| EXPECT_EQ(
|
| "Error(36:2): Vector type <1 x double> not allowed.\n",
|
| Munger.getLinesWithPrefix(ErrorPrefix));
|
| @@ -1132,8 +1050,7 @@ TEST(NaClObjDumpTypesTest, TestDoubleVectorRecord) {
|
| const uint64_t Vector2xDouble[] = {
|
| ReplaceIndex, NaClMungedBitcode::Replace, 3, 12, 2, 0, Terminator
|
| };
|
| - EXPECT_FALSE(Munger.runTestForAssembly(
|
| - "Type <2 x double>", Vector2xDouble, array_lengthof(Vector2xDouble)));
|
| + EXPECT_FALSE(Munger.runTestForAssembly(ARRAY(Vector2xDouble)));
|
| EXPECT_EQ(
|
| "Error(36:2): Vector type <2 x double> not allowed.\n",
|
| Munger.getLinesWithPrefix(ErrorPrefix));
|
| @@ -1145,8 +1062,7 @@ TEST(NaClObjDumpTypesTest, TestDoubleVectorRecord) {
|
| const uint64_t Vector3xDouble[] = {
|
| ReplaceIndex, NaClMungedBitcode::Replace, 3, 12, 4, 0, Terminator
|
| };
|
| - EXPECT_FALSE(Munger.runTestForAssembly(
|
| - "Type <4 x double>", Vector3xDouble, array_lengthof(Vector3xDouble)));
|
| + EXPECT_FALSE(Munger.runTestForAssembly(ARRAY(Vector3xDouble)));
|
| EXPECT_EQ(
|
| "Error(36:2): Vector type <4 x double> not allowed.\n",
|
| Munger.getLinesWithPrefix(ErrorPrefix));
|
| @@ -1158,8 +1074,7 @@ TEST(NaClObjDumpTypesTest, TestDoubleVectorRecord) {
|
| const uint64_t Vector8xDouble[] = {
|
| ReplaceIndex, NaClMungedBitcode::Replace, 3, 12, 8, 0, Terminator
|
| };
|
| - EXPECT_FALSE(Munger.runTestForAssembly(
|
| - "Type <8 x double>", Vector8xDouble, array_lengthof(Vector8xDouble)));
|
| + EXPECT_FALSE(Munger.runTestForAssembly(ARRAY(Vector8xDouble)));
|
| EXPECT_EQ(
|
| "Error(36:2): Vector type <8 x double> not allowed.\n",
|
| Munger.getLinesWithPrefix(ErrorPrefix));
|
| @@ -1179,9 +1094,8 @@ TEST(NaClObjDumpTypesTest, TestVoidVectorRecord) {
|
| 0, 65534, Terminator,
|
| 0, 65534, Terminator
|
| };
|
| - NaClObjDumpMunger Munger(BitcodeRecords,
|
| - array_lengthof(BitcodeRecords), Terminator);
|
| - EXPECT_FALSE(Munger.runTestForAssembly("Type <4 x void>"));
|
| + NaClObjDumpMunger Munger(ARRAY_TERM(BitcodeRecords));
|
| + EXPECT_FALSE(Munger.runTestForAssembly());
|
| EXPECT_EQ(
|
| "module { // BlockID = 8\n"
|
| " types { // BlockID = 17\n"
|
| @@ -1207,9 +1121,8 @@ TEST(NaClObjDumpTypesTest, TestNestedVectorRecord) {
|
| 0, 65534, Terminator,
|
| 0, 65534, Terminator
|
| };
|
| - NaClObjDumpMunger Munger(BitcodeRecords,
|
| - array_lengthof(BitcodeRecords), Terminator);
|
| - EXPECT_FALSE(Munger.runTestForAssembly("Type <4 x <4 x float>>"));
|
| + NaClObjDumpMunger Munger(ARRAY_TERM(BitcodeRecords));
|
| + EXPECT_FALSE(Munger.runTestForAssembly());
|
| EXPECT_EQ(
|
| "module { // BlockID = 8\n"
|
| " types { // BlockID = 17\n"
|
| @@ -1244,11 +1157,10 @@ TEST(NaClObjDumpTypesTest, TestFunctionRecord) {
|
| const uint64_t TypeCountIndex = 2;
|
| const uint64_t ReplaceIndex = 9;
|
|
|
| - NaClObjDumpMunger Munger(BitcodeRecords,
|
| - array_lengthof(BitcodeRecords), Terminator);
|
| + NaClObjDumpMunger Munger(ARRAY_TERM(BitcodeRecords));
|
|
|
| // Test void() signature.
|
| - EXPECT_TRUE(Munger.runTestForAssembly("Type void()"));
|
| + EXPECT_TRUE(Munger.runTestForAssembly());
|
| EXPECT_EQ(
|
| "module { // BlockID = 8\n"
|
| " types { // BlockID = 17\n"
|
| @@ -1270,9 +1182,7 @@ TEST(NaClObjDumpTypesTest, TestFunctionRecord) {
|
| const uint64_t UsesIntegerTypes[] = {
|
| ReplaceIndex, NaClMungedBitcode::Replace, 3, 21, 0, 1, 2, 1, Terminator
|
| };
|
| - EXPECT_TRUE(Munger.runTestForAssembly(
|
| - "Function record with integer types", UsesIntegerTypes,
|
| - array_lengthof(UsesIntegerTypes)));
|
| + EXPECT_TRUE(Munger.runTestForAssembly(ARRAY(UsesIntegerTypes)));
|
| EXPECT_EQ(
|
| " @t6 = i16 (i32, i16);\n",
|
| Munger.getLinesWithSubstring("@t6"));
|
| @@ -1281,9 +1191,7 @@ TEST(NaClObjDumpTypesTest, TestFunctionRecord) {
|
| const uint64_t UsesFloatingTypes[] = {
|
| ReplaceIndex, NaClMungedBitcode::Replace, 3, 21, 0, 3, 3, 4, Terminator
|
| };
|
| - EXPECT_TRUE(Munger.runTestForAssembly(
|
| - "Function record with floating point types", UsesFloatingTypes,
|
| - array_lengthof(UsesFloatingTypes)));
|
| + EXPECT_TRUE(Munger.runTestForAssembly(ARRAY(UsesFloatingTypes)));
|
| EXPECT_EQ(
|
| " @t6 = float (float, double);\n",
|
| Munger.getLinesWithSubstring("@t6"));
|
| @@ -1292,9 +1200,7 @@ TEST(NaClObjDumpTypesTest, TestFunctionRecord) {
|
| const uint64_t UsesVectorTypes[] = {
|
| ReplaceIndex, NaClMungedBitcode::Replace, 3, 21, 0, 5, 5, Terminator
|
| };
|
| - EXPECT_TRUE(Munger.runTestForAssembly(
|
| - "Function record with vector types", UsesVectorTypes,
|
| - array_lengthof(UsesVectorTypes)));
|
| + EXPECT_TRUE(Munger.runTestForAssembly(ARRAY(UsesVectorTypes)));
|
| EXPECT_EQ(
|
| " @t6 = <4 x i32> (<4 x i32>);\n",
|
| Munger.getLinesWithSubstring("@t6"));
|
| @@ -1303,9 +1209,7 @@ TEST(NaClObjDumpTypesTest, TestFunctionRecord) {
|
| const uint64_t FunctionRecordTooShort[] = {
|
| ReplaceIndex, NaClMungedBitcode::Replace, 3, 21, 0, Terminator
|
| };
|
| - EXPECT_FALSE(Munger.runTestForAssembly(
|
| - "Function record too short", FunctionRecordTooShort,
|
| - array_lengthof(FunctionRecordTooShort)));
|
| + EXPECT_FALSE(Munger.runTestForAssembly(ARRAY(FunctionRecordTooShort)));
|
| EXPECT_EQ(
|
| "Error(48:6): Function record should contain at least 2 arguments. "
|
| "Found: 1\n",
|
| @@ -1318,10 +1222,7 @@ TEST(NaClObjDumpTypesTest, TestFunctionRecord) {
|
| const uint64_t FunctionRecordWithVarArgs[] = {
|
| ReplaceIndex, NaClMungedBitcode::Replace, 3, 21, 1, 0, Terminator
|
| };
|
| - EXPECT_FALSE(
|
| - Munger.runTestForAssembly(
|
| - "Function record with varargs", FunctionRecordWithVarArgs,
|
| - array_lengthof(FunctionRecordWithVarArgs)));
|
| + EXPECT_FALSE(Munger.runTestForAssembly(ARRAY(FunctionRecordWithVarArgs)));
|
| EXPECT_EQ(
|
| "Error(48:6): Functions with variable length arguments is "
|
| "not supported\n",
|
| @@ -1334,9 +1235,7 @@ TEST(NaClObjDumpTypesTest, TestFunctionRecord) {
|
| const uint64_t VoidParamType[] = {
|
| ReplaceIndex, NaClMungedBitcode::Replace, 3, 21, 0, 0, 0, Terminator
|
| };
|
| - EXPECT_FALSE(Munger.runTestForAssembly(
|
| - "Function record with void param type", VoidParamType,
|
| - array_lengthof(VoidParamType)));
|
| + EXPECT_FALSE(Munger.runTestForAssembly(ARRAY(VoidParamType)));
|
| EXPECT_EQ(
|
| "Error(48:6): Invalid type for parameter 1. Found: void. Assuming: i32\n",
|
| Munger.getLinesWithPrefix(ErrorPrefix));
|
| @@ -1349,10 +1248,7 @@ TEST(NaClObjDumpTypesTest, TestFunctionRecord) {
|
| TypeCountIndex, NaClMungedBitcode::Replace, 3, 1, 8, Terminator,
|
| ReplaceIndex, NaClMungedBitcode::AddAfter, 3, 21, 0, 6, Terminator
|
| };
|
| - EXPECT_FALSE(
|
| - Munger.runTestForAssembly(
|
| - "Function record with function return type", FunctionReturnType,
|
| - array_lengthof(FunctionReturnType)));
|
| + EXPECT_FALSE(Munger.runTestForAssembly(ARRAY(FunctionReturnType)));
|
| EXPECT_EQ(
|
| "Error(52:0): Invalid return type. Found: void (). Assuming: i32\n",
|
| Munger.getLinesWithPrefix(ErrorPrefix));
|
| @@ -1368,10 +1264,7 @@ TEST(NaClObjDumpTypesTest, TestFunctionRecord) {
|
| TypeCountIndex, NaClMungedBitcode::Replace, 3, 1, 8, Terminator,
|
| ReplaceIndex, NaClMungedBitcode::AddAfter, 3, 21, 0, 0, 6, Terminator
|
| };
|
| - EXPECT_FALSE(
|
| - Munger.runTestForAssembly(
|
| - "Function record with function param type", FunctionParamType,
|
| - array_lengthof(FunctionParamType)));
|
| + EXPECT_FALSE(Munger.runTestForAssembly(ARRAY(FunctionParamType)));
|
| EXPECT_EQ(
|
| "Error(52:0): Invalid type for parameter 1. Found: void (). "
|
| "Assuming: i32\n",
|
| @@ -1394,9 +1287,8 @@ TEST(NaClObjDumpTypesTest, TestUnknownTypesRecordCode) {
|
| 0, 65534, Terminator,
|
| 0, 65534, Terminator
|
| };
|
| - NaClObjDumpMunger Munger(BitcodeRecords,
|
| - array_lengthof(BitcodeRecords), Terminator);
|
| - EXPECT_FALSE(Munger.runTestForAssembly("Unknown types record code"));
|
| + NaClObjDumpMunger Munger(ARRAY_TERM(BitcodeRecords));
|
| + EXPECT_FALSE(Munger.runTestForAssembly());
|
| EXPECT_EQ(
|
| "module { // BlockID = 8\n"
|
| " types { // BlockID = 17\n"
|
| @@ -1408,4 +1300,4 @@ TEST(NaClObjDumpTypesTest, TestUnknownTypesRecordCode) {
|
| Munger.getTestResults());
|
| }
|
|
|
| -} // End of anonymous namespace.
|
| +} // End of namespace naclmungetest
|
|
|