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

Unified Diff: unittest/BitcodeMunge.h

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 | « src/llvm2ice.cpp ('k') | unittest/BitcodeMunge.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: unittest/BitcodeMunge.h
diff --git a/unittest/BitcodeMunge.h b/unittest/BitcodeMunge.h
new file mode 100644
index 0000000000000000000000000000000000000000..ae46ae08a0ff07181567b63c89d0cae8578b0d24
--- /dev/null
+++ b/unittest/BitcodeMunge.h
@@ -0,0 +1,47 @@
+//===- BitcodeMunge.h - 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. Uses NaCl's
+// bitcode munger to do this.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef SUBZERO_UNITTEST_BITCODEMUNGE_H
+#define SUBZERO_UNITTEST_BITCODEMUNGE_H
+
+#include "llvm/Bitcode/NaCl/NaClBitcodeMunge.h"
+
+namespace IceTest {
+
+// Class to run tests on Subzero's bitcode parser. Runs a Subzero
+// translation, using (possibly) edited bitcode record values. For
+// more details on how to represent the input arrays, see
+// NaClBitcodeMunge.h.
+class SubzeroBitcodeMunger : public llvm::NaClBitcodeMunger {
+public:
+ SubzeroBitcodeMunger(const uint64_t Records[], size_t RecordSize,
+ uint64_t RecordTerminator)
+ : llvm::NaClBitcodeMunger(Records, RecordSize, RecordTerminator) {}
+
+ /// Runs PNaClTranslator to translate bitcode records (with defined
+ /// record Munges), and puts output into DumpResults. Returns true
+ /// if parse is successful.
+ bool runTest(const char* TestName, const uint64_t Munges[],
+ size_t MungeSize);
+
+ /// Same as above, but without any edits.
+ bool runTest(const char* TestName) {
+ uint64_t NoMunges[] = {0};
+ return runTest(TestName, NoMunges, 0);
+ }
+};
+
+} // end of namespace IceTest
+
+#endif // SUBZERO_UNITTEST_BITCODEMUNGE_H
« no previous file with comments | « src/llvm2ice.cpp ('k') | unittest/BitcodeMunge.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698