From fba039d6a9f8b714bca94e8eb17bb140fdeba3c6 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Tue, 30 Jul 2024 02:28:35 -0500 Subject: [PATCH] Fix test runner scripts --- .github/workflows/c.yml | 6 +++--- .github/workflows/cplusplus.yml | 6 +++--- c/test_euler.py | 5 ++++- cplusplus/test_euler.py | 5 ++++- 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/.github/workflows/c.yml b/.github/workflows/c.yml index 8deda94e..66e99557 100644 --- a/.github/workflows/c.yml +++ b/.github/workflows/c.yml @@ -84,15 +84,15 @@ jobs: - name: Run tests (ubuntu lts) if: ${{ contains(matrix.os, 'ubuntu') && matrix.os != 'ubuntu-latest' }} - run: make c_test_auto COV=true + run: make c_test_auto - name: Run tests (windows) if: ${{ contains(matrix.os, 'windows') }} - run: make c_test_auto COV=true + run: make c_test_auto - name: Run tests (macos) if: ${{ contains(matrix.os, 'macos') }} - run: make c_test_auto COV=true + run: make c_test_auto env: NO_OPTIONAL_TESTS: true COMPILER_OVERRIDE: clang diff --git a/.github/workflows/cplusplus.yml b/.github/workflows/cplusplus.yml index a3cd5d4c..a7269369 100644 --- a/.github/workflows/cplusplus.yml +++ b/.github/workflows/cplusplus.yml @@ -79,15 +79,15 @@ jobs: - name: Run tests (ubuntu lts) if: ${{ contains(matrix.os, 'ubuntu') && matrix.os != 'ubuntu-latest' }} - run: make c_test_auto COV=true + run: make c_test_auto - name: Run tests (windows) if: ${{ contains(matrix.os, 'windows') }} - run: make cp_test_auto COV=true + run: make cp_test_auto - name: Run tests (macos) if: ${{ contains(matrix.os, 'macos') }} - run: make cp_test_auto COV=true + run: make cp_test_auto env: NO_OPTIONAL_TESTS: true COMPILER_OVERRIDE: clang diff --git a/c/test_euler.py b/c/test_euler.py index 66c8e229..342194e5 100644 --- a/c/test_euler.py +++ b/c/test_euler.py @@ -265,7 +265,10 @@ def test_problem(benchmark, key, compiler): answer = benchmark.pedantic(run_test, iterations=1, rounds=1) else: answer = benchmark(run_test) - assert answers[key] == int(answer.strip()) + if isinstance(answers[key], int): + assert answers[key] == int(answer.strip()) + else: + assert answers[key] == answer.strip() # sometimes benchmark disables itself, so check for .stats if 'PYTEST_XDIST_WORKER' not in environ and hasattr(benchmark, 'stats') and benchmark.stats.stats.median > 60: fail_func = xfail if key in known_slow else fail diff --git a/cplusplus/test_euler.py b/cplusplus/test_euler.py index fd6c3d0c..c843e01b 100644 --- a/cplusplus/test_euler.py +++ b/cplusplus/test_euler.py @@ -251,7 +251,10 @@ def test_problem(benchmark, key, compiler): answer = benchmark.pedantic(run_test, iterations=1, rounds=1) else: answer = benchmark(run_test) - assert answers[key] == int(answer.strip()) + if isinstance(answers[key], int): + assert answers[key] == int(answer.strip()) + else: + assert answers[key] == answer.strip() # sometimes benchmark disables itself, so check for .stats if 'PYTEST_XDIST_WORKER' not in environ and hasattr(benchmark, 'stats') and benchmark.stats.stats.median > 60: fail_func = xfail if key in known_slow else fail