Merge pull request rust-lang/libm#445 from tgross35/ci-flexible-script

Make the CI script more flexible
This commit is contained in:
Trevor Gross 2025-01-14 20:31:22 -05:00 committed by GitHub
commit 20cd1e7257
5 changed files with 34 additions and 8 deletions

View file

@ -7,7 +7,6 @@ on:
env:
CARGO_TERM_COLOR: always
CARGO_TERM_VERBOSE: true
RUSTDOCFLAGS: -Dwarnings
RUSTFLAGS: -Dwarnings
RUST_BACKTRACE: full
@ -202,7 +201,7 @@ jobs:
- name: Fetch pull request ref
run: git fetch origin "$GITHUB_REF:$GITHUB_REF"
if: github.event_name == 'pull_request'
- run: python3 ci/calculate-exhaustive-matrix.py >> "$GITHUB_OUTPUT"
- run: python3 ci/ci-util.py generate-matrix >> "$GITHUB_OUTPUT"
id: script
extensive:

View file

@ -1,18 +1,30 @@
#!/usr/bin/env python3
"""Calculate which exhaustive tests should be run as part of CI.
"""Utilities for CI.
This dynamically prepares a list of routines that had a source file change based on
git history.
"""
import json
import subprocess as sp
import sys
import json
from dataclasses import dataclass
from inspect import cleandoc
from os import getenv
from pathlib import Path
from typing import TypedDict
USAGE = cleandoc(
"""
usage:
./ci/ci-util.py <SUBCOMMAND>
SUBCOMMAND:
generate-matrix Calculate a matrix of which functions had source change,
print that as JSON object.
"""
)
REPO_ROOT = Path(__file__).parent.parent
GIT = ["git", "-C", REPO_ROOT]
@ -139,9 +151,17 @@ def eprint(*args, **kwargs):
def main():
ctx = Context()
output = ctx.make_workflow_output()
print(f"matrix={output}")
match sys.argv[1:]:
case ["generate-matrix"]:
ctx = Context()
output = ctx.make_workflow_output()
print(f"matrix={output}")
case ["--help" | "-h"]:
print(USAGE)
exit()
case _:
eprint(USAGE)
exit(1)
if __name__ == "__main__":

View file

@ -93,7 +93,7 @@ if [ "$nextest" = "1" ]; then
cfg_flag="--config-file $cfg_file"
fi
cmd="cargo nextest run ${cfg_flag:-} $flags"
cmd="cargo nextest run ${cfg_flag:-} --max-fail=10 $flags"
profile="--cargo-profile"
fi

View file

@ -454,6 +454,13 @@ impl MaybeOverride<(i32, f32)> for SpecialCase {
XFAIL
}
// `ynf(213, 109.15641) = -inf` with our library, should be finite.
(_, BaseName::Yn)
if input.0 > 200 && !expected.is_infinite() && actual.is_infinite() =>
{
XFAIL
}
_ => None,
}
}