Skip to content

Commit

Permalink
Reconfigure GH workflows for new test runner
Browse files Browse the repository at this point in the history
  • Loading branch information
christian-byrne committed Sep 20, 2024
1 parent a23cc13 commit 5dd5716
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 178 deletions.
9 changes: 8 additions & 1 deletion .github/workflows/run-sml-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,15 @@ jobs:
sudo apt-get update
sudo apt-get install smlnj # Install SML/NJ
- name: Install python dependencies
run: |
sudo apt-get install python3
sudo apt-get install python3-pip
pip3 install --upgrade pip
pip3 install -r requirements.txt
- name: Run SML tests
run: |
chmod +x test
./test false
./test
2 changes: 1 addition & 1 deletion .github/workflows/run-smlsharp-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ jobs:
- name: Run SML tests
run: |
chmod +x test
./test true
./test-smlunit
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
argparse
rich
38 changes: 17 additions & 21 deletions test.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,26 +339,22 @@ def run_test(test_path: Path):
logging.info(f"Log file location: {str(Path(args.log_file))}")


def write_to_cache():
try:
with open(args.cache_path, "r") as cache_file:
cache = json.load(cache_file)
except (json.JSONDecodeError, FileNotFoundError):
# Previous error wrote corrupted cache file or first run
clear_cache()
cache = {}

def write_(test_set: Set[Path], cache_key: str):
cache[cache_key] = str(test_set.pop().resolve()) if test_set else ""

write_(runtime_error_tests, "runtime_error_tests")
write_(failed_tests, "failed_tests")
write_(passed_tests, "passed_tests")
write_(
runtime_error_tests.union(failed_tests).union(passed_tests), "all_seen_tests"
)
with open(args.cache_path, "w") as cache_file:
json.dump(cache, cache_file)
try:
with open(args.cache_path, "r") as cache_file:
cache = json.load(cache_file)
except (json.JSONDecodeError, FileNotFoundError):
# Previous error wrote corrupted cache file or first run
clear_cache()
cache = {}

def write_(test_set: Set[Path], cache_key: str):
cache[cache_key] = str(test_set.pop().resolve()) if test_set else ""

write_to_cache()
write_(runtime_error_tests, "runtime_error_tests")
write_(failed_tests, "failed_tests")
write_(passed_tests, "passed_tests")
write_(
runtime_error_tests.union(failed_tests).union(passed_tests), "all_seen_tests"
)
with open(args.cache_path, "w") as cache_file:
json.dump(cache, cache_file)
154 changes: 0 additions & 154 deletions tests/test_ica5.sml

This file was deleted.

0 comments on commit 5dd5716

Please sign in to comment.