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

Unified Diff: unittest/BitcodeMunge.cpp

Issue 800883006: Add ability to test parsing of bitcode records in Subzero. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Fix issues in last patch set. Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « unittest/BitcodeMunge.h ('k') | unittest/IceParseInstsTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: unittest/BitcodeMunge.cpp
diff --git a/unittest/BitcodeMunge.cpp b/unittest/BitcodeMunge.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..a6d283861db4d7e826b290fb474f22a43acb217e
--- /dev/null
+++ b/unittest/BitcodeMunge.cpp
@@ -0,0 +1,40 @@
+//===- 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
« 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