mirror of
https://github.com/compiler-explorer/compiler-explorer.git
synced 2025-12-27 09:23:52 -05:00
Test the numba wrapper in test-and-deploy (#7413)
- Resolve comments from #5592: - Replace a silly indirect import https://github.com/compiler-explorer/compiler-explorer/pull/5592#discussion_r1962004963 - Run `test_numba_wrapper` in `.github/workflows/test-and-deploy.yml`. https://github.com/compiler-explorer/compiler-explorer/pull/5592#discussion_r1962004131 - Patch minor errors in `etc/scripts/util/propschecktest.py` and also test it.
This commit is contained in:
6
.github/workflows/test-and-deploy.yml
vendored
6
.github/workflows/test-and-deploy.yml
vendored
@@ -18,13 +18,17 @@ jobs:
|
||||
check-latest: true
|
||||
cache: npm
|
||||
- name: Install prerequisites
|
||||
run: make prereqs
|
||||
run: |
|
||||
make prereqs
|
||||
python3 -m pip install numba
|
||||
- name: Run checks
|
||||
run: |
|
||||
npm run lint-check
|
||||
npm run test
|
||||
npm run ts-check
|
||||
python3 ./etc/scripts/util/propscheck.py
|
||||
python3 ./etc/scripts/util/propschecktest.py
|
||||
python3 ./etc/scripts/test_numba_wrapper.py
|
||||
- uses: codecov/codecov-action@v4
|
||||
with:
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
|
||||
@@ -30,11 +30,10 @@ import os
|
||||
import sys
|
||||
import unittest
|
||||
import unittest.mock
|
||||
|
||||
import tempfile
|
||||
import numba
|
||||
from numba.core.caching import tempfile
|
||||
|
||||
from . import numba_wrapper
|
||||
import numba_wrapper
|
||||
|
||||
|
||||
class TestMain(unittest.TestCase):
|
||||
@@ -188,3 +187,6 @@ class TestOpenOrStdout(unittest.TestCase):
|
||||
def test_stdout(self) -> None:
|
||||
with numba_wrapper._open_or_stdout(None) as file_:
|
||||
self.assertIs(file_, sys.stdout)
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
@@ -27,6 +27,7 @@ from os import listdir
|
||||
from os.path import isfile, join
|
||||
import re
|
||||
import argparse
|
||||
from argparse import Namespace
|
||||
|
||||
parser = argparse.ArgumentParser(description='Checks for incorrect/suspicious properties.')
|
||||
parser.add_argument ('--check-suspicious-in-default-prop', required=False, action="store_true")
|
||||
@@ -101,7 +102,7 @@ def check_suspicious_path_and_add(line: Line, m, s):
|
||||
s.add(Line(line.number, m.group(2)))
|
||||
|
||||
|
||||
def process_file(file: str, args):
|
||||
def process_file(file: str, args: Namespace):
|
||||
default_compiler = set()
|
||||
|
||||
listed_groups = set()
|
||||
@@ -270,7 +271,7 @@ def print_issue(name, result):
|
||||
print(f"{name}:\n {sep.join(sorted([str(issue) for issue in result]))}")
|
||||
|
||||
|
||||
def find_orphans(args: dict):
|
||||
def find_orphans(args: Namespace):
|
||||
folder = args.config_dir
|
||||
result = sorted([(f, r) for (f, r) in process_folder(folder, args) if problems_found(r)], key=lambda x: x[0])
|
||||
if result:
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import sys
|
||||
import argparse
|
||||
import os
|
||||
import sys
|
||||
import unittest
|
||||
|
||||
from propscheck import process_file, Line
|
||||
@@ -9,7 +10,8 @@ class PropsCheckTests(unittest.TestCase):
|
||||
def run_test(self, filename, expected_key, expected_contents):
|
||||
base_path = os.path.dirname(os.path.abspath(sys.argv[0]))
|
||||
test_case_file = os.path.join(base_path, 'test', 'cases', f"{filename}.properties")
|
||||
result = process_file(test_case_file)
|
||||
args = argparse.Namespace(check_suspicious_in_default_prop=True)
|
||||
result = process_file(test_case_file, args)
|
||||
self.assertEqual(result[expected_key], {Line(-1, text) for text in expected_contents})
|
||||
|
||||
def test_bad_compilers_exe(self):
|
||||
@@ -77,7 +79,8 @@ class PropsCheckTests(unittest.TestCase):
|
||||
def test_good_file(self):
|
||||
base_path = os.path.dirname(os.path.abspath(sys.argv[0]))
|
||||
test_case_file = os.path.join(base_path, '..', '..', 'config', 'c++.amazon.properties')
|
||||
result = process_file(test_case_file)
|
||||
args = argparse.Namespace(check_suspicious_in_default_prop=False)
|
||||
result = process_file(test_case_file, args)
|
||||
for k in result:
|
||||
self.assertEqual(result[k], set(), f"{k} has output in known good file")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user