Skip to content

Commit

Permalink
feat(stomp): never again
Browse files Browse the repository at this point in the history
Do not write answers after a wrong verdict
  • Loading branch information
vEnhance committed Dec 2, 2023
1 parent 09205fa commit f237501
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions py-scripts/stomp.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
else:
raise ValueError(f"Invalid program type {PROGRAM_TYPE}")

any_failed = False
for input_file_path in sorted(Path("tests").glob("*.input")):
stdout_path = input_file_path.with_suffix(".stdout")
stderr_path = input_file_path.with_suffix(".stderr")
Expand Down Expand Up @@ -129,9 +130,13 @@
f"\t💥 {TERM_COLOR['BOLD_RED']}CRASHED{TERM_COLOR['RESET']} "
f"{input_file_path}: return-code={process.returncode}"
)
any_failed = True
elif not answer_path.exists():
print(f"\t📜 Saving {answer_path} since no existing answer was given")
subprocess.call(["cp", stdout_path, answer_path])
if not any_failed:
print(f"\t📜 Saving {answer_path} since no existing answer was given")
subprocess.call(["cp", stdout_path, answer_path])
else:
print(f"\t🤷 {answer_path} doesn't exist")
else:
diff_process = subprocess.run(
["diff", "--color=always", stdout_path, answer_path],
Expand All @@ -148,5 +153,6 @@
f"\t{TERM_COLOR['BOLD_RED']}FAILED{TERM_COLOR['RESET']} "
f"test case {input_file_path}"
)
any_failed = True
if opts.stdout or opts.stderr:
print("-" * 60)

0 comments on commit f237501

Please sign in to comment.