diff --git a/dmoj/cli.py b/dmoj/cli.py index f4728e327..59dfff95f 100644 --- a/dmoj/cli.py +++ b/dmoj/cli.py @@ -19,6 +19,9 @@ def supported_problems_packet(self, problems): def test_case_status_packet(self, position, result): pass + def multi_test_case_status_packet(self, updates): + pass + def compile_error_packet(self, log): pass diff --git a/dmoj/packet.py b/dmoj/packet.py index a24806856..c6453b994 100644 --- a/dmoj/packet.py +++ b/dmoj/packet.py @@ -247,15 +247,22 @@ def test_case_status_packet(self, position: int, result): result.points, result.total_points) self._send_packet({'name': 'test-case-status', 'submission-id': self.judge.current_submission_id, - 'position': position, - 'status': result.result_flag, - 'time': result.execution_time, - 'points': result.points, - 'total-points': result.total_points, - 'memory': result.max_memory, - 'output': result.output, - 'extended-feedback': result.extended_feedback, - 'feedback': result.feedback}) + 'cases': [ + { + 'position': position, + 'status': result.result_flag, + 'time': result.execution_time, + 'points': result.points, + 'total-points': result.total_points, + 'memory': result.max_memory, + 'output': result.output, + 'extended-feedback': result.extended_feedback, + 'feedback': result.feedback, + } for position, result in updates + ]}) + + def test_case_status_packet(self, position, result): + self.multi_test_case_status_packet([(position, result)]) def compile_error_packet(self, message: str): log.info('Compile error: %d', self.judge.current_submission_id) diff --git a/dmoj/testsuite.py b/dmoj/testsuite.py index f964a784c..3fa8a6f7b 100644 --- a/dmoj/testsuite.py +++ b/dmoj/testsuite.py @@ -51,6 +51,10 @@ def test_case_status_packet(self, position, result): self.fail('Unexpected feedback: "%s", expected: "%s"' % (result.feedback, '", "'.join(feedback))) + def multi_test_case_status_packet(self, updates): + for position, result in updates: + self.test_case_status_packet(position, result) + def compile_error_packet(self, log): if 'CE' not in self.codes_all: self.fail('Unexpected compile error')