about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTrevor Gross <tmgross@umich.edu>2025-07-30 08:33:37 +0000
committerTrevor Gross <tmgross@umich.edu>2025-07-30 08:59:57 +0000
commit4ebfdf74dbd29acc442cd91ab43483260e9ce668 (patch)
treeb0d505af559f3291c0bf97e22e70a7116284f57a
parentc045c9b1ca4def434584dfb43cc83bd2eac059de (diff)
downloadrust-4ebfdf74dbd29acc442cd91ab43483260e9ce668.tar.gz
rust-4ebfdf74dbd29acc442cd91ab43483260e9ce668.zip
ci: Add a way to run `libm` tests that would otherwise be skipped
Introduce a new directive `ci: test-libm` to ensure tests run.
-rwxr-xr-xlibrary/compiler-builtins/ci/ci-util.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/library/compiler-builtins/ci/ci-util.py b/library/compiler-builtins/ci/ci-util.py
index f43409c5e20..c1db17c6c90 100755
--- a/library/compiler-builtins/ci/ci-util.py
+++ b/library/compiler-builtins/ci/ci-util.py
@@ -93,10 +93,14 @@ class PrCfg:
     # Max number of extensive tests to run by default
     MANY_EXTENSIVE_THRESHOLD: int = 20
 
+    # Run tests for `libm` that may otherwise be skipped due to no changed files.
+    always_test_libm: bool = False
+
     # String values of directive names
     DIR_ALLOW_REGRESSIONS: str = "allow-regressions"
     DIR_SKIP_EXTENSIVE: str = "skip-extensive"
     DIR_ALLOW_MANY_EXTENSIVE: str = "allow-many-extensive"
+    DIR_TEST_LIBM: str = "test-libm"
 
     def __init__(self, body: str):
         directives = re.finditer(r"^\s*ci:\s*(?P<dir_name>\S*)", body, re.MULTILINE)
@@ -108,6 +112,8 @@ class PrCfg:
                 self.skip_extensive = True
             elif name == self.DIR_ALLOW_MANY_EXTENSIVE:
                 self.allow_many_extensive = True
+            elif name == self.DIR_TEST_LIBM:
+                self.always_test_libm = True
             else:
                 eprint(f"Found unexpected directive `{name}`")
                 exit(1)
@@ -253,6 +259,13 @@ class Context:
         if not self.is_pr():
             return False
 
+        pr = PrInfo.from_env()
+        assert pr is not None, "Is a PR but couldn't load PrInfo"
+
+        # Allow opting in to libm tests
+        if pr.cfg.always_test_libm:
+            return False
+
         # By default, run if there are any changed files matching the pattern
         return all(not re.match(TRIGGER_LIBM_CI_FILE_PAT, str(f)) for f in self.changed)