aboutsummaryrefslogtreecommitdiff
path: root/spec/build_spec.lua
diff options
context:
space:
mode:
Diffstat (limited to 'spec/build_spec.lua')
-rw-r--r--spec/build_spec.lua44
1 files changed, 20 insertions, 24 deletions
diff --git a/spec/build_spec.lua b/spec/build_spec.lua
index d64ace4d..14837d89 100644
--- a/spec/build_spec.lua
+++ b/spec/build_spec.lua
@@ -20,11 +20,11 @@ local extra_rocks = {
20 "/lpeg-1.0.0-1.rockspec", 20 "/lpeg-1.0.0-1.rockspec",
21 "/lpeg-1.0.0-1.src.rock", 21 "/lpeg-1.0.0-1.src.rock",
22 "/luafilesystem-1.6.3-1.src.rock", 22 "/luafilesystem-1.6.3-1.src.rock",
23 "/luasec-0.6-1.rockspec",
24 "/luasocket-3.0rc1-2.src.rock", 23 "/luasocket-3.0rc1-2.src.rock",
25 "/luasocket-3.0rc1-2.rockspec", 24 "/luasocket-3.0rc1-2.rockspec",
26 "/stdlib-41.0.0-1.src.rock", 25 "/stdlib-41.0.0-1.src.rock",
27 "/validate-args-1.5.4-1.rockspec" 26 "/validate-args-1.5.4-1.rockspec",
27 "spec/fixtures/a_rock-1.0-1.src.rock",
28} 28}
29 29
30local c_module_source = [[ 30local c_module_source = [[
@@ -290,10 +290,13 @@ describe("LuaRocks build #integration", function()
290 end) 290 end)
291 end 291 end
292 292
293 it("luasec only deps", function() 293 it("only deps", function()
294 assert.is_true(run.luarocks_bool("build luasec " .. test_env.openssl_dirs .. " --only-deps")) 294 local rockspec = testing_paths.fixtures_dir .. "/build_only_deps-0.1-1.rockspec"
295 assert.is_false(run.luarocks_bool("show luasec")) 295
296 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/luasec/0.6-1/luasec-0.6-1.rockspec")) 296 assert.is_true(run.luarocks_bool("build " .. rockspec .. " --only-deps"))
297 assert.is_false(run.luarocks_bool("show build_only_deps"))
298 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/build_only_deps/0.1-1/build_only_deps-0.1-1.rockspec"))
299 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/a_rock/1.0-1/a_rock-1.0-1.rockspec"))
297 end) 300 end)
298 301
299 it("only deps of a given rockspec", function() 302 it("only deps of a given rockspec", function()
@@ -351,16 +354,6 @@ describe("LuaRocks build #integration", function()
351 end, finally) 354 end, finally)
352 end) 355 end)
353 356
354 it("with https", function()
355 assert.is_true(run.luarocks_bool("download --rockspec validate-args 1.5.4-1"))
356 assert.is_true(run.luarocks_bool("install luasec " .. test_env.openssl_dirs))
357
358 assert.is_true(run.luarocks_bool("build validate-args-1.5.4-1.rockspec"))
359 assert.is.truthy(run.luarocks("show validate-args"))
360 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/validate-args/1.5.4-1/validate-args-1.5.4-1.rockspec"))
361 assert.is_true(os.remove("validate-args-1.5.4-1.rockspec"))
362 end)
363
364 it("fails if given an argument with an invalid patch", function() 357 it("fails if given an argument with an invalid patch", function()
365 assert.is_false(run.luarocks_bool("build " .. testing_paths.fixtures_dir .. "/invalid_patch-0.1-1.rockspec")) 358 assert.is_false(run.luarocks_bool("build " .. testing_paths.fixtures_dir .. "/invalid_patch-0.1-1.rockspec"))
366 end) 359 end)
@@ -899,15 +892,19 @@ describe("LuaRocks build #unit", function()
899 end) 892 end)
900 893
901 it("automatically extracts the modules and libraries if they are not given and builds against any external dependencies", function() 894 it("automatically extracts the modules and libraries if they are not given and builds against any external dependencies", function()
902 local ssllib = "ssl" 895 local fdir = testing_paths.fixtures_dir
903 if test_env.TEST_TARGET_OS == "windows" then 896 if test_env.TEST_TARGET_OS == "windows" then
904 if test_env.MINGW then 897 if test_env.MINGW then
905 ssllib = "eay32" 898 os.execute("gcc -shared -o " .. fdir .. "/libfixturedep.dll -Wl,--out-implib," .. fdir .."/libfixturedep.a " .. fdir .. "/fixturedep.c")
906 else 899 else
907 ssllib = "ssleay32" 900 os.execute("cl " .. fdir .. "\\fixturedep.c /link /export:fixturedep_fn /out:" .. fdir .. "\\fixturedep.dll /implib:" .. fdir .. "\\fixturedep.lib")
908 end 901 end
902 elseif test_env.TEST_TARGET_OS == "linux" then
903 os.execute("gcc -shared -o " .. fdir .. "/libfixturedep.so " .. fdir .. "/fixturedep.c")
904 elseif test_env.TEST_TARGET_OS == "osx" then
905 os.execute("cc -dynamiclib -o " .. fdir .. "/libfixturedep.dylib " .. fdir .. "/fixturedep.c")
909 end 906 end
910 907
911 local rockspec = { 908 local rockspec = {
912 rockspec_format = "3.0", 909 rockspec_format = "3.0",
913 package = "c_module", 910 package = "c_module",
@@ -916,8 +913,8 @@ describe("LuaRocks build #unit", function()
916 url = "http://example.com/c_module" 913 url = "http://example.com/c_module"
917 }, 914 },
918 external_dependencies = { 915 external_dependencies = {
919 OPENSSL = { 916 FIXTUREDEP = {
920 library = ssllib -- Use OpenSSL since it is available on all testing platforms 917 library = "fixturedep"
921 } 918 }
922 }, 919 },
923 build = { 920 build = {
@@ -927,8 +924,7 @@ describe("LuaRocks build #unit", function()
927 write_file("c_module.c", c_module_source, finally) 924 write_file("c_module.c", c_module_source, finally)
928 925
929 rockspecs.from_persisted_table("c_module-1.0-1.rockspec", rockspec) 926 rockspecs.from_persisted_table("c_module-1.0-1.rockspec", rockspec)
930 rockspec.variables["OPENSSL_INCDIR"] = test_env.OPENSSL_INCDIR 927 rockspec.variables["FIXTUREDEP_LIBDIR"] = testing_paths.fixtures_dir
931 rockspec.variables["OPENSSL_LIBDIR"] = test_env.OPENSSL_LIBDIR
932 assert.truthy(build_builtin.run(rockspec)) 928 assert.truthy(build_builtin.run(rockspec))
933 end) 929 end)
934 930