diff --git a/test/endpoint_unx.cpp b/test/endpoint_unx.cpp index 0a01cdd..fbf3cf2 100644 --- a/test/endpoint_unx.cpp +++ b/test/endpoint_unx.cpp @@ -40,6 +40,14 @@ using namespace std::chrono_literals; #if !defined(_WIN32) namespace { +// Linux supports abstract Unix sockets (null-byte prefix, no filesystem entry). +// FreeBSD and macOS only support file-based Unix sockets. +#if defined(__linux__) +constexpr auto unx_socket_mode = mode::abstract; +#else +constexpr auto unx_socket_mode = mode::file; +#endif + struct controller { handle ep_listen; handle ep_connect; @@ -59,7 +67,7 @@ struct controller { return ok(); } if (m("path", extract(path))) { - ep_connect = connect(path).value(); + ep_connect = connect(path, unx_socket_mode).value(); return ok(); } if (m("connected")) { @@ -85,12 +93,12 @@ struct controller { auto endpoint_unx(context &ctx, bool &result, env_t env_) -> ::result { stringstream ss; - ss << "/net/vdbonline/thespian/endpoint_t_" << getpid(); + ss << "/tmp/thespian_endpoint_t_" << getpid(); const string path = ss.str(); return to_result(ctx.spawn_link( [path]() { link(env().proc("log")); - handle ep_listen = listen(path).value(); + handle ep_listen = listen(path, unx_socket_mode).value(); receive([p{make_shared(ep_listen)}](const auto &from, const auto &m) { return p->receive(from, m); diff --git a/test/tests_cpp.zig b/test/tests_cpp.zig index b8ee481..b695d09 100644 --- a/test/tests_cpp.zig +++ b/test/tests_cpp.zig @@ -18,7 +18,7 @@ test "debug" { } test "endpoint_unx" { - if (builtin.os.tag == .linux) { + if (builtin.os.tag != .windows) { try testcase("endpoint_unx"); } }