Add test hive and generator script
authorAlex Nelson <ajnelson@cs.ucsc.edu>
Thu, 8 Dec 2011 02:37:39 +0000 (18:37 -0800)
committerRichard W.M. Jones <rjones@redhat.com>
Thu, 5 Jan 2012 13:35:56 +0000 (13:35 +0000)
Signed-off-by: Alex Nelson <ajnelson@cs.ucsc.edu>
images/mkrlenvalue_test_hive.py [new file with mode: 0755]
images/rlenvalue_test_hive [new file with mode: 0644]

diff --git a/images/mkrlenvalue_test_hive.py b/images/mkrlenvalue_test_hive.py
new file mode 100755 (executable)
index 0000000..827667e
--- /dev/null
@@ -0,0 +1,37 @@
+#!/usr/bin/env python
+import os
+import hivex
+
+srcdir = os.environ.get("srcdir")
+if not srcdir:
+    srcdir = "."
+
+h = hivex.Hivex ("%s/../images/minimal" % srcdir,
+                 write = True)
+assert h
+
+root = h.root ()
+assert root
+
+h.node_add_child (root, "ModerateValueParent")
+
+mvp = h.node_get_child (root, "ModerateValueParent")
+assert mvp
+
+moderate_value = "0123456789ABCDEF"
+
+values = [
+    { "key": "3Bytes", "t": 3, "value": moderate_value[:3] },
+    { "key": "16Bytes", "t": 3, "value": moderate_value },
+    { "key": "30Bytes", "t": 3, "value": (moderate_value*2)[:30] },
+    { "key": "31Bytes", "t": 3, "value": (moderate_value*2)[:31] },
+    { "key": "32Bytes", "t": 3, "value": moderate_value*2 },
+    { "key": "33Bytes", "t": 3, "value": (moderate_value*3)[:33] },
+]
+h.node_set_values (mvp, values)
+
+new_moderate_value = h.node_get_value (mvp, "16Bytes")
+
+assert h.value_value (new_moderate_value)[1] == moderate_value
+
+h.commit ("%s/../images/rlenvalue_test_hive" % srcdir)
diff --git a/images/rlenvalue_test_hive b/images/rlenvalue_test_hive
new file mode 100644 (file)
index 0000000..87cbec5
Binary files /dev/null and b/images/rlenvalue_test_hive differ