From 2871199838131b5a4c5a99d8e1fedbcd26017b0e Mon Sep 17 00:00:00 2001 From: Hisham Muhammad Date: Thu, 12 Apr 2018 17:13:43 -0300 Subject: Tests: build_dependencies --- spec/build_spec.lua | 8 ++++++++ spec/fixtures/a_repo/a_build_dep-1.0-1.rockspec | 18 +++++++++++++++++ spec/fixtures/a_repo/a_build_dep-1.0-1.src.rock | Bin 0 -> 575 bytes spec/fixtures/a_repo/has_build_dep-1.0-1.all.rock | Bin 0 -> 1010 bytes spec/fixtures/a_repo/has_build_dep-1.0-1.rockspec | 22 +++++++++++++++++++++ spec/fixtures/a_repo/has_build_dep-1.0-1.src.rock | Bin 0 -> 584 bytes spec/fixtures/a_repo/manifest | 23 ++++++++++++++++++++++ spec/fixtures/a_repo/manifest-5.1 | 23 ++++++++++++++++++++++ spec/fixtures/a_repo/manifest-5.2 | 23 ++++++++++++++++++++++ spec/fixtures/a_repo/manifest-5.3 | 23 ++++++++++++++++++++++ spec/install_spec.lua | 9 +++++++++ 11 files changed, 149 insertions(+) create mode 100644 spec/fixtures/a_repo/a_build_dep-1.0-1.rockspec create mode 100644 spec/fixtures/a_repo/a_build_dep-1.0-1.src.rock create mode 100644 spec/fixtures/a_repo/has_build_dep-1.0-1.all.rock create mode 100644 spec/fixtures/a_repo/has_build_dep-1.0-1.rockspec create mode 100644 spec/fixtures/a_repo/has_build_dep-1.0-1.src.rock (limited to 'spec') diff --git a/spec/build_spec.lua b/spec/build_spec.lua index ed36dbd2..5c363570 100644 --- a/spec/build_spec.lua +++ b/spec/build_spec.lua @@ -249,5 +249,13 @@ describe("LuaRocks build tests #blackbox #b_build", function() assert.is.truthy(run.luarocks("show with_external_dep")) end) end) + + describe("#build_dependencies", function() + it("builds with a build dependency", function() + assert(run.luarocks_bool("build has_build_dep --server=" .. testing_paths.fixtures_dir .. "/a_repo" )) + assert(run.luarocks_bool("show has_build_dep 1.0")) + assert(run.luarocks_bool("show a_build_dep 1.0")) + end) + end) end) diff --git a/spec/fixtures/a_repo/a_build_dep-1.0-1.rockspec b/spec/fixtures/a_repo/a_build_dep-1.0-1.rockspec new file mode 100644 index 00000000..2398d3db --- /dev/null +++ b/spec/fixtures/a_repo/a_build_dep-1.0-1.rockspec @@ -0,0 +1,18 @@ +rockspec_format = "3.0" +package = "a_build_dep" +version = "1.0-1" +source = { + url = "http://localhost:8080/file/a_rock.lua" +} +description = { + summary = "An example rockspec that is a build dependency for has_build_dep.", +} +dependencies = { + "lua >= 5.1", +} +build = { + type = "builtin", + modules = { + build_dep = "a_rock.lua" + }, +} diff --git a/spec/fixtures/a_repo/a_build_dep-1.0-1.src.rock b/spec/fixtures/a_repo/a_build_dep-1.0-1.src.rock new file mode 100644 index 00000000..c56ee34d Binary files /dev/null and b/spec/fixtures/a_repo/a_build_dep-1.0-1.src.rock differ diff --git a/spec/fixtures/a_repo/has_build_dep-1.0-1.all.rock b/spec/fixtures/a_repo/has_build_dep-1.0-1.all.rock new file mode 100644 index 00000000..a2d09ab2 Binary files /dev/null and b/spec/fixtures/a_repo/has_build_dep-1.0-1.all.rock differ diff --git a/spec/fixtures/a_repo/has_build_dep-1.0-1.rockspec b/spec/fixtures/a_repo/has_build_dep-1.0-1.rockspec new file mode 100644 index 00000000..417473a6 --- /dev/null +++ b/spec/fixtures/a_repo/has_build_dep-1.0-1.rockspec @@ -0,0 +1,22 @@ +rockspec_format = "3.0" +package = "has_build_dep" +version = "1.0-1" +source = { + url = "http://localhost:8080/file/a_rock.lua" +} +description = { + summary = "An example rockspec that has build dependencies.", +} +dependencies = { + "a_rock", + "lua >= 5.1", +} +build_dependencies = { + "a_build_dep", +} +build = { + type = "builtin", + modules = { + bla = "a_rock.lua" + }, +} diff --git a/spec/fixtures/a_repo/has_build_dep-1.0-1.src.rock b/spec/fixtures/a_repo/has_build_dep-1.0-1.src.rock new file mode 100644 index 00000000..fc4e11b9 Binary files /dev/null and b/spec/fixtures/a_repo/has_build_dep-1.0-1.src.rock differ diff --git a/spec/fixtures/a_repo/manifest b/spec/fixtures/a_repo/manifest index 141dafb5..1a5f8d55 100644 --- a/spec/fixtures/a_repo/manifest +++ b/spec/fixtures/a_repo/manifest @@ -1,6 +1,16 @@ commands = {} modules = {} repository = { + a_build_dep = { + ["1.0-1"] = { + { + arch = "src" + }, + { + arch = "rockspec" + } + } + }, a_rock = { ["1.0-1"] = { { @@ -21,6 +31,19 @@ repository = { } } }, + has_build_dep = { + ["1.0-1"] = { + { + arch = "rockspec" + }, + { + arch = "src" + }, + { + arch = "all" + } + } + }, has_namespaced_dep = { ["1.0-1"] = { { diff --git a/spec/fixtures/a_repo/manifest-5.1 b/spec/fixtures/a_repo/manifest-5.1 index 141dafb5..1a5f8d55 100644 --- a/spec/fixtures/a_repo/manifest-5.1 +++ b/spec/fixtures/a_repo/manifest-5.1 @@ -1,6 +1,16 @@ commands = {} modules = {} repository = { + a_build_dep = { + ["1.0-1"] = { + { + arch = "src" + }, + { + arch = "rockspec" + } + } + }, a_rock = { ["1.0-1"] = { { @@ -21,6 +31,19 @@ repository = { } } }, + has_build_dep = { + ["1.0-1"] = { + { + arch = "rockspec" + }, + { + arch = "src" + }, + { + arch = "all" + } + } + }, has_namespaced_dep = { ["1.0-1"] = { { diff --git a/spec/fixtures/a_repo/manifest-5.2 b/spec/fixtures/a_repo/manifest-5.2 index 141dafb5..1a5f8d55 100644 --- a/spec/fixtures/a_repo/manifest-5.2 +++ b/spec/fixtures/a_repo/manifest-5.2 @@ -1,6 +1,16 @@ commands = {} modules = {} repository = { + a_build_dep = { + ["1.0-1"] = { + { + arch = "src" + }, + { + arch = "rockspec" + } + } + }, a_rock = { ["1.0-1"] = { { @@ -21,6 +31,19 @@ repository = { } } }, + has_build_dep = { + ["1.0-1"] = { + { + arch = "rockspec" + }, + { + arch = "src" + }, + { + arch = "all" + } + } + }, has_namespaced_dep = { ["1.0-1"] = { { diff --git a/spec/fixtures/a_repo/manifest-5.3 b/spec/fixtures/a_repo/manifest-5.3 index 141dafb5..1a5f8d55 100644 --- a/spec/fixtures/a_repo/manifest-5.3 +++ b/spec/fixtures/a_repo/manifest-5.3 @@ -1,6 +1,16 @@ commands = {} modules = {} repository = { + a_build_dep = { + ["1.0-1"] = { + { + arch = "src" + }, + { + arch = "rockspec" + } + } + }, a_rock = { ["1.0-1"] = { { @@ -21,6 +31,19 @@ repository = { } } }, + has_build_dep = { + ["1.0-1"] = { + { + arch = "rockspec" + }, + { + arch = "src" + }, + { + arch = "all" + } + } + }, has_namespaced_dep = { ["1.0-1"] = { { diff --git a/spec/install_spec.lua b/spec/install_spec.lua index 4043af35..b4273692 100644 --- a/spec/install_spec.lua +++ b/spec/install_spec.lua @@ -223,4 +223,13 @@ describe("luarocks install #blackbox #b_install", function() assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/say/1.0-1")) end) end) + + describe("#build_dependencies", function() + it("install does not install a build dependency", function() + assert(run.luarocks_bool("install has_build_dep --server=" .. testing_paths.fixtures_dir .. "/a_repo" )) + assert(run.luarocks_bool("show has_build_dep 1.0")) + assert.falsy(run.luarocks_bool("show a_build_dep 1.0")) + end) + end) + end) -- cgit v1.2.3-55-g6feb