Closed masatake closed 6 months ago
Hi, nice change. Would it be possible to add a single test file and truncate it, to not make the Git repo too big?
It would also be more interesting if the test file contained actual data, rather than being a just newlt created FS.
It would also be more interesting if the test file contained actual data, rather than being a just newlt created FS.
I could not find a way to do it.
To verify a content of a file, I added the following check to my test case:
self.checkValue(parser, "/group[0]/inode[11]block[0]", b"hello\n" + b'\0' * (bsize - 6))
However, what I got is
ERROR: test_ext2_various_inode_sizes (test_parser.TestParsers.test_ext2_various_inode_sizes)
----------------------------------------------------------------------
Traceback (most recent call last):
File "tests/test_parser.py", line 360, in test_ext2_various_inode_sizes
self.checkValue(parser, "/group[0]/inode[11]block[0]", b"hello\n" + b'\0' * (bsize - 6))
File "tests/test_parser.py", line 44, in checkValue
read = parser[path].value
~~~~~~^^^^^^
File "/home/yamato/var/hachoir/hachoir/field/field.py", line 261, in __getitem__
return self.getField(key, False)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/yamato/var/hachoir/hachoir/field/generic_field_set.py", line 233, in getField
return Field.getField(self, key, const)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/yamato/var/hachoir/hachoir/field/field.py", line 254, in getField
raise MissingField(current, part)
hachoir.field.field.MissingField: Can't get field "inode[11]block[0]" from /group[0]
Though I can see the field:
Is "/group[0]/inode[11]block[0]" is an acceptable field specifier? I wonder whether this is related to #20.
Hi, nice change. Would it be possible to add a single test file and truncate it, to not make the Git repo too big?
I truncated the input files as small as possible. Should I reduce the number of input files?
It would also be more interesting if the test file contained actual data, rather than being a just newlt created FS.
I found I made a mistake when generating the input files. After fixing the input files, I added checks verifying a block that is part of a regular file.
Should I reduce the number of input files?
Yes please. If the code works with 2-3 inode sizes, it should be enough to validate the implementation in tests. We don't write a full kernel driver, it's ok :-)
I reduced the number of test files to three.
Merged, thank you!
the script used for generating test inputs: