Alex Nelson
2011-Oct-19 23:53 UTC
[Libguestfs] [hivex][PATCH 6/8] python: Add unit test for new RLenValue type
Signed-off-by: Alex Nelson <ajnelson at cs.ucsc.edu> --- python/t/120-rlenvalue.py | 35 +++++++++++++++++++++++++++++++++++ 1 files changed, 35 insertions(+), 0 deletions(-) create mode 100644 python/t/120-rlenvalue.py diff --git a/python/t/120-rlenvalue.py b/python/t/120-rlenvalue.py new file mode 100644 index 0000000..1a63697 --- /dev/null +++ b/python/t/120-rlenvalue.py @@ -0,0 +1,35 @@ +# hivex Python bindings +# Copyright (C) 2010 Red Hat Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +# Demonstrate value_data_cell_offset by looking at the value at +# "\$$$\PROTO.HIV\A\A", verified to be at file offset 297680 (0x48ad0) +# of the large test hive. The returned offset and length for this +# value cell should be 0,0, due to the value data being inline. + +import os +import hivex + +srcdir = os.environ["srcdir"] +if not srcdir: + srcdir = "." + +h = hivex.Hivex ("%s/../images/large" % srcdir) +assert h + +r = h.value_data_cell_offset (297680) +assert r[0] == 0 +assert r[1] == 0 -- 1.7.4.4