From b7ca9dfa339b3ee1f66fa8cc3c981db31323f985 Mon Sep 17 00:00:00 2001 From: blueloveTH Date: Fri, 10 Feb 2023 23:49:23 +0800 Subject: [PATCH] up --- .github/workflows/main.yml | 6 ++---- scripts/run_tests.py | 25 ++++++++++++++----------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2f4d5fcb..7ae2a7e4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -13,8 +13,7 @@ jobs: mv src/pocketpy.h src/pocketpy.cpp CL -std:c++17 -GR- -EHsc -O2 -LD -Fe:pocketpy src/pocketpy.cpp python3 scripts/run_tests.py - ./pocketpy tests/t1.py - ./pocketpy tests/t2.py + python3 scripts/run_tests.py benchmarks/ mkdir -p output/windows/x86_64 mv pocketpy.exe output/windows/x86_64 mv pocketpy.dll output/windows/x86_64 @@ -55,8 +54,7 @@ jobs: bash build_cpp.sh bash build_linux.sh python3 scripts/run_tests.py - ./pocketpy tests/t1.py - ./pocketpy tests/t2.py + python3 scripts/run_tests.py benchmarks/ mkdir -p output/linux/x86_64 mv pocketpy output/linux/x86_64 mv pocketpy.so output/linux/x86_64 diff --git a/scripts/run_tests.py b/scripts/run_tests.py index 0c96e403..3aa29fe9 100644 --- a/scripts/run_tests.py +++ b/scripts/run_tests.py @@ -10,19 +10,22 @@ def test_file(filepath): def test_dir(path): has_error = False for filename in os.listdir(path): - if filename.endswith('.py'): - if(not filename.startswith('_')): - continue - filepath = os.path.join(path, filename) - code = test_file(filepath) - if not code: - print("[x] " + filepath) - has_error = True - else: - print("[v] " + filepath) + if not filename.endswith('.py'): + continue + filepath = os.path.join(path, filename) + print("> " + filepath) + code = test_file(filepath) + if not code: + has_error = True + exit(1) return not has_error if __name__ == '__main__': - ok = test_dir('tests') + if len(sys.argv) > 1: + d = sys.argv[1] + else: + d = 'tests/' + print("Testing directory:", d) + ok = test_dir(d) if ok: print("ALL TESTS PASSED") \ No newline at end of file