diff --git a/pkgs/by-name/li/libredirect/package.nix b/pkgs/by-name/li/libredirect/package.nix index 59e98b5eca65..2981d4d41a20 100644 --- a/pkgs/by-name/li/libredirect/package.nix +++ b/pkgs/by-name/li/libredirect/package.nix @@ -124,7 +124,7 @@ else installCheckPhase = '' ( source "$hook/nix-support/setup-hook" - NIX_REDIRECTS="/foo/bar/test=${coreutils}/bin/true:/bar/baz=$(mktemp -d)" ./test + NIX_REDIRECTS="/foo/bar/test=${coreutils}/bin/true:/bar/baz=$(mktemp -d):/run/sock=$PWD/test.sock" ./test ) ''; diff --git a/pkgs/by-name/li/libredirect/test.c b/pkgs/by-name/li/libredirect/test.c index 59a47d8a02ae..02233f0274e0 100644 --- a/pkgs/by-name/li/libredirect/test.c +++ b/pkgs/by-name/li/libredirect/test.c @@ -8,16 +8,32 @@ #include #include +#include #include #include +#include #include #define TESTDIR "/bar/baz" #define TESTPATH "/foo/bar/test" +#define TESTSOCK "/run/sock" #define SUBTEST "./test sub" extern char **environ; +void test_bind(void) { + int fd = socket(AF_UNIX, SOCK_STREAM, 0); + assert(fd != -1); + struct sockaddr_un addr = { + .sun_family = AF_UNIX, + .sun_path = TESTSOCK, + }; + unlink(TESTSOCK); + int ret = bind(fd, (struct sockaddr *)&addr, sizeof(addr)); + assert(ret == 0); + close(fd); +} + void test_spawn(void) { pid_t pid; int ret; @@ -160,6 +176,7 @@ int main(int argc, char *argv[]) assert(mktemp(buf) == buf); assert_mktemp_path(TESTDIR "/temp", "", buf); + test_bind(); test_spawn(); test_system(); test_stat_with_null_path();