luaPackages.luv: fix installCheckPhase on Darwin

This commit is contained in:
Alex James
2025-05-18 20:48:10 -05:00
parent dc2d5f0391
commit d58e5041de
3 changed files with 66 additions and 1 deletions
+17 -1
View File
@@ -1,4 +1,5 @@
{
stdenv,
lib,
buildLuarocksPackage,
cmake,
@@ -28,6 +29,18 @@ buildLuarocksPackage rec {
rm -rf deps/lua deps/luajit deps/libuv
'';
patches =
[
# Fails with "Uncaught Error: ./tests/test-dns.lua:164: assertion failed!"
# and "./tests/test-tty.lua:19: bad argument #1 to 'is_readable' (Expected
# uv_stream userdata)"
./disable-failing-tests.patch
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
# Fails with "Uncaught Error: ./tests/test-udp.lua:261: EHOSTUNREACH"
./disable-failing-darwin-tests.patch
];
buildInputs = [ libuv ];
nativeBuildInputs = [ cmake ];
@@ -56,10 +69,13 @@ buildLuarocksPackage rec {
EOF
'';
__darwinAllowLocalNetworking = true;
doInstallCheck = true;
installCheckPhase = ''
rm tests/test-{dns,thread,tty}.lua
runHook preInstallCheck
luarocks test
runHook postInstallCheck
'';
disabled = luaOlder "5.1";
@@ -0,0 +1,19 @@
diff --git a/tests/test-udp.lua b/tests/test-udp.lua
index bd0f46d..e4542b4 100644
--- a/tests/test-udp.lua
+++ b/tests/test-udp.lua
@@ -280,14 +280,6 @@ return require('lib/tap')(function (test)
-- same check for skipping the ipv6 test; we just expanded it to
-- the ipv4 test as well.
local function has_external_interface(uv, family)
- local addresses = assert(uv.interface_addresses())
- for _, vals in pairs(addresses) do
- for _, info in ipairs(vals) do
- if (not family or info.family == family) and not info.internal then
- return true
- end
- end
- end
return false
end
@@ -0,0 +1,30 @@
diff --git a/tests/test-dns.lua b/tests/test-dns.lua
index 894220b..0763b36 100644
--- a/tests/test-dns.lua
+++ b/tests/test-dns.lua
@@ -161,7 +161,6 @@ return require('lib/tap')(function (test)
p{err=err,hostname=hostname,service=service}
assert(not err, err)
assert(hostname)
- assert(service == "http")
end)))
end)
diff --git a/tests/test-tty.lua b/tests/test-tty.lua
index 165e58d..11368df 100644
--- a/tests/test-tty.lua
+++ b/tests/test-tty.lua
@@ -13,13 +13,10 @@ end
return require('lib/tap')(function (test)
test("tty normal", function (print, p, expect, uv)
- local stdin = uv.new_tty(0, true)
local stdout = uv.new_tty(1, false)
- assert(uv.is_readable(stdin))
assert(uv.is_writable(stdout))
- uv.close(stdin)
uv.close(stdout)
end)