From ecd00703a6efa400368af1821fd8bf6441ace415 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 25 Jun 2026 14:46:30 +0000 Subject: [PATCH] fix: skip packages without C benchmarks in benchmark-random-c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `benchmark-random-c` uses `PACKAGES_PATTERN='manifest.json'` to select random packages. WASM packages (e.g. `@stdlib/blas/base/wasm/*`) carry a `manifest.json` listing their C dependencies but ship no `benchmark/c/*.c` file and require Emscripten to compile — unavailable in CI. When one of these packages was selected, `benchmark-c` failed, causing the `random_benchmarks` CI workflow to fail on ~97% of runs (29/30 in 30 days). Add a pre-flight guard that checks for `*.c` files inside the package's `benchmark/` directory before invoking `benchmark-c`. Packages without C benchmarks are silently skipped, leaving the `manifest.json` selection pool intact while eliminating the false-positive failures. --- tools/make/lib/benchmark/c.mk | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tools/make/lib/benchmark/c.mk b/tools/make/lib/benchmark/c.mk index d4da95322317..fe642e88282e 100644 --- a/tools/make/lib/benchmark/c.mk +++ b/tools/make/lib/benchmark/c.mk @@ -114,11 +114,13 @@ benchmark-c-files: #/ benchmark-random-c: $(NODE_MODULES) $(QUIET) $(MAKE) -f $(this_file) -s list-random-lib-pkgs PACKAGES_PATTERN='manifest.json' | while read -r pkg; do \ - echo ""; \ - echo "Running benchmark: $$pkg"; \ - NODE_ENV="$(NODE_ENV_BENCHMARK)" \ - NODE_PATH="$(NODE_PATH_BENCHMARK)" \ - $(MAKE) -f $(this_file) benchmark-c BENCHMARKS_FILTER="$$pkg/.*" || exit 1; \ + if find "$$pkg/benchmark" -name "*.c" 2>/dev/null | grep -q .; then \ + echo ""; \ + echo "Running benchmark: $$pkg"; \ + NODE_ENV="$(NODE_ENV_BENCHMARK)" \ + NODE_PATH="$(NODE_PATH_BENCHMARK)" \ + $(MAKE) -f $(this_file) benchmark-c BENCHMARKS_FILTER="$$pkg/.*" || exit 1; \ + fi; \ done .PHONY: benchmark-random-c