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

Unified Diff: src/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 nits. 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
Index: src/BitcodeMunge.cpp
diff --git a/src/BitcodeMunge.cpp b/src/BitcodeMunge.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..4d3210f2ba67e995cd40bae622c0969b9454916d
--- /dev/null
+++ b/src/BitcodeMunge.cpp
@@ -0,0 +1,39 @@
+//===- 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) {
+ bool AddHeader = true;
Jim Stichnoth 2015/01/05 23:38:14 const bool should be better
Karl 2015/01/08 21:35:05 Done.
+ setupTest(TestName, Munges, MungeSize, AddHeader);
+
+ Ice::ClFlags Flags;
+ Flags.AllowErrorRecovery = 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

Powered by Google App Engine
This is Rietveld 408576698