Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 12 additions & 0 deletions ci/configs/openindiana.bash
Original file line number Diff line number Diff line change
@@ -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)
5 changes: 3 additions & 2 deletions ci/scripts/ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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 .".
)
Expand Down
24 changes: 21 additions & 3 deletions test/mp/test/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#include <list> // IWYU pragma: keep
#include <map>
#include <memory>
#include <mp/config.h>
#include <mp/proxy.h>
#include <mp/proxy.capnp.h>
#include <mp/proxy-io.h>
Expand Down Expand Up @@ -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<messages::FooInterface>* foo = setup.client.get();
foo->initThreadMap();
Expand All @@ -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<messages::FooInterface>* foo = setup.client.get();
foo->initThreadMap();
Expand Down Expand Up @@ -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<std::string> thread_name;
{
TestSetup setup;
Expand All @@ -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")
{
Expand Down
Loading