From ea3ca98f60152f713f50eb871ab49106f0f999d0 Mon Sep 17 00:00:00 2001 From: Anthony Shoumikhin Date: Mon, 2 Nov 2026 13:25:41 -0800 Subject: [PATCH] CI: stop the torch-free bindings check from matching load addresses The test-pybindings-no-aten job checks that the torch-free Python bindings do not link against PyTorch. It searches the output of `ldd` for "torch", "aten" or "c10". But `ldd` also prints where it loaded each library, as a hex number such as `(0x00007f8ec1000000)`, and such a number sometimes contains "c10". The job then fails after every test has passed, even though nothing links PyTorch. Use the check that release/1.6 already has (from #24338). It matches only library names, prints the `ldd` output, and fails on a missing dependency. Test plan: checked the `ldd` output of a library with five dependencies 4000 times. The old pattern matched 69 times and the new check never did. The new check still flags PyTorch's `libtorch_python.so`, and reports a missing dependency when that library is copied away from the libraries it needs. --- .github/workflows/pull.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pull.yml b/.github/workflows/pull.yml index 52c009b5608..9d79d795dfe 100644 --- a/.github/workflows/pull.yml +++ b/.github/workflows/pull.yml @@ -213,7 +213,13 @@ jobs: EXECUTORCH_PYBIND_TEST_BFLOAT16_CHANNELS_LAST_PTE=cmake-out-no-aten/add_bfloat16_channels_last.pte \ PYTHONPATH=cmake-out-no-aten:.. \ python extension/pybindings/test/test_pybindings_no_aten.py - if ldd cmake-out-no-aten/_C*.so | grep -Eiq 'torch|aten|c10'; then + NO_ATEN_LINKS="$(ldd cmake-out-no-aten/_C*.so)" + printf '%s\n' "$NO_ATEN_LINKS" + if grep -q 'not found' <<<"$NO_ATEN_LINKS"; then + echo "torch-free pybindings have a missing runtime dependency" + exit 1 + fi + if grep -Eiq '^[[:space:]]*(lib(torch|aten|c10)[^[:space:]/]*\.so|[^[:space:]]*/lib(torch|aten|c10)[^[:space:]/]*\.so)' <<<"$NO_ATEN_LINKS"; then echo "torch-free pybindings unexpectedly link against ATen" exit 1 fi