From 88fd4610c2ebe488d42824e8beb1839db6b1a09a Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Fri, 6 Nov 2026 14:43:48 +0000 Subject: [PATCH 1/2] test: Skip thread name tests where OS thread names do not work The "has OS thread name" tests were compiled whenever `pthread_getname_np()` exists, but they also need a working `SetOsThreadName()`. Replace the `HAVE_PTHREAD_GETNAME_NP` guard with a runtime probe. If it fails, log a warning and return from the three tests. --- test/mp/test/test.cpp | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/test/mp/test/test.cpp b/test/mp/test/test.cpp index 519b79b3..45db1f9b 100644 --- a/test/mp/test/test.cpp +++ b/test/mp/test/test.cpp @@ -27,7 +27,6 @@ #include // IWYU pragma: keep #include #include -#include #include #include #include @@ -668,9 +667,27 @@ KJ_TEST("Call async IPC method dispatched to pool thread") } } -#ifdef HAVE_PTHREAD_GETNAME_NP +//! Return whether OS thread names set by SetOsThreadName() +//! can be read back by ThreadName() on this platform. +static bool OsThreadNamesSupported() +{ + static const bool supported = [] { + bool found = false; + std::thread([&found] { + SetOsThreadName("mptest-probe"); + found = ThreadName("").find("/mptest-probe-") != std::string::npos; + }).join(); + if (!found) { + KJ_LOG(WARNING, "OS thread names cannot be set and read back on this platform; skipping thread name tests"); + } + return found; + }(); + return supported; +} + KJ_TEST("Worker thread has OS thread name") { + if (!OsThreadNamesSupported()) return; TestSetup setup; ProxyClient* foo = setup.client.get(); foo->initThreadMap(); @@ -685,6 +702,7 @@ KJ_TEST("Worker thread has OS thread name") KJ_TEST("Pool thread has OS thread name") { + if (!OsThreadNamesSupported()) return; TestSetup setup; ProxyClient* foo = setup.client.get(); foo->initThreadMap(); @@ -717,6 +735,7 @@ KJ_TEST("Pool thread has OS thread name") KJ_TEST("Async cleanup thread has OS thread name") { + if (!OsThreadNamesSupported()) return; std::promise thread_name; { TestSetup setup; @@ -728,7 +747,6 @@ KJ_TEST("Async cleanup thread has OS thread name") const std::string name{thread_name.get_future().get()}; KJ_EXPECT(name.find("/capnp-async-") != std::string::npos, name); } -#endif // HAVE_PTHREAD_GETNAME_NP KJ_TEST("Call async IPC method without thread or pool errors correctly") { From 33be4c6fc71aaad4d5ff9695ce2a6993df41c143 Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Fri, 6 Nov 2026 15:36:05 +0000 Subject: [PATCH 2/2] ci: Add OpenIndiana job This covers code paths for illumos-based systems. --- .github/workflows/ci.yml | 22 ++++++++++++++++++++++ ci/configs/openindiana.bash | 12 ++++++++++++ ci/scripts/ci.sh | 5 +++-- 3 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 ci/configs/openindiana.bash diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index df7ec90a..ad3760b9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -115,6 +115,28 @@ jobs: cd ${{ github.workspace }} CI_CONFIG="ci/configs/freebsd.bash" bash ci/scripts/ci.sh + build-openindiana: + runs-on: ubuntu-latest + name: build • openindiana + defaults: + run: + shell: openindiana {0} + steps: + - uses: actions/checkout@v7 + + - name: Start OpenIndiana VM + uses: vmactions/openindiana-vm@v1 + with: + prepare: | + pkg install cmake gcc-14 git ninja + sync: 'rsync' + copyback: false + + - name: Run CI script + run: | + cd ${{ github.workspace }} + CI_CONFIG="ci/configs/openindiana.bash" bash ci/scripts/ci.sh + build-macos: runs-on: macos-latest name: build • macos diff --git a/ci/configs/openindiana.bash b/ci/configs/openindiana.bash new file mode 100644 index 00000000..b4a603e7 --- /dev/null +++ b/ci/configs/openindiana.bash @@ -0,0 +1,12 @@ +CI_DESC="CI config for OpenIndiana" +CI_DIR=build-openindiana +# OpenIndiana does not package Cap'n Proto, so build it from source. +CAPNP_CHECKOUT=v1.5.0 +# KJ fibers do not work on illumos. +CAPNP_CMAKE_ARGS=(-DWITH_FIBERS=OFF) +# The -pthread flag works around a bug in CMake's FindThreads module. +# See https://gitlab.kitware.com/cmake/cmake/-/issues/26063. +export CXXFLAGS="-pthread -Werror -Wall -Wextra -Wpedantic -Wunused -Wunused-const-variable" +# The socket API lives in libsocket on illumos. +CMAKE_ARGS=(-G Ninja -DCMAKE_EXE_LINKER_FLAGS=-lsocket) +BUILD_ARGS=(-k 0) diff --git a/ci/scripts/ci.sh b/ci/scripts/ci.sh index 8016d921..ccb999cd 100755 --- a/ci/scripts/ci.sh +++ b/ci/scripts/ci.sh @@ -21,7 +21,8 @@ cmake --version cmake_ver=$(cmake --version | awk '/version/{print $3; exit}') ver_ge() { [ "$(printf '%s\n' "$2" "$1" | sort -V | head -n1)" = "$2" ]; } -# If CAPNP_CHECKOUT was requested, clone and install requested Cap'n Proto branch or tag +# If CAPNP_CHECKOUT was requested, clone and install requested Cap'n Proto branch or tag. +# CAPNP_CMAKE_ARGS may hold extra CMake options for that build. capnp_prefix= if [ -n "${CAPNP_CHECKOUT-}" ]; then capnp_prefix="$PWD/capnp-install" @@ -30,7 +31,7 @@ if [ -n "${CAPNP_CHECKOUT-}" ]; then ( cd capnp/build git --no-pager log -1 || true - CXXFLAGS="-std=c++20" cmake .. "-DCMAKE_INSTALL_PREFIX=${capnp_prefix}" -DBUILD_TESTING=OFF -DWITH_OPENSSL=OFF -DWITH_ZLIB=OFF + CXXFLAGS="-std=c++20" cmake .. "-DCMAKE_INSTALL_PREFIX=${capnp_prefix}" -DBUILD_TESTING=OFF -DWITH_OPENSSL=OFF -DWITH_ZLIB=OFF "${CAPNP_CMAKE_ARGS[@]+"${CAPNP_CMAKE_ARGS[@]}"}" cmake --build . cmake --build . --target install # Replacement for modern "cmake --install .". )