Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(384)

Side by Side Diff: unittest/BitcodeMunge.cpp

Issue 1173353003: Unittest fixes. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Optional runTest() ParseError parameter. Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « unittest/BitcodeMunge.h ('k') | unittest/IceParseInstsTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 //===- BitcodeMunge.cpp - Subzero Bitcode Munger ----------------*- C++ -*-===// 1 //===- BitcodeMunge.cpp - Subzero Bitcode Munger ----------------*- C++ -*-===//
2 // 2 //
3 // The LLVM Compiler Infrastructure 3 // The LLVM Compiler Infrastructure
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 // Test harness for testing malformed bitcode files in Subzero. 10 // Test harness for testing malformed bitcode files in Subzero.
11 // 11 //
12 //===----------------------------------------------------------------------===// 12 //===----------------------------------------------------------------------===//
13 13
14 #include "BitcodeMunge.h" 14 #include "BitcodeMunge.h"
15 #include "IceCfg.h" 15 #include "IceCfg.h"
16 #include "IceClFlags.h" 16 #include "IceClFlags.h"
17 #include "PNaClTranslator.h" 17 #include "PNaClTranslator.h"
18 #include "IceTypes.h" 18 #include "IceTypes.h"
19 19
20 namespace IceTest { 20 namespace IceTest {
21 21
22 void IceTest::SubzeroBitcodeMunger::resetFlags() {
23 Ice::ClFlags::resetClFlags(Flags);
24 resetMungeFlags();
25 }
26
27 void IceTest::SubzeroBitcodeMunger::resetMungeFlags() { 22 void IceTest::SubzeroBitcodeMunger::resetMungeFlags() {
28 Flags.setAllowErrorRecovery(true); 23 Flags.setAllowErrorRecovery(true);
29 Flags.setGenerateUnitTestMessages(true); 24 Flags.setGenerateUnitTestMessages(true);
30 Flags.setOptLevel(Ice::Opt_m1); 25 Flags.setOptLevel(Ice::Opt_m1);
31 Flags.setOutFileType(Ice::FT_Iasm); 26 Flags.setOutFileType(Ice::FT_Iasm);
32 Flags.setTargetArch(Ice::Target_X8632); 27 Flags.setTargetArch(Ice::Target_X8632);
33 Flags.setVerbose(Ice::IceV_Instructions); 28 Flags.setVerbose(Ice::IceV_Instructions);
34 } 29 }
35 30
36 bool IceTest::SubzeroBitcodeMunger::runTest(const uint64_t Munges[], 31 bool IceTest::SubzeroBitcodeMunger::runTest(const uint64_t Munges[],
37 size_t MungeSize) { 32 size_t MungeSize,
33 bool ParseError) {
38 const bool AddHeader = true; 34 const bool AddHeader = true;
39 setupTest(Munges, MungeSize, AddHeader); 35 setupTest(Munges, MungeSize, AddHeader);
40 Ice::GlobalContext Ctx(DumpStream, DumpStream, DumpStream, nullptr, Flags); 36 Ice::GlobalContext Ctx(DumpStream, DumpStream, DumpStream, nullptr, Flags);
41 Ice::PNaClTranslator Translator(&Ctx); 37 Ice::PNaClTranslator Translator(&Ctx);
42 const char *BufferName = "Test"; 38 const char *BufferName = "Test";
39 Flags.setDisableTranslation(ParseError);
43 Translator.translateBuffer(BufferName, MungedInput.get()); 40 Translator.translateBuffer(BufferName, MungedInput.get());
44 41
45 cleanupTest(); 42 cleanupTest();
46 return Translator.getErrorStatus().value() == 0; 43 return Translator.getErrorStatus().value() == 0;
47 } 44 }
48 45
49 } // end of namespace IceTest 46 } // end of namespace IceTest
OLDNEW
« no previous file with comments | « unittest/BitcodeMunge.h ('k') | unittest/IceParseInstsTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698