Skip to content

Commit

Permalink
Fix feedback formatting issue
Browse files Browse the repository at this point in the history
  • Loading branch information
JustinMeimar committed Dec 10, 2024
1 parent 11a8549 commit f27136d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
3 changes: 2 additions & 1 deletion dragon_runner/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ def parse_cli_args() -> CLIArgs:
help="Path to the tester JSON configuration file (required for regular and tournament modes).")

parser.add_argument("--mode", dest="mode", default="regular",
help="run in regular, tournament or script mode")
help="run in one of the test-running modes: [regular, tournament, perf, memcheck]\
or in a scripting mode")

parser.add_argument("--script-args", type=parse_script_args, default=[],
help='Arguments to pass to the script (quote the entire string, e.g. --script-args="arg1 arg2")')
Expand Down
20 changes: 9 additions & 11 deletions dragon_runner/harness.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,18 +219,16 @@ def trim_bytes(data: bytes, max_bytes: int = 512) -> bytes:
if not result.did_pass:
test_contents = file_to_str(result.test.path)
exp_out = trim_bytes(x) if isinstance(x := result.test.expected_out, bytes) else ""
gen_out = trim_bytes(x) if isinstance(x := result.gen_output, bytes) else ""

feedback_file.write(
f"""Test: {result.test.file}\n
Test contents: {test_contents}\n
Expected Output: {exp_out}\n
Generated Output: {gen_out}
"""
gen_out = trim_bytes(x) if isinstance(x := result.gen_output, bytes) else ""
feedback_string = (
"="*40+'\n'
f"Test: {result.test.file}\n"
f"Test Contents: {test_contents.strip()}\n"
f"Expected Output: {exp_out.strip()}\n"
f"Generated Output: {gen_out.strip()}\n"
)
if result.failing_step:
feedback_file.write(f"Failing Step: {result.failing_step}\n")
feedback_file.write("\n")

feedback_file.write(feedback_string)

class MemoryCheckHarness(TestHarness):

Expand Down

0 comments on commit f27136d

Please sign in to comment.