diff options
Diffstat (limited to 'spec/build_spec.lua')
-rw-r--r-- | spec/build_spec.lua | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/spec/build_spec.lua b/spec/build_spec.lua index 7d18ae4c..7dc4af03 100644 --- a/spec/build_spec.lua +++ b/spec/build_spec.lua | |||
@@ -55,7 +55,7 @@ describe("LuaRocks build #integration", function() | |||
55 | it("invalid", function() | 55 | it("invalid", function() |
56 | assert.is_false(run.luarocks_bool("build invalid")) | 56 | assert.is_false(run.luarocks_bool("build invalid")) |
57 | end) | 57 | end) |
58 | 58 | ||
59 | it("with no arguments behaves as luarocks make", function() | 59 | it("with no arguments behaves as luarocks make", function() |
60 | test_env.run_in_tmp(function(tmpdir) | 60 | test_env.run_in_tmp(function(tmpdir) |
61 | write_file("c_module-1.0-1.rockspec", [[ | 61 | write_file("c_module-1.0-1.rockspec", [[ |
@@ -72,7 +72,7 @@ describe("LuaRocks build #integration", function() | |||
72 | } | 72 | } |
73 | ]], finally) | 73 | ]], finally) |
74 | write_file("c_module.c", c_module_source, finally) | 74 | write_file("c_module.c", c_module_source, finally) |
75 | 75 | ||
76 | assert.is_true(run.luarocks_bool("build")) | 76 | assert.is_true(run.luarocks_bool("build")) |
77 | assert.truthy(lfs.attributes(tmpdir .. "/c_module." .. test_env.lib_extension)) | 77 | assert.truthy(lfs.attributes(tmpdir .. "/c_module." .. test_env.lib_extension)) |
78 | end, finally) | 78 | end, finally) |
@@ -84,12 +84,12 @@ describe("LuaRocks build #integration", function() | |||
84 | assert.is_false(run.luarocks_bool("build --tree=/usr " .. testing_paths.fixtures_dir .. "/a_rock-1.0.1-rockspec")) | 84 | assert.is_false(run.luarocks_bool("build --tree=/usr " .. testing_paths.fixtures_dir .. "/a_rock-1.0.1-rockspec")) |
85 | assert.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/a_rock/1.0-1/a_rock-1.0-1.rockspec")) | 85 | assert.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/a_rock/1.0-1/a_rock-1.0-1.rockspec")) |
86 | end) | 86 | end) |
87 | 87 | ||
88 | it("fails if it doesn't have the permissions to access the specified tree's parent #unix", function() | 88 | it("fails if it doesn't have the permissions to access the specified tree's parent #unix", function() |
89 | assert.is_false(run.luarocks_bool("build --tree=/usr/invalid " .. testing_paths.fixtures_dir .. "/a_rock-1.0-1.rockspec")) | 89 | assert.is_false(run.luarocks_bool("build --tree=/usr/invalid " .. testing_paths.fixtures_dir .. "/a_rock-1.0-1.rockspec")) |
90 | assert.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/a_rock/1.0-1/a_rock-1.0-1.rockspec")) | 90 | assert.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/a_rock/1.0-1/a_rock-1.0-1.rockspec")) |
91 | end) | 91 | end) |
92 | 92 | ||
93 | it("verbose", function() | 93 | it("verbose", function() |
94 | test_env.run_in_tmp(function(tmpdir) | 94 | test_env.run_in_tmp(function(tmpdir) |
95 | write_file("test-1.0-1.rockspec", [[ | 95 | write_file("test-1.0-1.rockspec", [[ |
@@ -99,7 +99,7 @@ describe("LuaRocks build #integration", function() | |||
99 | url = "file://]] .. tmpdir:gsub("\\", "/") .. [[/test.lua" | 99 | url = "file://]] .. tmpdir:gsub("\\", "/") .. [[/test.lua" |
100 | } | 100 | } |
101 | build = { | 101 | build = { |
102 | type = "builtin", | 102 | type = "builtin", |
103 | modules = { | 103 | modules = { |
104 | test = "test.lua" | 104 | test = "test.lua" |
105 | } | 105 | } |
@@ -111,14 +111,14 @@ describe("LuaRocks build #integration", function() | |||
111 | assert.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/test/1.0-1/test-1.0-1.rockspec")) | 111 | assert.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/test/1.0-1/test-1.0-1.rockspec")) |
112 | end, finally) | 112 | end, finally) |
113 | end) | 113 | end) |
114 | 114 | ||
115 | it("fails if the deps-mode argument is invalid", function() | 115 | it("fails if the deps-mode argument is invalid", function() |
116 | assert.is_false(run.luarocks_bool("build --deps-mode=123 " .. testing_paths.fixtures_dir .. "/a_rock-1.0-1.rockspec")) | 116 | assert.is_false(run.luarocks_bool("build --deps-mode=123 " .. testing_paths.fixtures_dir .. "/a_rock-1.0-1.rockspec")) |
117 | assert.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/a_rock/1.0-1/a_rock-1.0-1.rockspec")) | 117 | assert.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/a_rock/1.0-1/a_rock-1.0-1.rockspec")) |
118 | end) | 118 | end) |
119 | 119 | ||
120 | it("with --only-sources", function() | 120 | it("with --only-sources", function() |
121 | assert.is_true(run.luarocks_bool("download --server=" .. testing_paths.fixtures_dir .. "/a_repo --rockspec a_rock 1.0")) | 121 | assert.is_true(run.luarocks_bool("download --server=" .. testing_paths.fixtures_dir .. "/a_repo --rockspec a_rock 1.0")) |
122 | assert.is_false(run.luarocks_bool("build --only-sources=\"http://example.com\" a_rock-1.0-1.rockspec")) | 122 | assert.is_false(run.luarocks_bool("build --only-sources=\"http://example.com\" a_rock-1.0-1.rockspec")) |
123 | assert.is.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/a_rock/1.0-1/a_rock-1.0-1.rockspec")) | 123 | assert.is.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/a_rock/1.0-1/a_rock-1.0-1.rockspec")) |
124 | 124 | ||
@@ -129,7 +129,7 @@ describe("LuaRocks build #integration", function() | |||
129 | assert.is_true(os.remove("a_rock-1.0-1.rockspec")) | 129 | assert.is_true(os.remove("a_rock-1.0-1.rockspec")) |
130 | assert.is_true(os.remove("a_rock-1.0-1.src.rock")) | 130 | assert.is_true(os.remove("a_rock-1.0-1.src.rock")) |
131 | end) | 131 | end) |
132 | 132 | ||
133 | it("fails if an empty tree is given", function() | 133 | it("fails if an empty tree is given", function() |
134 | assert.is_false(run.luarocks_bool("build --tree=\"\" " .. testing_paths.fixtures_dir .. "/a_rock-1.0-1.rockspec")) | 134 | assert.is_false(run.luarocks_bool("build --tree=\"\" " .. testing_paths.fixtures_dir .. "/a_rock-1.0-1.rockspec")) |
135 | assert.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/a_rock/1.0-1/a_rock-1.0-1.rockspec")) | 135 | assert.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/a_rock/1.0-1/a_rock-1.0-1.rockspec")) |
@@ -141,12 +141,12 @@ describe("LuaRocks build #integration", function() | |||
141 | assert.is_true(run.luarocks_bool("build luacov 0.13.0-1")) | 141 | assert.is_true(run.luarocks_bool("build luacov 0.13.0-1")) |
142 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/luacov/0.13.0-1/luacov-0.13.0-1.rockspec")) | 142 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/luacov/0.13.0-1/luacov-0.13.0-1.rockspec")) |
143 | end) | 143 | end) |
144 | 144 | ||
145 | it("command stdlib", function() | 145 | it("command stdlib", function() |
146 | assert.is_true(run.luarocks_bool("build stdlib")) | 146 | assert.is_true(run.luarocks_bool("build stdlib")) |
147 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/stdlib/41.0.0-1/stdlib-41.0.0-1.rockspec")) | 147 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/stdlib/41.0.0-1/stdlib-41.0.0-1.rockspec")) |
148 | end) | 148 | end) |
149 | 149 | ||
150 | it("fails if the current platform is not supported", function() | 150 | it("fails if the current platform is not supported", function() |
151 | test_env.run_in_tmp(function(tmpdir) | 151 | test_env.run_in_tmp(function(tmpdir) |
152 | write_file("test-1.0-1.rockspec", [[ | 152 | write_file("test-1.0-1.rockspec", [[ |
@@ -159,7 +159,7 @@ describe("LuaRocks build #integration", function() | |||
159 | "unix", "macosx" | 159 | "unix", "macosx" |
160 | } | 160 | } |
161 | build = { | 161 | build = { |
162 | type = "builtin", | 162 | type = "builtin", |
163 | modules = { | 163 | modules = { |
164 | test = "test.lua" | 164 | test = "test.lua" |
165 | } | 165 | } |
@@ -176,7 +176,7 @@ describe("LuaRocks build #integration", function() | |||
176 | end | 176 | end |
177 | end, finally) | 177 | end, finally) |
178 | end) | 178 | end) |
179 | 179 | ||
180 | it("with skipping dependency checks", function() | 180 | it("with skipping dependency checks", function() |
181 | test_env.run_in_tmp(function(tmpdir) | 181 | test_env.run_in_tmp(function(tmpdir) |
182 | write_file("test-1.0-1.rockspec", [[ | 182 | write_file("test-1.0-1.rockspec", [[ |
@@ -189,7 +189,7 @@ describe("LuaRocks build #integration", function() | |||
189 | "a_rock 1.0" | 189 | "a_rock 1.0" |
190 | } | 190 | } |
191 | build = { | 191 | build = { |
192 | type = "builtin", | 192 | type = "builtin", |
193 | modules = { | 193 | modules = { |
194 | test = "test.lua" | 194 | test = "test.lua" |
195 | } | 195 | } |
@@ -342,7 +342,7 @@ describe("LuaRocks build #integration", function() | |||
342 | assert.is.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/build_only_deps/0.1-1/build_only_deps-0.1-1.rockspec")) | 342 | assert.is.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/build_only_deps/0.1-1/build_only_deps-0.1-1.rockspec")) |
343 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/a_rock/1.0-1/a_rock-1.0-1.rockspec")) | 343 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/a_rock/1.0-1/a_rock-1.0-1.rockspec")) |
344 | end) | 344 | end) |
345 | 345 | ||
346 | it("only deps of a given rockspec", function() | 346 | it("only deps of a given rockspec", function() |
347 | test_env.run_in_tmp(function(tmpdir) | 347 | test_env.run_in_tmp(function(tmpdir) |
348 | write_file("test-1.0-1.rockspec", [[ | 348 | write_file("test-1.0-1.rockspec", [[ |
@@ -355,7 +355,7 @@ describe("LuaRocks build #integration", function() | |||
355 | "a_rock 1.0" | 355 | "a_rock 1.0" |
356 | } | 356 | } |
357 | build = { | 357 | build = { |
358 | type = "builtin", | 358 | type = "builtin", |
359 | modules = { | 359 | modules = { |
360 | test = "test.lua" | 360 | test = "test.lua" |
361 | } | 361 | } |
@@ -381,7 +381,7 @@ describe("LuaRocks build #integration", function() | |||
381 | "a_rock 1.0" | 381 | "a_rock 1.0" |
382 | } | 382 | } |
383 | build = { | 383 | build = { |
384 | type = "builtin", | 384 | type = "builtin", |
385 | modules = { | 385 | modules = { |
386 | test = "test.lua" | 386 | test = "test.lua" |
387 | } | 387 | } |
@@ -406,18 +406,18 @@ describe("LuaRocks build #integration", function() | |||
406 | describe("rockspec format 3.0 #rs3", function() | 406 | describe("rockspec format 3.0 #rs3", function() |
407 | local tmpdir | 407 | local tmpdir |
408 | local olddir | 408 | local olddir |
409 | 409 | ||
410 | before_each(function() | 410 | before_each(function() |
411 | tmpdir = get_tmp_path() | 411 | tmpdir = get_tmp_path() |
412 | olddir = lfs.currentdir() | 412 | olddir = lfs.currentdir() |
413 | lfs.mkdir(tmpdir) | 413 | lfs.mkdir(tmpdir) |
414 | lfs.chdir(tmpdir) | 414 | lfs.chdir(tmpdir) |
415 | 415 | ||
416 | lfs.mkdir("autodetect") | 416 | lfs.mkdir("autodetect") |
417 | write_file("autodetect/bla.lua", "return {}", finally) | 417 | write_file("autodetect/bla.lua", "return {}", finally) |
418 | write_file("c_module.c", c_module_source, finally) | 418 | write_file("c_module.c", c_module_source, finally) |
419 | end) | 419 | end) |
420 | 420 | ||
421 | after_each(function() | 421 | after_each(function() |
422 | if olddir then | 422 | if olddir then |
423 | lfs.chdir(olddir) | 423 | lfs.chdir(olddir) |
@@ -427,7 +427,7 @@ describe("LuaRocks build #integration", function() | |||
427 | end | 427 | end |
428 | end | 428 | end |
429 | end) | 429 | end) |
430 | 430 | ||
431 | it("defaults to build.type == 'builtin'", function() | 431 | it("defaults to build.type == 'builtin'", function() |
432 | local rockspec = "a_rock-1.0-1.rockspec" | 432 | local rockspec = "a_rock-1.0-1.rockspec" |
433 | test_env.write_file(rockspec, [[ | 433 | test_env.write_file(rockspec, [[ |
@@ -509,7 +509,7 @@ describe("LuaRocks build #integration", function() | |||
509 | lazy_teardown(function() | 509 | lazy_teardown(function() |
510 | test_env.mock_server_done() | 510 | test_env.mock_server_done() |
511 | end) | 511 | end) |
512 | 512 | ||
513 | it("fails when missing external dependency", function() | 513 | it("fails when missing external dependency", function() |
514 | test_env.run_in_tmp(function(tmpdir) | 514 | test_env.run_in_tmp(function(tmpdir) |
515 | write_file("missing_external-0.1-1.rockspec", [[ | 515 | write_file("missing_external-0.1-1.rockspec", [[ |
@@ -545,7 +545,7 @@ describe("LuaRocks build #integration", function() | |||
545 | assert.is.truthy(run.luarocks("show with_external_dep")) | 545 | assert.is.truthy(run.luarocks("show with_external_dep")) |
546 | end) | 546 | end) |
547 | end) | 547 | end) |
548 | 548 | ||
549 | describe("#build_dependencies", function() | 549 | describe("#build_dependencies", function() |
550 | it("builds with a build dependency", function() | 550 | it("builds with a build dependency", function() |
551 | assert(run.luarocks_bool("build has_build_dep --server=" .. testing_paths.fixtures_dir .. "/a_repo" )) | 551 | assert(run.luarocks_bool("build has_build_dep --server=" .. testing_paths.fixtures_dir .. "/a_repo" )) |
@@ -969,7 +969,7 @@ describe("LuaRocks build #unit", function() | |||
969 | elseif test_env.TEST_TARGET_OS == "osx" then | 969 | elseif test_env.TEST_TARGET_OS == "osx" then |
970 | os.execute("cc -dynamiclib -o " .. fdir .. "/libfixturedep.dylib " .. fdir .. "/fixturedep.c") | 970 | os.execute("cc -dynamiclib -o " .. fdir .. "/libfixturedep.dylib " .. fdir .. "/fixturedep.c") |
971 | end | 971 | end |
972 | 972 | ||
973 | local rockspec = { | 973 | local rockspec = { |
974 | rockspec_format = "3.0", | 974 | rockspec_format = "3.0", |
975 | package = "c_module", | 975 | package = "c_module", |
@@ -1026,7 +1026,7 @@ describe("LuaRocks build #unit", function() | |||
1026 | lazy_setup(function() | 1026 | lazy_setup(function() |
1027 | git = git_repo.start() | 1027 | git = git_repo.start() |
1028 | end) | 1028 | end) |
1029 | 1029 | ||
1030 | lazy_teardown(function() | 1030 | lazy_teardown(function() |
1031 | if git then | 1031 | if git then |
1032 | git:stop() | 1032 | git:stop() |