def test_single_process(self): tt = Communication([1, "stub", "fifo_io"]) cc = tt.get_compilation_commands(["foo.%l"]) self.assertEqual(cc, { "L1": fake_compilation_commands( COMPILATION_COMMAND_1, ["stub.l1", "foo.l1"], "foo"), "L2": fake_compilation_commands( COMPILATION_COMMAND_2, ["stub.l2", "foo.l2"], "foo"), })
def test_std_io(self): # Compilation commands are the same regardless of whether we use # stdin/stdout or pipes. tt = Communication([1, "stub", "std_io"]) cc = tt.get_compilation_commands(["foo.%l"]) self.assertEqual(cc, { "L1": fake_compilation_commands( COMPILATION_COMMAND_1, ["stub.l1", "foo.l1"], "foo"), "L2": fake_compilation_commands( COMPILATION_COMMAND_2, ["stub.l2", "foo.l2"], "foo"), })
def test_no_stub(self): # Submissions can be compiled as stand-alone programs, with no # stubs. tt = Communication([1, "alone", "fifo_io"]) cc = tt.get_compilation_commands(["foo.%l"]) self.assertEqual(cc, { "L1": fake_compilation_commands( COMPILATION_COMMAND_1, ["foo.l1"], "foo"), "L2": fake_compilation_commands( COMPILATION_COMMAND_2, ["foo.l2"], "foo"), })
def test_two_processes(self): # Compilation commands are the same regardless of the number of # processes. tt = Communication([2, "stub", "fifo_io"]) cc = tt.get_compilation_commands(["foo.%l"]) self.assertEqual(cc, { "L1": fake_compilation_commands( COMPILATION_COMMAND_1, ["stub.l1", "foo.l1"], "foo"), "L2": fake_compilation_commands( COMPILATION_COMMAND_2, ["stub.l2", "foo.l2"], "foo"), })
def test_many_files(self): # Communication supports multiple files in the submission format, that # are just compiled together. tt = Communication([1, "stub", "fifo_io"]) cc = tt.get_compilation_commands(["foo.%l", "bar.%l"]) self.assertEqual(cc, { "L1": fake_compilation_commands( COMPILATION_COMMAND_1, ["stub.l1", "foo.l1", "bar.l1"], "bar_foo"), "L2": fake_compilation_commands( COMPILATION_COMMAND_2, ["stub.l2", "foo.l2", "bar.l2"], "bar_foo"), })
def prepare(self, parameters, executables, managers): tt = Communication(parameters) job = self.job(executables, managers) self.evaluation_step_after_run.return_value = (True, True, STATS_OK) self.extract_outcome_and_text.return_value = (OUTCOME, TEXT) self.eval_output.return_value = (True, OUTCOME, TEXT) return tt, job
def prepare(self, parameters, files=None, managers=None, compilation_step_return_value=(True, True, TEXT, STATS_OK)): tt = Communication(parameters) job = self.job(files, managers) self.compilation_step.return_value = compilation_step_return_value return tt, job