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 985d6e4
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion 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 @@ -409,7 +420,11 @@ def diff_effect_wrapper(a, b):
passed += 1
elif status == -1:
failed += 1
failed_tests.append(file_stem)
if save_failures:
failed_tests.append(file_stem)
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 985d6e4

Please sign in to comment.