blob: a6d283861db4d7e826b290fb474f22a43acb217e [file] [log] [blame]
//===- BitcodeMunge.cpp - Subzero Bitcode Munger ----------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// Test harness for testing malformed bitcode files in Subzero.
//
//===----------------------------------------------------------------------===//
#include "BitcodeMunge.h"
#include "IceCfg.h"
#include "IceClFlags.h"
#include "PNaClTranslator.h"
#include "IceTypes.h"
namespace IceTest {
bool IceTest::SubzeroBitcodeMunger::runTest(
const char* TestName, const uint64_t Munges[], size_t MungeSize) {
const bool AddHeader = true;
setupTest(TestName, Munges, MungeSize, AddHeader);
Ice::ClFlags Flags;
Flags.AllowErrorRecovery = true;
Flags.GenerateUnitTestMessages = true;
Ice::GlobalContext Ctx(DumpStream, DumpStream, nullptr,
Ice::IceV_Instructions, Ice::Target_X8632,
Ice::Opt_m1, "", Flags);
Ice::PNaClTranslator Translator(&Ctx, Flags);
Translator.translateBuffer(TestName, MungedInput.get());
cleanupTest();
return Translator.getErrorStatus() == 0;
}
} // end of namespace IceTest