From 96b3f50b1b54849f463cfc7b12ee092618a72a79 Mon Sep 17 00:00:00 2001 From: hja Date: Sun, 15 Nov 2026 20:03:49 +0000 Subject: [PATCH] ci: speed up macOS job --- .github/workflows/build.yml | 7 +++--- tests/case-23-multi-address-hostname.bash | 27 ++++++++++++++++------- 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fae3221f..9460e706 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -31,7 +31,7 @@ jobs: steps: - uses: actions/checkout@v3 - name: install dependencies - run: brew install pkg-config libtool autoconf automake groff + run: brew install libtool autoconf automake - name: configure run: LSOF_INCLUDE=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include ./Configure -n darwin - name: make @@ -42,10 +42,9 @@ jobs: run: | git clean -fdx . autoreconf -vif - ./configure + ./configure --disable-manpages make DESTDIR=$PWD/prefix make install - make check - name: dist build and test run: | make dist @@ -53,7 +52,7 @@ jobs: cd temp tar xvf ../lsof-*.tar.gz cd lsof-* - ./configure + ./configure --disable-manpages make DESTDIR=$PWD/prefix make install make check diff --git a/tests/case-23-multi-address-hostname.bash b/tests/case-23-multi-address-hostname.bash index a0b8a875..d99605fc 100755 --- a/tests/case-23-multi-address-hostname.bash +++ b/tests/case-23-multi-address-hostname.bash @@ -13,19 +13,30 @@ if ! command -v python3 >/dev/null 2>&1; then fi host=$(hostname) +# Resolving a .local host name through mDNS can block for a long time on some +# machines, so cap the lookup and treat a timeout as "no addresses". naddr=$(python3 - "$host" <<'PY' +import os import socket import sys +import threading host = sys.argv[1] -count = 0 -for family in (socket.AF_INET, socket.AF_INET6): - try: - infos = socket.getaddrinfo(host, None, family, socket.SOCK_STREAM) - except OSError: - continue - count = max(count, len({info[4][0] for info in infos})) -print(count) +count = [0] + +def resolve(): + for family in (socket.AF_INET, socket.AF_INET6): + try: + infos = socket.getaddrinfo(host, None, family, socket.SOCK_STREAM) + except OSError: + continue + count[0] = max(count[0], len({info[4][0] for info in infos})) + +resolver = threading.Thread(target=resolve, daemon=True) +resolver.start() +resolver.join(5) +print(count[0], flush=True) +os._exit(0) PY )