Lines Matching full:table
77 … table = [unpack_table_elem(s[i:i + table_elem_size]) for i in xrange(0, size, table_elem_size)]
78 return table
84 def write_table(self, offset, table): argument
85 s = ''.join(pack_table_elem(x) for x in table)
88 def random_table_item(table): argument
89 vals = [(index, offset) for index, offset in enumerate(table) if offset != 0]
91 err('cannot pick random item because table is empty')
94 def corrupt_table_duplicate(table): argument
95 '''Corrupt a table by introducing a duplicate offset'''
96 victim_idx, victim_val = random_table_item(table)
97 unique_vals = set(table)
99 err('no duplication corruption possible in table')
101 table[victim_idx] = dup_val
103 def corrupt_table_invalidate(qed, table): argument
104 '''Corrupt a table by introducing an invalid offset'''
105 index, _ = random_table_item(table)
106 table[index] = qed.filesize + random.randint(0, 100 * 1024 * 1024 * 1024 * 1024)
121 '''duplicate l1|l2 - Duplicate a random table element'''
124 table = qed.l1_table
127 table = qed.read_table(offset)
130 corrupt_table_duplicate(table)
131 qed.write_table(offset, table)
134 '''invalidate l1|l2 - Plant an invalid table element at random'''
137 table = qed.l1_table
140 table = qed.read_table(offset)
143 corrupt_table_invalidate(qed, table)
144 qed.write_table(offset, table)
171 err('no l2 table allocated')
194 # Copy L1 table