Some changes to debugging print statements

This commit is contained in:
A.J. Beamon 2018-05-18 09:33:28 -07:00
parent d03fec825b
commit fd4312454b
2 changed files with 14 additions and 14 deletions

View File

@ -114,9 +114,9 @@ class DirectoryTest(Test):
instructions.push_args(layer)
instructions.push_args(*test_util.with_length(path))
instructions.append('DIRECTORY_OPEN')
# print '%d. Selected %s, dir=%s, has_known_prefix=%s, dir_list_len=%d' \
# % (len(instructions), 'DIRECTORY_OPEN', repr(self.dir_index), False, len(self.dir_list))
self.dir_list.append(self.dir_list[0].add_child(path, default_path, self.root, DirListEntry(True, True, has_known_prefix=False)))
# print('%d. Selected %s, dir=%s, dir_id=%s, has_known_prefix=%s, dir_list_len=%d' \
# % (len(instructions), 'DIRECTORY_OPEN', repr(self.dir_index), self.dir_list[-1].dir_id, False, len(self.dir_list)-1))
instructions.setup_complete()
@ -135,8 +135,8 @@ class DirectoryTest(Test):
op = random.choice(choices)
dir_entry = self.dir_list[self.dir_index]
# print '%d. Selected %s, dir=%s, has_known_prefix=%s, dir_list_len=%d' \
# % (len(instructions), op, repr(self.dir_index), repr(dir_entry.has_known_prefix), len(self.dir_list))
# print('%d. Selected %s, dir=%s, dir_id=%s, has_known_prefix=%s, dir_list_len=%d' \
# % (len(instructions), op, repr(self.dir_index), dir_entry.dir_id, repr(dir_entry.has_known_prefix), len(self.dir_list)))
if op.endswith('_DATABASE') or op.endswith('_SNAPSHOT'):
root_op = op[0:-9]
@ -312,7 +312,7 @@ class DirectoryTest(Test):
instructions.push_args(self.directory_log.key())
instructions.append('DIRECTORY_LOG_DIRECTORY')
if dir_entry.has_known_prefix and dir_entry.is_subspace:
# print '%d. Logging subspace: %d' % (i, dir_entry.dir_id)
# print('%d. Logging subspace: %d' % (i, dir_entry.dir_id))
instructions.push_args(self.subspace_log.key())
instructions.append('DIRECTORY_LOG_SUBSPACE')
if (i + 1) % 100 == 0:

View File

@ -50,38 +50,38 @@ class DirListEntry:
DirListEntry.dir_id += 1
def __repr__(self):
return 'DirEntry %d %r: %d' % (self.dir_id, self.path, self.has_known_prefix)
return '{DirEntry %d %r: %d}' % (self.dir_id, self.path, self.has_known_prefix)
def add_child(self, subpath, default_path, root, child):
if default_path in root.children:
# print 'Adding child %r to default directory %r at %r' % (child, root.children[DirectoryTest.DEFAULT_DIRECTORY_PATH].path, subpath)
# print('Adding child %r to default directory %r at %r' % (child, root.children[default_path].path, subpath))
c = root.children[default_path]._add_child_impl(subpath, child)
child.has_known_prefix = c.has_known_prefix and child.has_known_prefix
# print 'Added %r' % c
# print('Added %r' % c)
# print 'Adding child %r to directory %r at %r' % (child, self.path, subpath)
# print('Adding child %r to directory %r at %r (%r)' % (child, self.path, subpath, self.path + subpath))
c = self._add_child_impl(subpath, child)
# print 'Added %r' % c
# print('Added %r' % c)
return c
def _add_child_impl(self, subpath, child):
# print '%d, %d. Adding child (recursive): %s %s' % (self.dir_id, child.dir_id, repr(self.path), repr(subpath))
# print('%d, %d. Adding child (recursive): %s %s' % (self.dir_id, child.dir_id, repr(self.path), repr(subpath)))
if len(subpath) == 0:
self.has_known_prefix = self.has_known_prefix and child.has_known_prefix
# print '%d, %d. Setting child: %d' % (self.dir_id, child.dir_id, self.has_known_prefix)
# print('%d, %d. Setting child: %d' % (self.dir_id, child.dir_id, self.has_known_prefix))
self._merge_children(child)
return self
else:
if not subpath[0] in self.children:
# print '%d, %d. Path %s was absent (%s)' % (self.dir_id, child.dir_id, repr(self.path + subpath[0:1]), repr(self.children))
# print('%d, %d. Path %s was absent from %r (%s)' % (self.dir_id, child.dir_id, repr(self.path + subpath[0:1]), repr(self), repr(self.children)))
subdir = DirListEntry(True, True, path=self.path + subpath[0:1], root=self.root)
subdir.has_known_prefix = len(subpath) == 1
self.children[subpath[0]] = subdir
else:
subdir = self.children[subpath[0]]
subdir.has_known_prefix = False
# print '%d, %d. Path was present' % (self.dir_id, child.dir_id)
# print('%d, %d. Path was present' % (self.dir_id, child.dir_id))
return subdir._add_child_impl(subpath[1:], child)