From 5e65179a3912f3b293fd39b05bf8903428a86346 Mon Sep 17 00:00:00 2001 From: Trevor Gross Date: Tue, 14 Jan 2025 03:24:14 +0000 Subject: [PATCH 1/4] Change `.yml` files to the canonical extension `.yaml` --- .../libm/.github/workflows/{main.yml => main.yaml} | 0 .../libm/.github/workflows/{publish.yml => publish.yaml} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename library/compiler-builtins/libm/.github/workflows/{main.yml => main.yaml} (100%) rename library/compiler-builtins/libm/.github/workflows/{publish.yml => publish.yaml} (100%) diff --git a/library/compiler-builtins/libm/.github/workflows/main.yml b/library/compiler-builtins/libm/.github/workflows/main.yaml similarity index 100% rename from library/compiler-builtins/libm/.github/workflows/main.yml rename to library/compiler-builtins/libm/.github/workflows/main.yaml diff --git a/library/compiler-builtins/libm/.github/workflows/publish.yml b/library/compiler-builtins/libm/.github/workflows/publish.yaml similarity index 100% rename from library/compiler-builtins/libm/.github/workflows/publish.yml rename to library/compiler-builtins/libm/.github/workflows/publish.yaml From f63ef37218c7def3efeb7a434fcfd0a2b87dcaec Mon Sep 17 00:00:00 2001 From: Trevor Gross Date: Tue, 14 Jan 2025 07:46:20 +0000 Subject: [PATCH 2/4] Slightly restructure `ci/calculate-exhaustive-matrix.py` Change this script into a generic CI utility that we will be able to expand in the future. --- .../libm/.github/workflows/main.yaml | 3 +- ...culate-exhaustive-matrix.py => ci-util.py} | 30 +++++++++++++++---- 2 files changed, 26 insertions(+), 7 deletions(-) rename library/compiler-builtins/libm/ci/{calculate-exhaustive-matrix.py => ci-util.py} (87%) diff --git a/library/compiler-builtins/libm/.github/workflows/main.yaml b/library/compiler-builtins/libm/.github/workflows/main.yaml index 30976d472627..40b67c4c251a 100644 --- a/library/compiler-builtins/libm/.github/workflows/main.yaml +++ b/library/compiler-builtins/libm/.github/workflows/main.yaml @@ -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: diff --git a/library/compiler-builtins/libm/ci/calculate-exhaustive-matrix.py b/library/compiler-builtins/libm/ci/ci-util.py similarity index 87% rename from library/compiler-builtins/libm/ci/calculate-exhaustive-matrix.py rename to library/compiler-builtins/libm/ci/ci-util.py index 8b42f9389f93..733ec26fa33c 100755 --- a/library/compiler-builtins/libm/ci/calculate-exhaustive-matrix.py +++ b/library/compiler-builtins/libm/ci/ci-util.py @@ -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: + 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__": From b251f74843e654479fcea9b7954d474b05517a56 Mon Sep 17 00:00:00 2001 From: Trevor Gross Date: Wed, 15 Jan 2025 00:54:55 +0000 Subject: [PATCH 3/4] Pass --max-fail to nextest so it doesn't fail fast --- library/compiler-builtins/libm/ci/run.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/compiler-builtins/libm/ci/run.sh b/library/compiler-builtins/libm/ci/run.sh index 08ffaa81c6eb..bb749b72ad33 100755 --- a/library/compiler-builtins/libm/ci/run.sh +++ b/library/compiler-builtins/libm/ci/run.sh @@ -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 From 45e3b98165090965e3ec5c24ae497444703d33c9 Mon Sep 17 00:00:00 2001 From: Trevor Gross Date: Wed, 15 Jan 2025 01:05:38 +0000 Subject: [PATCH 4/4] Add an override for a recent failure MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Failed on i686: ──── STDERR: libm-test::bench/random y1f/crate thread 'main' panicked at crates/libm-test/benches/random.rs:76:65: called `Result::unwrap()` on an `Err` value: ynf Caused by: 0: input: (213, 109.15641) (0x000000d5, 0x42da5015) expected: -3.3049217e38 0xff78a27a actual: -inf 0xff800000 1: mismatched infinities --- .../libm/crates/libm-test/src/precision.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/library/compiler-builtins/libm/crates/libm-test/src/precision.rs b/library/compiler-builtins/libm/crates/libm-test/src/precision.rs index 15913fe6d759..0b3fe89befd1 100644 --- a/library/compiler-builtins/libm/crates/libm-test/src/precision.rs +++ b/library/compiler-builtins/libm/crates/libm-test/src/precision.rs @@ -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, } }