def compare_registries(fs0, fs1, concurrent=False): """Compares the Windows Registry contained within the two File Systems. If the concurrent flag is True, two processes will be used speeding up the comparison on multiple CPUs. Returns a dictionary. {'created_keys': {'\\Reg\\Key': (('Key', 'Type', 'Value'), ...)} 'deleted_keys': ['\\Reg\\Key', ...], 'created_values': {'\\Reg\\Key': (('Key', 'Type', 'NewValue'), ...)}, 'deleted_values': {'\\Reg\\Key': (('Key', 'Type', 'OldValue'), ...)}, 'modified_values': {'\\Reg\\Key': (('Key', 'Type', 'NewValue'), ...)}} """ hives = compare_hives(fs0, fs1) if concurrent: task0 = process.concurrent(target=parse_registries, args=(fs0, hives)) task1 = process.concurrent(target=parse_registries, args=(fs1, hives)) registry0 = task0.get() registry1 = task1.get() else: registry0 = parse_registries(fs0, hives) registry1 = parse_registries(fs1, hives) return registry_comparison(registry0, registry1)
def test_undecorated_callback(self): """Process Concurrent undecorated results are forwarded to callback.""" task = process.concurrent(target=undecorated, args=[1], kwargs={'keyword_argument': 1}, callback=self.callback) event.wait() self.assertEqual(task.get(), 2)
def test_undecorated_id(self): """Process concurrent ID is forwarded to it.""" task = process.concurrent(target=undecorated, args=[1], kwargs={'keyword_argument': 1}, identifier='foo') self.assertEqual(task.id, 'foo')
def test_undecorated_results(self): """Process Concurrent undecorated results are produced.""" task = process.concurrent(target=undecorated, args=[1], kwargs={'keyword_argument': 1}) self.assertEqual(task.get(), 2)
def test_undecorated_started(self): """Process Concurrent undecorated task is set to started.""" task = process.concurrent(target=undecorated, args=[1], kwargs={'keyword_argument': 1}) self.assertTrue(task.started)
def test_undecorated_results(self): """Process Concurrent undecorated results are produced.""" task = process.concurrent(target=undecorated_simple) self.assertEqual(task.get(), 0)