Skip to content

Commit

Permalink
folder for failed protobufs
Browse files Browse the repository at this point in the history
  • Loading branch information
kbhargava-jump committed Jun 3, 2024
1 parent 824db0a commit b9c0609
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/test_suite/test_suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,12 @@ def run_tests(
"-f",
help="Only log failed test cases",
),
save_failures: bool = typer.Option(
False,
"--save-failures",
"-sf",
help="Saves failed test cases to results directory",
),
):
# Add Solana library to shared libraries
shared_libraries = [solana_shared_library] + shared_libraries
Expand Down Expand Up @@ -357,6 +363,11 @@ def diff_effect_wrapper(a, b):
log_dir = globals.output_dir / target.stem
log_dir.mkdir(parents=True, exist_ok=True)

# Make failed protobuf directory
if save_failures:
failed_protobufs_dir = globals.output_dir / "failed_protobufs"
failed_protobufs_dir.mkdir(parents=True, exist_ok=True)

test_cases = list(input_dir.iterdir())
num_test_cases = len(test_cases)

Expand Down Expand Up @@ -410,6 +421,10 @@ def diff_effect_wrapper(a, b):
elif status == -1:
failed += 1
failed_tests.append(file_stem)
if save_failures:
failed_protobufs = list(input_dir.glob(f'{file_stem}*'))
for failed_protobuf in failed_protobufs:
shutil.copy(failed_protobuf, failed_protobufs_dir)

print("Cleaning up...")
for target in shared_libraries:
Expand Down

0 comments on commit b9c0609

Please sign in to comment.