From c13ff298bdd424d7b7401fce4f0379cda0348af8 Mon Sep 17 00:00:00 2001 From: Hisham Muhammad Date: Mon, 19 Feb 2024 11:55:39 -0300 Subject: fix(build): don't look for Lua headers when installing pure-Lua rocks This only applies to 'builtin' as we can't know about other modes, but this should be good enough. Fixes #1275. --- spec/build_spec.lua | 117 ------------------------------------------ spec/deps_spec.lua | 143 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 143 insertions(+), 117 deletions(-) (limited to 'spec') diff --git a/spec/build_spec.lua b/spec/build_spec.lua index 653f2160..3b33a1aa 100644 --- a/spec/build_spec.lua +++ b/spec/build_spec.lua @@ -598,123 +598,6 @@ describe("LuaRocks build #unit", function() end, finally) end) - describe("builtin.autodetect_external_dependencies", function() - it("returns false if the given build table has no external dependencies", function() - local build_table = { - type = "builtin" - } - - assert.falsy(build_builtin.autodetect_external_dependencies(build_table)) - end) - - it("returns a table of the external dependencies found in the given build table", function() - local build_table = { - type = "builtin", - modules = { - module1 = { - libraries = { "foo1", "foo2" }, - }, - module2 = { - libraries = "foo3" - }, - } - } - - local extdeps = build_builtin.autodetect_external_dependencies(build_table) - assert.same(extdeps["FOO1"], { library = "foo1" }) - assert.same(extdeps["FOO2"], { library = "foo2" }) - assert.same(extdeps["FOO3"], { library = "foo3" }) - end) - - it("adds proper include and library dirs to the given build table", function() - local build_table - - build_table = { - type = "builtin", - modules = { - module1 = { - libraries = "foo" - } - } - } - build_builtin.autodetect_external_dependencies(build_table) - assert.same(build_table, { - type = "builtin", - modules = { - module1 = { - libraries = "foo", - incdirs = { "$(FOO_INCDIR)" }, - libdirs = { "$(FOO_LIBDIR)" } - } - } - }) - - build_table = { - type = "builtin", - modules = { - module1 = { - libraries = "foo", - incdirs = { "INCDIRS" } - } - } - } - build_builtin.autodetect_external_dependencies(build_table) - assert.same(build_table, { - type = "builtin", - modules = { - module1 = { - libraries = "foo", - incdirs = { "INCDIRS" }, - libdirs = { "$(FOO_LIBDIR)" } - } - } - }) - - build_table = { - type = "builtin", - modules = { - module1 = { - libraries = "foo", - libdirs = { "LIBDIRS" } - } - } - } - build_builtin.autodetect_external_dependencies(build_table) - assert.same(build_table, { - type = "builtin", - modules = { - module1 = { - libraries = "foo", - incdirs = { "$(FOO_INCDIR)" }, - libdirs = { "LIBDIRS" } - } - } - }) - - build_table = { - type = "builtin", - modules = { - module1 = { - libraries = "foo", - incdirs = { "INCDIRS" }, - libdirs = { "LIBDIRS" } - } - } - } - build_builtin.autodetect_external_dependencies(build_table) - assert.same(build_table, { - type = "builtin", - modules = { - module1 = { - libraries = "foo", - incdirs = { "INCDIRS" }, - libdirs = { "LIBDIRS" } - } - } - }) - end) - end) - describe("builtin.autodetect_modules", function() local tmpdir local olddir diff --git a/spec/deps_spec.lua b/spec/deps_spec.lua index b0064298..32f68f51 100644 --- a/spec/deps_spec.lua +++ b/spec/deps_spec.lua @@ -116,3 +116,146 @@ describe("LuaRocks deps-mode #integration", function() assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lxsh/${LXSH}/lxsh-${LXSH}.rockspec")) end) end) + +test_env.unload_luarocks() +test_env.setup_specs() +local cfg = require("luarocks.core.cfg") +local deps = require("luarocks.deps") +local fs = require("luarocks.fs") + +describe("LuaRocks deps #unit", function() + local runner + + lazy_setup(function() + runner = require("luacov.runner") + runner.init(testing_paths.testrun_dir .. "/luacov.config") + runner.tick = true + cfg.init() + fs.init() + deps.check_lua_incdir(cfg.variables) + deps.check_lua_libdir(cfg.variables) + end) + + lazy_teardown(function() + runner.shutdown() + end) + + describe("deps", function() + describe("deps.autodetect_external_dependencies", function() + it("returns false if the given build table has no external dependencies", function() + local build_table = { + type = "builtin" + } + + assert.falsy(deps.autodetect_external_dependencies(build_table)) + end) + + it("returns a table of the external dependencies found in the given build table", function() + local build_table = { + type = "builtin", + modules = { + module1 = { + libraries = { "foo1", "foo2" }, + }, + module2 = { + libraries = "foo3" + }, + } + } + + local extdeps = deps.autodetect_external_dependencies(build_table) + assert.same(extdeps["FOO1"], { library = "foo1" }) + assert.same(extdeps["FOO2"], { library = "foo2" }) + assert.same(extdeps["FOO3"], { library = "foo3" }) + end) + + it("adds proper include and library dirs to the given build table", function() + local build_table + + build_table = { + type = "builtin", + modules = { + module1 = { + libraries = "foo" + } + } + } + deps.autodetect_external_dependencies(build_table) + assert.same(build_table, { + type = "builtin", + modules = { + module1 = { + libraries = "foo", + incdirs = { "$(FOO_INCDIR)" }, + libdirs = { "$(FOO_LIBDIR)" } + } + } + }) + + build_table = { + type = "builtin", + modules = { + module1 = { + libraries = "foo", + incdirs = { "INCDIRS" } + } + } + } + deps.autodetect_external_dependencies(build_table) + assert.same(build_table, { + type = "builtin", + modules = { + module1 = { + libraries = "foo", + incdirs = { "INCDIRS" }, + libdirs = { "$(FOO_LIBDIR)" } + } + } + }) + + build_table = { + type = "builtin", + modules = { + module1 = { + libraries = "foo", + libdirs = { "LIBDIRS" } + } + } + } + deps.autodetect_external_dependencies(build_table) + assert.same(build_table, { + type = "builtin", + modules = { + module1 = { + libraries = "foo", + incdirs = { "$(FOO_INCDIR)" }, + libdirs = { "LIBDIRS" } + } + } + }) + + build_table = { + type = "builtin", + modules = { + module1 = { + libraries = "foo", + incdirs = { "INCDIRS" }, + libdirs = { "LIBDIRS" } + } + } + } + deps.autodetect_external_dependencies(build_table) + assert.same(build_table, { + type = "builtin", + modules = { + module1 = { + libraries = "foo", + incdirs = { "INCDIRS" }, + libdirs = { "LIBDIRS" } + } + } + }) + end) + end) + end) +end) -- cgit v1.2.3-55-g6feb