Skip to content

Commit 1d58d4c

Browse files
committed
ci: Add a way to run libm tests that would otherwise be skipped
Introduce a new directive `ci: test-libm` to ensure tests run.
1 parent 568afb8 commit 1d58d4c

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

ci/ci-util.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,14 @@ class PrCfg:
9393
# Max number of extensive tests to run by default
9494
MANY_EXTENSIVE_THRESHOLD: int = 20
9595

96+
# Run tests for `libm` that may otherwise be skipped due to no changed files.
97+
always_test_libm: bool = False
98+
9699
# String values of directive names
97100
DIR_ALLOW_REGRESSIONS: str = "allow-regressions"
98101
DIR_SKIP_EXTENSIVE: str = "skip-extensive"
99102
DIR_ALLOW_MANY_EXTENSIVE: str = "allow-many-extensive"
103+
DIR_TEST_LIBM: str = "test-libm"
100104

101105
def __init__(self, body: str):
102106
directives = re.finditer(r"^\s*ci:\s*(?P<dir_name>\S*)", body, re.MULTILINE)
@@ -108,6 +112,8 @@ def __init__(self, body: str):
108112
self.skip_extensive = True
109113
elif name == self.DIR_ALLOW_MANY_EXTENSIVE:
110114
self.allow_many_extensive = True
115+
elif name == self.DIR_TEST_LIBM:
116+
self.always_test_libm = True
111117
else:
112118
eprint(f"Found unexpected directive `{name}`")
113119
exit(1)
@@ -253,6 +259,13 @@ def may_skip_libm_ci(self) -> bool:
253259
if not self.is_pr():
254260
return False
255261

262+
pr = PrInfo.from_env()
263+
assert pr is not None, "Is a PR but couldn't load PrInfo"
264+
265+
# Allow opting in to libm tests
266+
if pr.cfg.always_test_libm:
267+
return False
268+
256269
# By default, run if there are any changed files matching the pattern
257270
return all(not re.match(TRIGGER_LIBM_CI_FILE_PAT, str(f)) for f in self.changed)
258271

0 commit comments

Comments
 (0)