Commit 0d09a057 authored by Alex James's avatar Alex James Committed by github-actions[bot]
Browse files

luaPackages.luv: fix `installCheckPhase` on Darwin

(cherry picked from commit d58e5041)
parent 59191bb8
Loading
Loading
Loading
Loading
+17 −1
Original line number Diff line number Diff line
{
  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";
+19 −0
Original line number Diff line number Diff line
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
 
+30 −0
Original line number Diff line number Diff line
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)