Commit 03441d57 authored by Oliver Giles's avatar Oliver Giles

unix-abstract: add test

parent 363b8143
......@@ -28,6 +28,7 @@
#include "windows-sanity.h"
#else
#include <netdb.h>
#include <unistd.h>
#endif
namespace kj {
......@@ -388,5 +389,22 @@ TEST(AsyncIo, Udp) {
#endif // !_WIN32
#ifdef __linux__ // Abstract unix sockets are only supported on Linux
TEST(AsyncIo, AbstractUnixSocket) {
auto ioContext = setupAsyncIo();
auto& network = ioContext.provider->getNetwork();
Own<NetworkAddress> addr = network.parseAddress("unix-abstract:foo").wait(ioContext.waitScope);
Own<ConnectionReceiver> listener = addr->listen();
// chdir proves no filesystem dependence. Test fails for regular unix socket
// but passes for abstract unix socket.
chdir("/tmp");
addr->connect().attach(kj::mv(listener)).wait(ioContext.waitScope);
}
#endif // __linux__
} // namespace
} // namespace kj
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment