Skip to content

Commit

Permalink
Fix(CI): Fix run tests flow
Browse files Browse the repository at this point in the history
  • Loading branch information
alon-dotan-starkware committed Jul 2, 2024
1 parent 2397846 commit bc36576
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 15 deletions.
2 changes: 1 addition & 1 deletion crates/blockifier/src/blockifier/block_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ fn test_pre_process_block() {

// Test the positive flow of pre_process_block inside the allowed block number interval
let block_number = constants::STORED_BLOCK_HASH_BUFFER;
let block_hash = StarkFelt::from(20_u8);
let block_hash = StarkFelt::from(20_u);
let mut block_info = BlockInfo::create_for_testing();
block_info.block_number = BlockNumber(block_number);
pre_process_block(
Expand Down
2 changes: 0 additions & 2 deletions crates/papyrus_storage/src/bin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,3 @@ This tool allows you to dump the entire `declared_classes` table from Papyrus st
```
The default value for file_path is `dump_declared_classes.json`.
39 changes: 27 additions & 12 deletions scripts/run_tests.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/env python3
from ast import arg

import argparse
import re
import subprocess
import os
Expand Down Expand Up @@ -59,21 +60,35 @@ def get_package_dependencies(package_name: str) -> Set[str]:
return deps


def run_test():
def run_test(changes_only: bool):
local_changes = get_local_changes(".")
modified_packages = get_modified_packages(local_changes)
for p in modified_packages:
deps = get_package_dependencies(p)
print(f"Running tests for {deps}")
args = []
for d in deps:
args.extend(["--package", d])
args = []
if changes_only:
for p in modified_packages:
deps = get_package_dependencies(p)
print(f"Running tests for {deps}")
for d in deps:
args.extend(["--package", d])
if len(args) == 0:
print("No changes detected.")
return
cmd = ["cargo", "test"] + args
print("Running tests...")
print(cmd)
subprocess.run(cmd)
print("Tests complete.")

def parse_args() -> argparse.Namespace:
parser = argparse.ArgumentParser(description="Presubmit script.")
parser.add_argument("--changes_only", action="store_true")
return parser.parse_args()


def main():
args = parse_args()
run_test(changes_only=args.changes_only)


if __name__ == "__main__":
print("Running tests...")
run_test()
# Run tests here
print("Tests complete.")
main()

0 comments on commit bc36576

Please sign in to comment.