Skip to content

Commit

Permalink
Improve internal error when the compare script errors.
Browse files Browse the repository at this point in the history
This will include the exit code in the description of the internal error
in order to make it more clear, as well as include the metadata.
  • Loading branch information
meisterT committed Mar 2, 2025
1 parent 0c5ae90 commit fb1948a
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions judge/judgedaemon.main.php
Original file line number Diff line number Diff line change
Expand Up @@ -1467,13 +1467,19 @@ function judge(array $judgeTask): bool
}

if ($result === 'compare-error') {
$compareMeta = read_metadata($passdir . '/compare.meta');
$compareExitCode = 'n/a';
if (isset($compareMeta['exitcode'])) {
$compareExitCode = $compareMeta['exitcode'];
}
if ($combined_run_compare) {
logmsg(LOG_ERR, "comparing failed for combined run/compare script '" . $judgeTask['run_script_id'] . "'");
$description = 'combined run/compare script ' . $judgeTask['run_script_id'] . ' crashed';
$description = 'combined run/compare script ' . $judgeTask['run_script_id'] . ' crashed with exit code ' . $compareExitCode . ", expected one of 42/43";
disable('run_script', 'run_script_id', $judgeTask['run_script_id'], $description, $judgeTask['judgetaskid']);
} else {
logmsg(LOG_ERR, "comparing failed for compare script '" . $judgeTask['compare_script_id'] . "'");
$description = 'compare script ' . $judgeTask['compare_script_id'] . ' crashed';
logmsg(LOG_ERR, "compare script meta data:\n" . dj_file_get_contents($passdir . '/compare.meta'));
$description = 'compare script ' . $judgeTask['compare_script_id'] . ' crashed with exit code ' . $compareExitCode . ", expected one of 42/43";
disable('compare_script', 'compare_script_id', $judgeTask['compare_script_id'], $description, $judgeTask['judgetaskid']);
}
return false;
Expand Down

0 comments on commit fb1948a

Please sign in to comment.