diff --git a/cms/grading/scoretypes/abc.py b/cms/grading/scoretypes/abc.py index 0478e1a5eb..2b450969d7 100644 --- a/cms/grading/scoretypes/abc.py +++ b/cms/grading/scoretypes/abc.py @@ -83,6 +83,11 @@ def __init__(self, parameters, public_testcases): if hasattr(self, "score_column_headers"): self.public_score_header, self.private_score_header = \ self.score_column_headers() + else: + # HTML templates require these to be set; otherwise, the server crashes. + # As we only ever use SubtaskGroup, it is not clear whether this makes sense: + self.public_score_header = "Sample Score" + self.private_score_header = "Actual Score" except Exception as e: raise ValueError( "Unable to instantiate score type (probably due to invalid " diff --git a/cms/grading/tasktypes/Communication.py b/cms/grading/tasktypes/Communication.py index 1fdd597325..0783e86ff5 100644 --- a/cms/grading/tasktypes/Communication.py +++ b/cms/grading/tasktypes/Communication.py @@ -384,8 +384,9 @@ def evaluate(self, job, file_cacher): if self._uses_fifos(): args.extend([sandbox_fifo_manager_to_user[i], sandbox_fifo_user_to_manager[i]]) - stdin_redirect = sandbox_fifo_manager_to_user[i] - stdout_redirect = sandbox_fifo_user_to_manager[i] + else: + stdin_redirect = sandbox_fifo_manager_to_user[i] + stdout_redirect = sandbox_fifo_user_to_manager[i] if self.num_processes != 1: args.append(str(i)) if self._uses_stub(): diff --git a/cmscontrib/updaters/update_29.py b/cmscontrib/updaters/update_29.py index 7fc6f27815..8b8f2a9b35 100644 --- a/cmscontrib/updaters/update_29.py +++ b/cmscontrib/updaters/update_29.py @@ -62,15 +62,15 @@ def run(self): json.loads(v["score_type_parameters"]) if v["_class"] == "SubmissionResult": - if v["score_details"] is not None: + if v.get("score_details") is not None: v["score_details"] = json.loads(v["score_details"]) - if v["public_score_details"] is not None: + if v.get("public_score_details") is not None: v["public_score_details"] = \ json.loads(v["public_score_details"]) - if v["unit_test_score_details"] is not None: + if v.get("unit_test_score_details") is not None: v["unit_test_score_details"] = \ json.loads(v["unit_test_score_details"]) - if v["ranking_score_details"] is not None: + if v.get("ranking_score_details") is not None: v["ranking_score_details"] = \ json.loads(v["ranking_score_details"]) v["compilation_text"] = fix_text(v["compilation_text"]) diff --git a/cmstestsuite/RunFunctionalTests.py b/cmstestsuite/RunFunctionalTests.py index 38dcfe6da0..6720c7ac8c 100755 --- a/cmstestsuite/RunFunctionalTests.py +++ b/cmstestsuite/RunFunctionalTests.py @@ -232,7 +232,9 @@ def main(): write_test_case_list( [(test, lang) for test, lang, _ in failures], FAILED_TEST_FILENAME) - except TestException: + except TestException as e: + print("\n\n===== FAILURE =====") + print(e) if os.path.exists("./log/cms/last.log"): print("\n\n===== START OF LOG DUMP =====\n\n") with open("./log/cms/last.log", "rt", encoding="utf-8") as f: diff --git a/cmstestsuite/functionaltestframework.py b/cmstestsuite/functionaltestframework.py index 9b47827c10..8e6e17c97c 100644 --- a/cmstestsuite/functionaltestframework.py +++ b/cmstestsuite/functionaltestframework.py @@ -212,6 +212,14 @@ def add_contest(self, **kwargs): page) if match is not None: contest_id = int(match.groups()[0]) + + #Query for group ID of the 'default' group + r = self.admin_req('contest/%s/users' % contest_id) + g = re.search(r'', r.text) + if g: + kwargs["main_group_id"] = int(g.group(1)) + else: + raise TestException("Unable to find any group.") self.admin_req('contest/%s' % contest_id, args=kwargs) return contest_id else: @@ -288,6 +296,14 @@ def add_user(self, **kwargs): else: raise TestException("Unable to create user.") + #Query for group ID of the 'default' group + r = self.admin_req('contest/%s/users' % kwargs["contest_id"]) + g = re.search(r'', r.text) + if g: + kwargs["group_id"] = int(g.group(1)) + else: + raise TestException("Unable to find any group.") + kwargs["user_id"] = user_id r = self.admin_req('contest/%s/users/add' % kwargs["contest_id"], args=kwargs) diff --git a/cmstestsuite/unit_tests/grading/tasktypes/CommunicationTest.py b/cmstestsuite/unit_tests/grading/tasktypes/CommunicationTest.py index 0f5fc7fb9a..33db7b98ed 100755 --- a/cmstestsuite/unit_tests/grading/tasktypes/CommunicationTest.py +++ b/cmstestsuite/unit_tests/grading/tasktypes/CommunicationTest.py @@ -371,8 +371,9 @@ def test_single_process_success(self): sandbox_mgr.create_file_from_storage.assert_has_calls([ call("manager", "digest of manager", executable=True), call("input.txt", "digest of input"), + call("ok.txt", "digest of correct output"), ], any_order=True) - self.assertEqual(sandbox_mgr.create_file_from_storage.call_count, 2) + self.assertEqual(sandbox_mgr.create_file_from_storage.call_count, 3) sandbox_usr.create_file_from_storage.assert_has_calls([ call("foo", "digest of foo", executable=True), ], any_order=True) @@ -617,8 +618,9 @@ def test_many_processes_success(self): sandbox_mgr.create_file_from_storage.assert_has_calls([ call("manager", "digest of manager", executable=True), call("input.txt", "digest of input"), + call("ok.txt", "digest of correct output"), ], any_order=True) - self.assertEqual(sandbox_mgr.create_file_from_storage.call_count, 2) + self.assertEqual(sandbox_mgr.create_file_from_storage.call_count, 3) # Same content in both user sandboxes. for s in [sandbox_usr0, sandbox_usr1]: s.create_file_from_storage.assert_has_calls([ diff --git a/cmstestsuite/unit_tests/server/contest/submission/workflow_test.py b/cmstestsuite/unit_tests/server/contest/submission/workflow_test.py index 0b2bd3f959..ffb93ac017 100755 --- a/cmstestsuite/unit_tests/server/contest/submission/workflow_test.py +++ b/cmstestsuite/unit_tests/server/contest/submission/workflow_test.py @@ -153,7 +153,7 @@ def call(self): return accept_submission( self.session, self.file_cacher, self.participation, self.task, self.timestamp, self.tornado_files, self.language_name, - self.official, True) + self.official) def assertSubmissionIsValid(self, submission, timestamp, language, files, official):