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

Unified Diff: src/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 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.h
diff --git a/src/BitcodeMunge.h b/src/BitcodeMunge.h
new file mode 100644
index 0000000000000000000000000000000000000000..138a0aded61a6de3e03bfaaea0ad0b0df34c6bd5
--- /dev/null
+++ b/src/BitcodeMunge.h
@@ -0,0 +1,46 @@
+//===- 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 mangler to do this.
Jim Stichnoth 2015/01/05 23:38:14 mangler or munger?
Karl 2015/01/08 21:35:05 mangler => munger
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef SUBZERO_SRC_BITCODEMUNGE_H
+#define SUBZERO_SRC_BITCODEMUNGE_H
+
+#include "llvm/Bitcode/NaCl/NaClBitcodeMunge.h"
+namespace IceTest {
Jim Stichnoth 2015/01/05 23:38:14 Add a blank line above?
Karl 2015/01/08 21:35:05 Done.
+
+// Class to run tests on subzero's bitcode parser. Runs a subzero
Jim Stichnoth 2015/01/05 23:38:14 Capitalize Subzero
Karl 2015/01/08 21:35:05 Done.
+// translation, using a (possibly) editted array of bicode record
Jim Stichnoth 2015/01/05 23:38:14 edited bitcode
Karl 2015/01/08 21:35:05 Done.
+// 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_SRC_BITCODEMUNGE_H

Powered by Google App Engine
This is Rietveld 408576698