Skip to content

Commit

Permalink
add successful protobuf directory
Browse files Browse the repository at this point in the history
  • Loading branch information
kbhargava-jump committed Nov 11, 2024
1 parent 6515461 commit b407fa6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -232,5 +232,6 @@ $ solana-test-suite run-tests [OPTIONS]
* `-c, --consensus-mode`: Only fail on consensus failures. One such effect is to normalize error codes when comparing results
* `-f, --failures-only`: Only log failed test cases
* `-sf, --save-failures`: Saves failed test cases to results directory [default: True]
* `-ss, --save-successes`: Saves successful test cases to results directory
* `-l, --log-level INTEGER`: FD logging level [default: 5]
* `--help`: Show this message and exit.
15 changes: 15 additions & 0 deletions src/test_suite/test_suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,12 @@ def run_tests(
"-sf",
help="Saves failed test cases to results directory",
),
save_successes: bool = typer.Option(
False,
"--save-successes",
"-ss",
help="Saves successful test cases to results directory",
),
log_level: int = typer.Option(
5,
"--log-level",
Expand Down Expand Up @@ -404,6 +410,9 @@ def run_tests(
if save_failures:
failed_protobufs_dir = globals.output_dir / "failed_protobufs"
failed_protobufs_dir.mkdir(parents=True, exist_ok=True)
if save_successes:
successful_protobufs_dir = globals.output_dir / "successful_protobufs"
successful_protobufs_dir.mkdir(parents=True, exist_ok=True)

test_cases = list(input.iterdir()) if input.is_dir() else [input]
num_test_cases = len(test_cases)
Expand Down Expand Up @@ -455,6 +464,10 @@ def run_tests(

if status == 1:
passed += 1
if save_successes:
successful_protobufs = list(input.glob(f"{file_stem}*"))
for successful_protobuf in successful_protobufs:
shutil.copy(successful_protobuf, successful_protobufs_dir)
elif status == -1:
failed += 1
failed_tests.append(file_stem)
Expand All @@ -481,6 +494,7 @@ def run_tests(
print(f"Skipped tests: {skipped_tests}")
if failed != 0 and save_failures:
print("Failures tests are in: ", globals.output_dir / "failed_protobufs")
print("Successful tests are in: ", globals.output_dir / "successful_protobufs")

if failed != 0:
binary_to_log_file = {
Expand Down Expand Up @@ -745,6 +759,7 @@ def debug_mismatches(
consensus_mode=False,
failures_only=False,
save_failures=True,
save_successes=True,
log_level=log_level,
)

Expand Down

0 comments on commit b407fa6

Please sign in to comment.