Skip to content

Commit

Permalink
Fix #318: input/output-format validators may reject with any non-42 e…
Browse files Browse the repository at this point in the history
…xit code
  • Loading branch information
RagnarGrootKoerkamp committed Oct 31, 2023
1 parent 0761069 commit c54a6b9
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions bin/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,14 @@ def run(self, testcase, constraints=None, args=None):
with testcase.in_path.open() as in_file:
ret = exec_command(
run_command,
expect=config.RTV_WA if testcase.bad_input else config.RTV_AC,
expect=config.RTV_AC,
stdin=in_file,
cwd=cwd,
timeout=config.get_timeout(),
)
# For bad inputs, 'invert' the return code: any non-AC exit code is fine, while AC is not fine.
if testcase.bad_input:
ret.ok = True if ret.ok is not True else config.RTV_AC

if constraints is not None:
_merge_constraints(constraints_path, constraints)
Expand Down Expand Up @@ -153,11 +156,14 @@ def run(self, testcase, run=None, constraints=None, args=None):
with testcase.ans_path.open() as ans_file:
ret = exec_command(
run_command,
expect=config.RTV_WA if testcase.bad_output else config.RTV_AC,
expect=config.RTV_AC,
stdin=ans_file,
cwd=cwd,
timeout=config.get_timeout(),
)
# For bad outputs, 'invert' the return code: any non-AC exit code is fine, while AC is not fine.
if testcase.bad_output:
ret.ok = True if ret.ok is not True else config.RTV_AC

if constraints is not None:
_merge_constraints(constraints_path, constraints)
Expand Down

0 comments on commit c54a6b9

Please sign in to comment.