diff options
-rw-r--r-- | .busted | 2 | ||||
-rw-r--r-- | spec/add_spec.lua | 4 | ||||
-rw-r--r-- | spec/build_spec.lua | 12 | ||||
-rw-r--r-- | spec/config_spec.lua | 2 | ||||
-rw-r--r-- | spec/deps_spec.lua | 2 | ||||
-rw-r--r-- | spec/doc_spec.lua | 2 | ||||
-rw-r--r-- | spec/download_spec.lua | 2 | ||||
-rw-r--r-- | spec/fetch_spec.lua | 2 | ||||
-rw-r--r-- | spec/fixtures/a_rock-1.0-1.rockspec (renamed from test/testfiles/a_rock-1.0-1.rockspec) | 0 | ||||
-rw-r--r-- | spec/fixtures/a_rock.lua (renamed from test/testfiles/a_rock.lua) | 0 | ||||
-rw-r--r-- | spec/fixtures/invalid_patch-0.1-1.rockspec (renamed from test/testfiles/invalid_patch-0.1-1.rockspec) | 0 | ||||
-rw-r--r-- | spec/fixtures/invalid_validate-args-1.5.4-1.rockspec (renamed from test/testfiles/invalid_validate-args-1.5.4-1.rockspec) | 0 | ||||
-rw-r--r-- | spec/fixtures/luajit-fail-1.0-1.rockspec (renamed from test/testfiles/luajit-fail-1.0-1.rockspec) | 0 | ||||
-rw-r--r-- | spec/fixtures/luajit-success-1.0-1.rockspec (renamed from test/testfiles/luajit-success-1.0-1.rockspec) | 0 | ||||
-rw-r--r-- | spec/fixtures/missing_external-0.1-1.rockspec (renamed from test/testfiles/missing_external-0.1-1.rockspec) | 0 | ||||
-rw-r--r-- | spec/fixtures/mixed_deploy_type/mdt.c (renamed from test/testfiles/mixed_deploy_type/mdt.c) | 0 | ||||
-rw-r--r-- | spec/fixtures/mixed_deploy_type/mdt.lua (renamed from test/testfiles/mixed_deploy_type/mdt.lua) | 0 | ||||
-rw-r--r-- | spec/fixtures/mixed_deploy_type/mdt_file (renamed from test/testfiles/mixed_deploy_type/mdt_file) | 0 | ||||
-rw-r--r-- | spec/fixtures/mixed_deploy_type/mixed_deploy_type-0.1.0-1.rockspec (renamed from test/testfiles/mixed_deploy_type/mixed_deploy_type-0.1.0-1.rockspec) | 0 | ||||
-rw-r--r-- | spec/fixtures/mixed_deploy_type/mixed_deploy_type-0.2.0-1.rockspec (renamed from test/testfiles/mixed_deploy_type/mixed_deploy_type-0.2.0-1.rockspec) | 0 | ||||
-rw-r--r-- | spec/fixtures/no_build_table-0.1-1.rockspec (renamed from test/testfiles/no_build_table-0.1-1.rockspec) | 0 | ||||
-rw-r--r-- | spec/fixtures/not_a_zipfile-1.0-1.src.rock (renamed from test/testfiles/not_a_zipfile-1.0-1.src.rock) | 0 | ||||
-rw-r--r-- | spec/fixtures/patch_create_delete-0.1-1.rockspec | 34 | ||||
-rw-r--r-- | spec/fixtures/patch_create_delete/a_file.txt (renamed from test/testfiles/patch_create_delete/a_file.txt) | 0 | ||||
-rw-r--r-- | spec/fixtures/type_mismatch_string-1.0-1.rockspec (renamed from test/testfiles/type_mismatch_string-1.0-1.rockspec) | 0 | ||||
-rw-r--r-- | spec/fixtures/type_mismatch_table-1.0-1.rockspec (renamed from test/testfiles/type_mismatch_table-1.0-1.rockspec) | 0 | ||||
-rw-r--r-- | spec/fixtures/type_mismatch_version-1.0-1.rockspec (renamed from test/testfiles/type_mismatch_version-1.0-1.rockspec) | 0 | ||||
-rw-r--r-- | spec/fixtures/with_external_dep-0.1-1.rockspec (renamed from test/testfiles/with_external_dep-0.1-1.rockspec) | 0 | ||||
-rw-r--r-- | spec/fixtures/with_external_dep.c (renamed from test/testfiles/with_external_dep.c) | 0 | ||||
-rw-r--r-- | spec/fixtures/with_external_dep/foo/foo.h (renamed from test/testfiles/with_external_dep/foo/foo.h) | 0 | ||||
-rw-r--r-- | spec/fixtures/with_external_dep/foo/foo.h.gch (renamed from test/testfiles/with_external_dep/foo/foo.h.gch) | bin | 1503664 -> 1503664 bytes | |||
-rw-r--r-- | spec/fs_spec.lua | 2 | ||||
-rw-r--r-- | spec/help_spec.lua | 2 | ||||
-rw-r--r-- | spec/install_spec.lua | 6 | ||||
-rw-r--r-- | spec/lint_spec.lua | 10 | ||||
-rw-r--r-- | spec/list_spec.lua | 2 | ||||
-rw-r--r-- | spec/make_manifest_spec.lua | 2 | ||||
-rw-r--r-- | spec/make_spec.lua | 4 | ||||
-rw-r--r-- | spec/new_version_spec.lua | 2 | ||||
-rw-r--r-- | spec/pack_spec.lua | 4 | ||||
-rw-r--r-- | spec/path_spec.lua | 2 | ||||
-rw-r--r-- | spec/persist.lua | 2 | ||||
-rw-r--r-- | spec/purge_spec.lua | 2 | ||||
-rw-r--r-- | spec/refresh_cache_spec.lua | 2 | ||||
-rw-r--r-- | spec/remove_spec.lua | 2 | ||||
-rw-r--r-- | spec/search_spec.lua | 2 | ||||
-rw-r--r-- | spec/show_spec.lua | 2 | ||||
-rw-r--r-- | spec/unpack_spec.lua | 4 | ||||
-rw-r--r-- | spec/upload_spec.lua | 6 | ||||
-rw-r--r-- | spec/util/mock-server.lua (renamed from test/mock-server.lua) | 2 | ||||
-rw-r--r-- | spec/util/test_env.lua (renamed from test/test_environment.lua) | 60 | ||||
-rw-r--r-- | spec/util_spec.lua | 2 | ||||
-rw-r--r-- | spec/write_rockspec_spec.lua | 26 | ||||
-rw-r--r-- | test/luarocks_site.lua | 6 | ||||
-rw-r--r-- | test/testfiles/patch_create_delete-0.1-1.rockspec | 34 |
55 files changed, 129 insertions, 121 deletions
@@ -1,6 +1,6 @@ | |||
1 | return { | 1 | return { |
2 | default = { | 2 | default = { |
3 | helper = "test/test_environment", | 3 | helper = "spec.util.test_env", |
4 | ["auto-insulate"] = false | 4 | ["auto-insulate"] = false |
5 | } | 5 | } |
6 | } | 6 | } |
diff --git a/spec/add_spec.lua b/spec/add_spec.lua index d42a97d0..1bc9e2a3 100644 --- a/spec/add_spec.lua +++ b/spec/add_spec.lua | |||
@@ -1,4 +1,4 @@ | |||
1 | local test_env = require("test/test_environment") | 1 | local test_env = require("spec.util.test_env") |
2 | local run = test_env.run | 2 | local run = test_env.run |
3 | local testing_paths = test_env.testing_paths | 3 | local testing_paths = test_env.testing_paths |
4 | 4 | ||
@@ -34,7 +34,7 @@ describe("LuaRocks add tests #blackbox #b_add", function() | |||
34 | 34 | ||
35 | --TODO This test fails, sftp support not yet implemented | 35 | --TODO This test fails, sftp support not yet implemented |
36 | it("LuaRocks-admin add invalid server", function() | 36 | it("LuaRocks-admin add invalid server", function() |
37 | assert.is_false(run.luarocks_admin_bool("--server=testing add luasocket-3.0rc1-2.src.rock", { LUAROCKS_CONFIG = testing_paths.testing_dir .. "/testing_config_sftp.lua" } )) | 37 | assert.is_false(run.luarocks_admin_bool("--server=testing add luasocket-3.0rc1-2.src.rock", { LUAROCKS_CONFIG = testing_paths.testrun_dir .. "/testing_config_sftp.lua" } )) |
38 | end) | 38 | end) |
39 | 39 | ||
40 | it("LuaRocks-admin add, split server url", function() | 40 | it("LuaRocks-admin add, split server url", function() |
diff --git a/spec/build_spec.lua b/spec/build_spec.lua index 459a7292..2de05879 100644 --- a/spec/build_spec.lua +++ b/spec/build_spec.lua | |||
@@ -1,4 +1,4 @@ | |||
1 | local test_env = require("test/test_environment") | 1 | local test_env = require("spec.util.test_env") |
2 | local lfs = require("lfs") | 2 | local lfs = require("lfs") |
3 | local run = test_env.run | 3 | local run = test_env.run |
4 | local testing_paths = test_env.testing_paths | 4 | local testing_paths = test_env.testing_paths |
@@ -140,7 +140,7 @@ describe("LuaRocks build tests #blackbox #b_build", function() | |||
140 | describe("LuaRocks build - more complex tests", function() | 140 | describe("LuaRocks build - more complex tests", function() |
141 | if test_env.TYPE_TEST_ENV == "full" then | 141 | if test_env.TYPE_TEST_ENV == "full" then |
142 | it("LuaRocks build luacheck show downloads test_config", function() | 142 | it("LuaRocks build luacheck show downloads test_config", function() |
143 | local output = run.luarocks("build luacheck", { LUAROCKS_CONFIG = testing_paths.testing_dir .. "/testing_config_show_downloads.lua"} ) | 143 | local output = run.luarocks("build luacheck", { LUAROCKS_CONFIG = testing_paths.testrun_dir .. "/testing_config_show_downloads.lua"} ) |
144 | assert.is.truthy(output:match("%.%.%.")) | 144 | assert.is.truthy(output:match("%.%.%.")) |
145 | end) | 145 | end) |
146 | end | 146 | end |
@@ -190,7 +190,7 @@ describe("LuaRocks build tests #blackbox #b_build", function() | |||
190 | end) | 190 | end) |
191 | 191 | ||
192 | it("LuaRocks build invalid patch", function() | 192 | it("LuaRocks build invalid patch", function() |
193 | assert.is_false(run.luarocks_bool("build " .. testing_paths.testing_dir .. "/testfiles/invalid_patch-0.1-1.rockspec")) | 193 | assert.is_false(run.luarocks_bool("build " .. testing_paths.fixtures_dir .. "/invalid_patch-0.1-1.rockspec")) |
194 | end) | 194 | end) |
195 | end) | 195 | end) |
196 | 196 | ||
@@ -204,12 +204,12 @@ describe("LuaRocks build tests #blackbox #b_build", function() | |||
204 | end) | 204 | end) |
205 | 205 | ||
206 | it("fails when missing external dependency", function() | 206 | it("fails when missing external dependency", function() |
207 | assert.is_false(run.luarocks_bool("build " .. testing_paths.testing_dir .. "/testfiles/missing_external-0.1-1.rockspec INEXISTENT_INCDIR=\"/invalid/dir\"")) | 207 | assert.is_false(run.luarocks_bool("build " .. testing_paths.fixtures_dir .. "/missing_external-0.1-1.rockspec INEXISTENT_INCDIR=\"/invalid/dir\"")) |
208 | end) | 208 | end) |
209 | 209 | ||
210 | it("builds with external dependency", function() | 210 | it("builds with external dependency", function() |
211 | local rockspec = testing_paths.testing_dir .. "/testfiles/with_external_dep-0.1-1.rockspec" | 211 | local rockspec = testing_paths.fixtures_dir .. "/with_external_dep-0.1-1.rockspec" |
212 | local foo_incdir = testing_paths.testing_dir .. "/testfiles/with_external_dep" | 212 | local foo_incdir = testing_paths.fixtures_dir .. "/with_external_dep" |
213 | assert.is_truthy(run.luarocks_bool("build " .. rockspec .. " FOO_INCDIR=\"" .. foo_incdir .. "\"")) | 213 | assert.is_truthy(run.luarocks_bool("build " .. rockspec .. " FOO_INCDIR=\"" .. foo_incdir .. "\"")) |
214 | assert.is.truthy(run.luarocks("show with_external_dep")) | 214 | assert.is.truthy(run.luarocks("show with_external_dep")) |
215 | end) | 215 | end) |
diff --git a/spec/config_spec.lua b/spec/config_spec.lua index 6be586c2..fae68474 100644 --- a/spec/config_spec.lua +++ b/spec/config_spec.lua | |||
@@ -1,4 +1,4 @@ | |||
1 | local test_env = require("test/test_environment") | 1 | local test_env = require("spec.util.test_env") |
2 | local lfs = require("lfs") | 2 | local lfs = require("lfs") |
3 | local run = test_env.run | 3 | local run = test_env.run |
4 | local testing_paths = test_env.testing_paths | 4 | local testing_paths = test_env.testing_paths |
diff --git a/spec/deps_spec.lua b/spec/deps_spec.lua index 8c4effcd..76ee68a7 100644 --- a/spec/deps_spec.lua +++ b/spec/deps_spec.lua | |||
@@ -1,4 +1,4 @@ | |||
1 | local test_env = require("test/test_environment") | 1 | local test_env = require("spec.util.test_env") |
2 | local lfs = require("lfs") | 2 | local lfs = require("lfs") |
3 | local run = test_env.run | 3 | local run = test_env.run |
4 | local testing_paths = test_env.testing_paths | 4 | local testing_paths = test_env.testing_paths |
diff --git a/spec/doc_spec.lua b/spec/doc_spec.lua index ea42cd6b..5f503af2 100644 --- a/spec/doc_spec.lua +++ b/spec/doc_spec.lua | |||
@@ -1,4 +1,4 @@ | |||
1 | local test_env = require("test/test_environment") | 1 | local test_env = require("spec.util.test_env") |
2 | local run = test_env.run | 2 | local run = test_env.run |
3 | local testing_paths = test_env.testing_paths | 3 | local testing_paths = test_env.testing_paths |
4 | 4 | ||
diff --git a/spec/download_spec.lua b/spec/download_spec.lua index 320d9304..64443922 100644 --- a/spec/download_spec.lua +++ b/spec/download_spec.lua | |||
@@ -1,4 +1,4 @@ | |||
1 | local test_env = require("test/test_environment") | 1 | local test_env = require("spec.util.test_env") |
2 | local lfs = require("lfs") | 2 | local lfs = require("lfs") |
3 | local run = test_env.run | 3 | local run = test_env.run |
4 | 4 | ||
diff --git a/spec/fetch_spec.lua b/spec/fetch_spec.lua index ab2cd54e..59f73b57 100644 --- a/spec/fetch_spec.lua +++ b/spec/fetch_spec.lua | |||
@@ -1,4 +1,4 @@ | |||
1 | local test_env = require("test/test_environment") | 1 | local test_env = require("spec.util.test_env") |
2 | 2 | ||
3 | test_env.unload_luarocks() | 3 | test_env.unload_luarocks() |
4 | local fetch = require("luarocks.fetch") | 4 | local fetch = require("luarocks.fetch") |
diff --git a/test/testfiles/a_rock-1.0-1.rockspec b/spec/fixtures/a_rock-1.0-1.rockspec index 9f15e87a..9f15e87a 100644 --- a/test/testfiles/a_rock-1.0-1.rockspec +++ b/spec/fixtures/a_rock-1.0-1.rockspec | |||
diff --git a/test/testfiles/a_rock.lua b/spec/fixtures/a_rock.lua index a5647075..a5647075 100644 --- a/test/testfiles/a_rock.lua +++ b/spec/fixtures/a_rock.lua | |||
diff --git a/test/testfiles/invalid_patch-0.1-1.rockspec b/spec/fixtures/invalid_patch-0.1-1.rockspec index c2ecd160..c2ecd160 100644 --- a/test/testfiles/invalid_patch-0.1-1.rockspec +++ b/spec/fixtures/invalid_patch-0.1-1.rockspec | |||
diff --git a/test/testfiles/invalid_validate-args-1.5.4-1.rockspec b/spec/fixtures/invalid_validate-args-1.5.4-1.rockspec index 0b4d807d..0b4d807d 100644 --- a/test/testfiles/invalid_validate-args-1.5.4-1.rockspec +++ b/spec/fixtures/invalid_validate-args-1.5.4-1.rockspec | |||
diff --git a/test/testfiles/luajit-fail-1.0-1.rockspec b/spec/fixtures/luajit-fail-1.0-1.rockspec index f8204600..f8204600 100644 --- a/test/testfiles/luajit-fail-1.0-1.rockspec +++ b/spec/fixtures/luajit-fail-1.0-1.rockspec | |||
diff --git a/test/testfiles/luajit-success-1.0-1.rockspec b/spec/fixtures/luajit-success-1.0-1.rockspec index 31c930c3..31c930c3 100644 --- a/test/testfiles/luajit-success-1.0-1.rockspec +++ b/spec/fixtures/luajit-success-1.0-1.rockspec | |||
diff --git a/test/testfiles/missing_external-0.1-1.rockspec b/spec/fixtures/missing_external-0.1-1.rockspec index 5f8e6219..5f8e6219 100644 --- a/test/testfiles/missing_external-0.1-1.rockspec +++ b/spec/fixtures/missing_external-0.1-1.rockspec | |||
diff --git a/test/testfiles/mixed_deploy_type/mdt.c b/spec/fixtures/mixed_deploy_type/mdt.c index a162ce23..a162ce23 100644 --- a/test/testfiles/mixed_deploy_type/mdt.c +++ b/spec/fixtures/mixed_deploy_type/mdt.c | |||
diff --git a/test/testfiles/mixed_deploy_type/mdt.lua b/spec/fixtures/mixed_deploy_type/mdt.lua index c9ca9c68..c9ca9c68 100644 --- a/test/testfiles/mixed_deploy_type/mdt.lua +++ b/spec/fixtures/mixed_deploy_type/mdt.lua | |||
diff --git a/test/testfiles/mixed_deploy_type/mdt_file b/spec/fixtures/mixed_deploy_type/mdt_file index 1a15f7d7..1a15f7d7 100644 --- a/test/testfiles/mixed_deploy_type/mdt_file +++ b/spec/fixtures/mixed_deploy_type/mdt_file | |||
diff --git a/test/testfiles/mixed_deploy_type/mixed_deploy_type-0.1.0-1.rockspec b/spec/fixtures/mixed_deploy_type/mixed_deploy_type-0.1.0-1.rockspec index 91b725da..91b725da 100644 --- a/test/testfiles/mixed_deploy_type/mixed_deploy_type-0.1.0-1.rockspec +++ b/spec/fixtures/mixed_deploy_type/mixed_deploy_type-0.1.0-1.rockspec | |||
diff --git a/test/testfiles/mixed_deploy_type/mixed_deploy_type-0.2.0-1.rockspec b/spec/fixtures/mixed_deploy_type/mixed_deploy_type-0.2.0-1.rockspec index 9ca03180..9ca03180 100644 --- a/test/testfiles/mixed_deploy_type/mixed_deploy_type-0.2.0-1.rockspec +++ b/spec/fixtures/mixed_deploy_type/mixed_deploy_type-0.2.0-1.rockspec | |||
diff --git a/test/testfiles/no_build_table-0.1-1.rockspec b/spec/fixtures/no_build_table-0.1-1.rockspec index 5d79e9a0..5d79e9a0 100644 --- a/test/testfiles/no_build_table-0.1-1.rockspec +++ b/spec/fixtures/no_build_table-0.1-1.rockspec | |||
diff --git a/test/testfiles/not_a_zipfile-1.0-1.src.rock b/spec/fixtures/not_a_zipfile-1.0-1.src.rock index e36f8bbe..e36f8bbe 100644 --- a/test/testfiles/not_a_zipfile-1.0-1.src.rock +++ b/spec/fixtures/not_a_zipfile-1.0-1.src.rock | |||
diff --git a/spec/fixtures/patch_create_delete-0.1-1.rockspec b/spec/fixtures/patch_create_delete-0.1-1.rockspec new file mode 100644 index 00000000..3d55da58 --- /dev/null +++ b/spec/fixtures/patch_create_delete-0.1-1.rockspec | |||
@@ -0,0 +1,34 @@ | |||
1 | rockspec_format = "3.0" | ||
2 | package = "patch_create_delete" | ||
3 | version = "0.1-1" | ||
4 | source = { | ||
5 | -- any valid URL | ||
6 | url = "git://github.com/luarocks/luarocks" | ||
7 | } | ||
8 | description = { | ||
9 | summary = "A rockspec with a patch that creates and deletes files", | ||
10 | } | ||
11 | dependencies = { | ||
12 | "lua >= 5.1" | ||
13 | } | ||
14 | build = { | ||
15 | type = "builtin", | ||
16 | modules = { | ||
17 | ["luarocks.loader"] = "src/luarocks/loader.lua" | ||
18 | }, | ||
19 | patches = { | ||
20 | ["create_delete.patch"] = | ||
21 | [[ | ||
22 | diff -Naur luarocks/spec/fixtures/patch_create_delete/a_file.txt luarocks-patch/spec/fixtures/patch_create_delete/a_file.txt | ||
23 | --- luarocks/spec/fixtures/patch_create_delete/a_file.txt 2017-10-04 15:39:44.179306674 -0300 | ||
24 | +++ luarocks-patch/spec/fixtures/patch_create_delete/a_file.txt 1969-12-31 21:00:00.000000000 -0300 | ||
25 | @@ -1 +0,0 @@ | ||
26 | -I am a file. | ||
27 | diff -Naur luarocks/spec/fixtures/patch_create_delete/another_file.txt luarocks-patch/spec/fixtures/patch_create_delete/another_file.txt | ||
28 | --- luarocks/spec/fixtures/patch_create_delete/another_file.txt 1969-12-31 21:00:00.000000000 -0300 | ||
29 | +++ luarocks-patch/spec/fixtures/patch_create_delete/another_file.txt 2017-10-04 15:40:12.836306564 -0300 | ||
30 | @@ -0,0 +1 @@ | ||
31 | +I am another file. | ||
32 | ]] | ||
33 | } | ||
34 | } | ||
diff --git a/test/testfiles/patch_create_delete/a_file.txt b/spec/fixtures/patch_create_delete/a_file.txt index 6539c24e..6539c24e 100644 --- a/test/testfiles/patch_create_delete/a_file.txt +++ b/spec/fixtures/patch_create_delete/a_file.txt | |||
diff --git a/test/testfiles/type_mismatch_string-1.0-1.rockspec b/spec/fixtures/type_mismatch_string-1.0-1.rockspec index 7a607cfd..7a607cfd 100644 --- a/test/testfiles/type_mismatch_string-1.0-1.rockspec +++ b/spec/fixtures/type_mismatch_string-1.0-1.rockspec | |||
diff --git a/test/testfiles/type_mismatch_table-1.0-1.rockspec b/spec/fixtures/type_mismatch_table-1.0-1.rockspec index f348b798..f348b798 100644 --- a/test/testfiles/type_mismatch_table-1.0-1.rockspec +++ b/spec/fixtures/type_mismatch_table-1.0-1.rockspec | |||
diff --git a/test/testfiles/type_mismatch_version-1.0-1.rockspec b/spec/fixtures/type_mismatch_version-1.0-1.rockspec index 5e30dae6..5e30dae6 100644 --- a/test/testfiles/type_mismatch_version-1.0-1.rockspec +++ b/spec/fixtures/type_mismatch_version-1.0-1.rockspec | |||
diff --git a/test/testfiles/with_external_dep-0.1-1.rockspec b/spec/fixtures/with_external_dep-0.1-1.rockspec index 45fea4bd..45fea4bd 100644 --- a/test/testfiles/with_external_dep-0.1-1.rockspec +++ b/spec/fixtures/with_external_dep-0.1-1.rockspec | |||
diff --git a/test/testfiles/with_external_dep.c b/spec/fixtures/with_external_dep.c index 16435d8f..16435d8f 100644 --- a/test/testfiles/with_external_dep.c +++ b/spec/fixtures/with_external_dep.c | |||
diff --git a/test/testfiles/with_external_dep/foo/foo.h b/spec/fixtures/with_external_dep/foo/foo.h index eedd558f..eedd558f 100644 --- a/test/testfiles/with_external_dep/foo/foo.h +++ b/spec/fixtures/with_external_dep/foo/foo.h | |||
diff --git a/test/testfiles/with_external_dep/foo/foo.h.gch b/spec/fixtures/with_external_dep/foo/foo.h.gch index 66165c9e..66165c9e 100644 --- a/test/testfiles/with_external_dep/foo/foo.h.gch +++ b/spec/fixtures/with_external_dep/foo/foo.h.gch | |||
Binary files differ | |||
diff --git a/spec/fs_spec.lua b/spec/fs_spec.lua index c76f47a4..17ac90ab 100644 --- a/spec/fs_spec.lua +++ b/spec/fs_spec.lua | |||
@@ -1,4 +1,4 @@ | |||
1 | local test_env = require("test/test_environment") | 1 | local test_env = require("spec.util.test_env") |
2 | 2 | ||
3 | test_env.unload_luarocks() | 3 | test_env.unload_luarocks() |
4 | local fs = require("luarocks.fs") | 4 | local fs = require("luarocks.fs") |
diff --git a/spec/help_spec.lua b/spec/help_spec.lua index 71b1b9f6..f7bb79b3 100644 --- a/spec/help_spec.lua +++ b/spec/help_spec.lua | |||
@@ -1,4 +1,4 @@ | |||
1 | local test_env = require("test/test_environment") | 1 | local test_env = require("spec.util.test_env") |
2 | local run = test_env.run | 2 | local run = test_env.run |
3 | 3 | ||
4 | test_env.unload_luarocks() | 4 | test_env.unload_luarocks() |
diff --git a/spec/install_spec.lua b/spec/install_spec.lua index 92b780d3..d72d88ba 100644 --- a/spec/install_spec.lua +++ b/spec/install_spec.lua | |||
@@ -1,4 +1,4 @@ | |||
1 | local test_env = require("test/test_environment") | 1 | local test_env = require("spec.util.test_env") |
2 | local lfs = require("lfs") | 2 | local lfs = require("lfs") |
3 | local run = test_env.run | 3 | local run = test_env.run |
4 | local testing_paths = test_env.testing_paths | 4 | local testing_paths = test_env.testing_paths |
@@ -43,7 +43,7 @@ describe("LuaRocks install tests #blackbox #b_install", function() | |||
43 | end) | 43 | end) |
44 | 44 | ||
45 | it("LuaRocks install invalid patch", function() | 45 | it("LuaRocks install invalid patch", function() |
46 | assert.is_false(run.luarocks_bool("install " .. testing_paths.testing_dir .. "/testfiles/invalid_patch-0.1-1.rockspec")) | 46 | assert.is_false(run.luarocks_bool("install " .. testing_paths.fixtures_dir .. "/invalid_patch-0.1-1.rockspec")) |
47 | end) | 47 | end) |
48 | 48 | ||
49 | it("LuaRocks install invalid rock", function() | 49 | it("LuaRocks install invalid rock", function() |
@@ -55,7 +55,7 @@ describe("LuaRocks install tests #blackbox #b_install", function() | |||
55 | end) | 55 | end) |
56 | 56 | ||
57 | it("LuaRocks install not a zip file", function() | 57 | it("LuaRocks install not a zip file", function() |
58 | assert.is_false(run.luarocks_bool("install " .. testing_paths.testing_dir .. "/testfiles/not_a_zipfile-1.0-1.src.rock")) | 58 | assert.is_false(run.luarocks_bool("install " .. testing_paths.fixtures_dir .. "/not_a_zipfile-1.0-1.src.rock")) |
59 | end) | 59 | end) |
60 | 60 | ||
61 | it("LuaRocks install only-deps of lxsh show there is no lxsh", function() | 61 | it("LuaRocks install only-deps of lxsh show there is no lxsh", function() |
diff --git a/spec/lint_spec.lua b/spec/lint_spec.lua index f7496037..1c082b2a 100644 --- a/spec/lint_spec.lua +++ b/spec/lint_spec.lua | |||
@@ -1,4 +1,4 @@ | |||
1 | local test_env = require("test/test_environment") | 1 | local test_env = require("spec.util.test_env") |
2 | local run = test_env.run | 2 | local run = test_env.run |
3 | local testing_paths = test_env.testing_paths | 3 | local testing_paths = test_env.testing_paths |
4 | 4 | ||
@@ -31,19 +31,19 @@ describe("LuaRocks lint tests #blackbox #b_lint", function() | |||
31 | 31 | ||
32 | describe("LuaRocks lint mismatch set", function() | 32 | describe("LuaRocks lint mismatch set", function() |
33 | it("LuaRocks lint mismatch string", function() | 33 | it("LuaRocks lint mismatch string", function() |
34 | assert.is_false(run.luarocks_bool("lint " .. testing_paths.testing_dir .. "/testfiles/type_mismatch_string-1.0-1.rockspec")) | 34 | assert.is_false(run.luarocks_bool("lint " .. testing_paths.fixtures_dir .. "/type_mismatch_string-1.0-1.rockspec")) |
35 | end) | 35 | end) |
36 | 36 | ||
37 | it("LuaRocks lint mismatch version", function() | 37 | it("LuaRocks lint mismatch version", function() |
38 | assert.is_false(run.luarocks_bool("lint " .. testing_paths.testing_dir .. "/testfiles/type_mismatch_version-1.0-1.rockspec")) | 38 | assert.is_false(run.luarocks_bool("lint " .. testing_paths.fixtures_dir .. "/type_mismatch_version-1.0-1.rockspec")) |
39 | end) | 39 | end) |
40 | 40 | ||
41 | it("LuaRocks lint mismatch table", function() | 41 | it("LuaRocks lint mismatch table", function() |
42 | assert.is_false(run.luarocks_bool("lint " .. testing_paths.testing_dir .. "/testfiles/type_mismatch_table-1.0-1.rockspec")) | 42 | assert.is_false(run.luarocks_bool("lint " .. testing_paths.fixtures_dir .. "/type_mismatch_table-1.0-1.rockspec")) |
43 | end) | 43 | end) |
44 | 44 | ||
45 | it("LuaRocks lint mismatch no build table", function() | 45 | it("LuaRocks lint mismatch no build table", function() |
46 | assert.is_false(run.luarocks_bool("lint " .. testing_paths.testing_dir .. "/testfiles/no_build_table-1.0-1.rockspec")) | 46 | assert.is_false(run.luarocks_bool("lint " .. testing_paths.fixtures_dir .. "/no_build_table-1.0-1.rockspec")) |
47 | end) | 47 | end) |
48 | end) | 48 | end) |
49 | end) | 49 | end) |
diff --git a/spec/list_spec.lua b/spec/list_spec.lua index b9a8e4c4..9f221b90 100644 --- a/spec/list_spec.lua +++ b/spec/list_spec.lua | |||
@@ -1,4 +1,4 @@ | |||
1 | local test_env = require("test/test_environment") | 1 | local test_env = require("spec.util.test_env") |
2 | local run = test_env.run | 2 | local run = test_env.run |
3 | local testing_paths = test_env.testing_paths | 3 | local testing_paths = test_env.testing_paths |
4 | 4 | ||
diff --git a/spec/make_manifest_spec.lua b/spec/make_manifest_spec.lua index 3e998cbf..2b109fa7 100644 --- a/spec/make_manifest_spec.lua +++ b/spec/make_manifest_spec.lua | |||
@@ -1,4 +1,4 @@ | |||
1 | local test_env = require("test/test_environment") | 1 | local test_env = require("spec.util.test_env") |
2 | local run = test_env.run | 2 | local run = test_env.run |
3 | 3 | ||
4 | test_env.unload_luarocks() | 4 | test_env.unload_luarocks() |
diff --git a/spec/make_spec.lua b/spec/make_spec.lua index 4c406c68..88b35b22 100644 --- a/spec/make_spec.lua +++ b/spec/make_spec.lua | |||
@@ -1,4 +1,4 @@ | |||
1 | local test_env = require("test/test_environment") | 1 | local test_env = require("spec.util.test_env") |
2 | local lfs = require("lfs") | 2 | local lfs = require("lfs") |
3 | local run = test_env.run | 3 | local run = test_env.run |
4 | local testing_paths = test_env.testing_paths | 4 | local testing_paths = test_env.testing_paths |
@@ -102,7 +102,7 @@ describe("LuaRocks make tests #blackbox #b_make", function() | |||
102 | 102 | ||
103 | describe("LuaRocks make upgrading rockspecs with mixed deploy types", function() | 103 | describe("LuaRocks make upgrading rockspecs with mixed deploy types", function() |
104 | before_each(function() | 104 | before_each(function() |
105 | test_env.copy_dir(testing_paths.testing_dir .. "/testfiles/mixed_deploy_type", "mdt") | 105 | test_env.copy_dir(testing_paths.fixtures_dir .. "/mixed_deploy_type", "mdt") |
106 | end) | 106 | end) |
107 | 107 | ||
108 | after_each(function() | 108 | after_each(function() |
diff --git a/spec/new_version_spec.lua b/spec/new_version_spec.lua index 2f67141d..65f60dd6 100644 --- a/spec/new_version_spec.lua +++ b/spec/new_version_spec.lua | |||
@@ -1,4 +1,4 @@ | |||
1 | local test_env = require("test/test_environment") | 1 | local test_env = require("spec.util.test_env") |
2 | local lfs = require("lfs") | 2 | local lfs = require("lfs") |
3 | local run = test_env.run | 3 | local run = test_env.run |
4 | local testing_paths = test_env.testing_paths | 4 | local testing_paths = test_env.testing_paths |
diff --git a/spec/pack_spec.lua b/spec/pack_spec.lua index 0c6dd8f2..966195c5 100644 --- a/spec/pack_spec.lua +++ b/spec/pack_spec.lua | |||
@@ -1,4 +1,4 @@ | |||
1 | local test_env = require("test/test_environment") | 1 | local test_env = require("spec.util.test_env") |
2 | local lfs = require("lfs") | 2 | local lfs = require("lfs") |
3 | local run = test_env.run | 3 | local run = test_env.run |
4 | local testing_paths = test_env.testing_paths | 4 | local testing_paths = test_env.testing_paths |
@@ -30,7 +30,7 @@ describe("LuaRocks pack tests #blackbox #b_pack", function() | |||
30 | end) | 30 | end) |
31 | 31 | ||
32 | it("LuaRocks pack invalid rockspec", function() | 32 | it("LuaRocks pack invalid rockspec", function() |
33 | assert.is_false(run.luarocks_bool("pack " .. testing_paths.testing_dir .. "/testfiles/invaild_validate-args-1.5.4-1.rockspec")) | 33 | assert.is_false(run.luarocks_bool("pack " .. testing_paths.fixtures_dir .. "/invaild_validate-args-1.5.4-1.rockspec")) |
34 | end) | 34 | end) |
35 | 35 | ||
36 | it("LuaRocks pack not installed rock", function() | 36 | it("LuaRocks pack not installed rock", function() |
diff --git a/spec/path_spec.lua b/spec/path_spec.lua index 536233b1..bbc0cfc8 100644 --- a/spec/path_spec.lua +++ b/spec/path_spec.lua | |||
@@ -1,4 +1,4 @@ | |||
1 | local test_env = require("test/test_environment") | 1 | local test_env = require("spec.util.test_env") |
2 | local run = test_env.run | 2 | local run = test_env.run |
3 | 3 | ||
4 | test_env.unload_luarocks() | 4 | test_env.unload_luarocks() |
diff --git a/spec/persist.lua b/spec/persist.lua index 6b69dab4..00a9b75d 100644 --- a/spec/persist.lua +++ b/spec/persist.lua | |||
@@ -1,4 +1,4 @@ | |||
1 | local test_env = require("test/test_environment") | 1 | local test_env = require("spec.util.test_env") |
2 | 2 | ||
3 | test_env.unload_luarocks() | 3 | test_env.unload_luarocks() |
4 | local persist = require("luarocks.persist") | 4 | local persist = require("luarocks.persist") |
diff --git a/spec/purge_spec.lua b/spec/purge_spec.lua index 20cee5f0..79ad0dfd 100644 --- a/spec/purge_spec.lua +++ b/spec/purge_spec.lua | |||
@@ -1,4 +1,4 @@ | |||
1 | local test_env = require("test/test_environment") | 1 | local test_env = require("spec.util.test_env") |
2 | local run = test_env.run | 2 | local run = test_env.run |
3 | local testing_paths = test_env.testing_paths | 3 | local testing_paths = test_env.testing_paths |
4 | 4 | ||
diff --git a/spec/refresh_cache_spec.lua b/spec/refresh_cache_spec.lua index 09f5645e..51c1572f 100644 --- a/spec/refresh_cache_spec.lua +++ b/spec/refresh_cache_spec.lua | |||
@@ -1,4 +1,4 @@ | |||
1 | local test_env = require("test/test_environment") | 1 | local test_env = require("spec.util.test_env") |
2 | local run = test_env.run | 2 | local run = test_env.run |
3 | 3 | ||
4 | test_env.unload_luarocks() | 4 | test_env.unload_luarocks() |
diff --git a/spec/remove_spec.lua b/spec/remove_spec.lua index 4d3f5cdc..c0e9beb0 100644 --- a/spec/remove_spec.lua +++ b/spec/remove_spec.lua | |||
@@ -1,4 +1,4 @@ | |||
1 | local test_env = require("test/test_environment") | 1 | local test_env = require("spec.util.test_env") |
2 | local lfs = require("lfs") | 2 | local lfs = require("lfs") |
3 | local run = test_env.run | 3 | local run = test_env.run |
4 | local testing_paths = test_env.testing_paths | 4 | local testing_paths = test_env.testing_paths |
diff --git a/spec/search_spec.lua b/spec/search_spec.lua index 04f84eeb..952458dd 100644 --- a/spec/search_spec.lua +++ b/spec/search_spec.lua | |||
@@ -1,4 +1,4 @@ | |||
1 | local test_env = require("test/test_environment") | 1 | local test_env = require("spec.util.test_env") |
2 | local run = test_env.run | 2 | local run = test_env.run |
3 | 3 | ||
4 | test_env.unload_luarocks() | 4 | test_env.unload_luarocks() |
diff --git a/spec/show_spec.lua b/spec/show_spec.lua index 0b046de0..d572be9b 100644 --- a/spec/show_spec.lua +++ b/spec/show_spec.lua | |||
@@ -1,4 +1,4 @@ | |||
1 | local test_env = require("test/test_environment") | 1 | local test_env = require("spec.util.test_env") |
2 | local run = test_env.run | 2 | local run = test_env.run |
3 | 3 | ||
4 | test_env.unload_luarocks() | 4 | test_env.unload_luarocks() |
diff --git a/spec/unpack_spec.lua b/spec/unpack_spec.lua index d629e225..fc02d853 100644 --- a/spec/unpack_spec.lua +++ b/spec/unpack_spec.lua | |||
@@ -1,4 +1,4 @@ | |||
1 | local test_env = require("test/test_environment") | 1 | local test_env = require("spec.util.test_env") |
2 | local run = test_env.run | 2 | local run = test_env.run |
3 | local testing_paths = test_env.testing_paths | 3 | local testing_paths = test_env.testing_paths |
4 | 4 | ||
@@ -26,7 +26,7 @@ describe("LuaRocks unpack tests #blackbox #b_unpack", function() | |||
26 | end) | 26 | end) |
27 | 27 | ||
28 | it("LuaRocks unpack with invalid patch", function() | 28 | it("LuaRocks unpack with invalid patch", function() |
29 | assert.is_false(run.luarocks_bool("unpack " .. testing_paths.testing_dir .. "/testfiles/invalid_patch-0.1-1.rockspec")) | 29 | assert.is_false(run.luarocks_bool("unpack " .. testing_paths.fixtures_dir .. "/invalid_patch-0.1-1.rockspec")) |
30 | end) | 30 | end) |
31 | end) | 31 | end) |
32 | 32 | ||
diff --git a/spec/upload_spec.lua b/spec/upload_spec.lua index b8e147e0..3adfa2dd 100644 --- a/spec/upload_spec.lua +++ b/spec/upload_spec.lua | |||
@@ -1,4 +1,4 @@ | |||
1 | local test_env = require("test/test_environment") | 1 | local test_env = require("spec.util.test_env") |
2 | local run = test_env.run | 2 | local run = test_env.run |
3 | local testing_paths = test_env.testing_paths | 3 | local testing_paths = test_env.testing_paths |
4 | 4 | ||
@@ -39,10 +39,10 @@ describe("LuaRocks upload tests #blackbox #b_upload", function() | |||
39 | after_each(test_env.mock_server_done) | 39 | after_each(test_env.mock_server_done) |
40 | 40 | ||
41 | it("LuaRocks upload rockspec with api-key", function() | 41 | it("LuaRocks upload rockspec with api-key", function() |
42 | assert.is_true(run.luarocks_bool("upload " .. testing_paths.testing_dir .. "/testfiles/a_rock-1.0-1.rockspec " .. test_env.OPENSSL_DIRS .. " --api-key=123", {LUAROCKS_CONFIG = testing_paths.testing_dir .. "/luarocks_site.lua"})) | 42 | assert.is_true(run.luarocks_bool("upload " .. testing_paths.fixtures_dir .. "/a_rock-1.0-1.rockspec " .. test_env.OPENSSL_DIRS .. " --api-key=123", {LUAROCKS_CONFIG = testing_paths.testrun_dir .. "/luarocks_site.lua"})) |
43 | end) | 43 | end) |
44 | it("LuaRocks upload rockspec with api-key and skip-pack", function() | 44 | it("LuaRocks upload rockspec with api-key and skip-pack", function() |
45 | assert.is_true(run.luarocks_bool("upload --skip-pack " .. testing_paths.testing_dir .. "/testfiles/a_rock-1.0-1.rockspec " .. test_env.OPENSSL_DIRS .. " --api-key=123", {LUAROCKS_CONFIG = testing_paths.testing_dir .. "/luarocks_site.lua"})) | 45 | assert.is_true(run.luarocks_bool("upload --skip-pack " .. testing_paths.fixtures_dir .. "/a_rock-1.0-1.rockspec " .. test_env.OPENSSL_DIRS .. " --api-key=123", {LUAROCKS_CONFIG = testing_paths.testrun_dir .. "/luarocks_site.lua"})) |
46 | end) | 46 | end) |
47 | end) | 47 | end) |
48 | end) | 48 | end) |
diff --git a/test/mock-server.lua b/spec/util/mock-server.lua index dbbdea2c..244aceae 100644 --- a/test/mock-server.lua +++ b/spec/util/mock-server.lua | |||
@@ -70,7 +70,7 @@ server:add_resource("/file/{name:[^/]+}", { | |||
70 | path = "/", | 70 | path = "/", |
71 | produces = "text/plain", | 71 | produces = "text/plain", |
72 | handler = function(query, name) | 72 | handler = function(query, name) |
73 | local fd = io.open("test/testfiles/"..name, "r") | 73 | local fd = io.open("spec/fixtures/"..name, "r") |
74 | if not fd then | 74 | if not fd then |
75 | return restserver.response():status(404) | 75 | return restserver.response():status(404) |
76 | end | 76 | end |
diff --git a/test/test_environment.lua b/spec/util/test_env.lua index d347fa59..9d9ae843 100644 --- a/test/test_environment.lua +++ b/spec/util/test_env.lua | |||
@@ -346,7 +346,7 @@ local function create_env(testing_paths) | |||
346 | 346 | ||
347 | local env_variables = {} | 347 | local env_variables = {} |
348 | env_variables.LUA_VERSION = luaversion_short | 348 | env_variables.LUA_VERSION = luaversion_short |
349 | env_variables.LUAROCKS_CONFIG = testing_paths.testing_dir .. "/testing_config.lua" | 349 | env_variables.LUAROCKS_CONFIG = testing_paths.testrun_dir .. "/testing_config.lua" |
350 | if test_env.TEST_TARGET_OS == "windows" then | 350 | if test_env.TEST_TARGET_OS == "windows" then |
351 | env_variables.LUA_PATH = testing_paths.testing_lrprefix .. "\\lua\\?.lua;" | 351 | env_variables.LUA_PATH = testing_paths.testing_lrprefix .. "\\lua\\?.lua;" |
352 | else | 352 | else |
@@ -379,7 +379,7 @@ local function make_run_function(cmd_name, exec_function, with_coverage, do_prin | |||
379 | local cmd_prefix = Q(test_env.testing_paths.lua) .. " " | 379 | local cmd_prefix = Q(test_env.testing_paths.lua) .. " " |
380 | 380 | ||
381 | if with_coverage then | 381 | if with_coverage then |
382 | cmd_prefix = cmd_prefix .. "-e \"require('luacov.runner')('" .. test_env.testing_paths.testing_dir .. "/luacov.config')\" " | 382 | cmd_prefix = cmd_prefix .. "-e \"require('luacov.runner')('" .. test_env.testing_paths.testrun_dir .. "/luacov.config')\" " |
383 | end | 383 | end |
384 | 384 | ||
385 | if test_env.TEST_TARGET_OS == "windows" then | 385 | if test_env.TEST_TARGET_OS == "windows" then |
@@ -482,15 +482,17 @@ local function create_paths(luaversion_full) | |||
482 | testing_paths.luarocks_dir = testing_paths.luarocks_dir:gsub("\\","/") | 482 | testing_paths.luarocks_dir = testing_paths.luarocks_dir:gsub("\\","/") |
483 | end | 483 | end |
484 | 484 | ||
485 | testing_paths.testing_dir = testing_paths.luarocks_dir .. "/test" | 485 | testing_paths.fixtures_dir = testing_paths.luarocks_dir .. "/spec/fixtures" |
486 | testing_paths.util_dir = testing_paths.luarocks_dir .. "/spec/util" | ||
487 | testing_paths.testrun_dir = testing_paths.luarocks_dir .. "/testrun" | ||
486 | testing_paths.src_dir = testing_paths.luarocks_dir .. "/src" | 488 | testing_paths.src_dir = testing_paths.luarocks_dir .. "/src" |
487 | testing_paths.testing_lrprefix = testing_paths.testing_dir .. "/testing_lrprefix-" .. luaversion_full | 489 | testing_paths.testing_lrprefix = testing_paths.testrun_dir .. "/testing_lrprefix-" .. luaversion_full |
488 | testing_paths.testing_tree = testing_paths.testing_dir .. "/testing-" .. luaversion_full | 490 | testing_paths.testing_tree = testing_paths.testrun_dir .. "/testing-" .. luaversion_full |
489 | testing_paths.testing_tree_copy = testing_paths.testing_dir .. "/testing_copy-" .. luaversion_full | 491 | testing_paths.testing_tree_copy = testing_paths.testrun_dir .. "/testing_copy-" .. luaversion_full |
490 | testing_paths.testing_sys_tree = testing_paths.testing_dir .. "/testing_sys-" .. luaversion_full | 492 | testing_paths.testing_sys_tree = testing_paths.testrun_dir .. "/testing_sys-" .. luaversion_full |
491 | testing_paths.testing_sys_tree_copy = testing_paths.testing_dir .. "/testing_sys_copy-" .. luaversion_full | 493 | testing_paths.testing_sys_tree_copy = testing_paths.testrun_dir .. "/testing_sys_copy-" .. luaversion_full |
492 | testing_paths.testing_cache = testing_paths.testing_dir .. "/testing_cache-" .. luaversion_full | 494 | testing_paths.testing_cache = testing_paths.testrun_dir .. "/testing_cache-" .. luaversion_full |
493 | testing_paths.testing_server = testing_paths.testing_dir .. "/testing_server-" .. luaversion_full | 495 | testing_paths.testing_server = testing_paths.testrun_dir .. "/testing_server-" .. luaversion_full |
494 | 496 | ||
495 | testing_paths.testing_rocks = testing_paths.testing_tree .. "/lib/luarocks/rocks-" .. test_env.lua_version | 497 | testing_paths.testing_rocks = testing_paths.testing_tree .. "/lib/luarocks/rocks-" .. test_env.lua_version |
496 | testing_paths.testing_sys_rocks = testing_paths.testing_sys_tree .. "/lib/luarocks/rocks-" .. test_env.lua_version | 498 | testing_paths.testing_sys_rocks = testing_paths.testing_sys_tree .. "/lib/luarocks/rocks-" .. test_env.lua_version |
@@ -609,8 +611,8 @@ local function create_configs() | |||
609 | testing_cache = test_env.testing_paths.testing_cache | 611 | testing_cache = test_env.testing_paths.testing_cache |
610 | }) | 612 | }) |
611 | 613 | ||
612 | write_file(test_env.testing_paths.testing_dir .. "/testing_config.lua", config_content .. " \nweb_browser = \"true\"") | 614 | write_file(test_env.testing_paths.testrun_dir .. "/testing_config.lua", config_content .. " \nweb_browser = \"true\"") |
613 | write_file(test_env.testing_paths.testing_dir .. "/testing_config_show_downloads.lua", config_content | 615 | write_file(test_env.testing_paths.testrun_dir .. "/testing_config_show_downloads.lua", config_content |
614 | .. "show_downloads = true \n rocks_servers={\"http://luarocks.org/repositories/rocks\"}") | 616 | .. "show_downloads = true \n rocks_servers={\"http://luarocks.org/repositories/rocks\"}") |
615 | 617 | ||
616 | -- testing_config_sftp.lua | 618 | -- testing_config_sftp.lua |
@@ -634,13 +636,13 @@ local function create_configs() | |||
634 | testing_cache = test_env.testing_paths.testing_cache | 636 | testing_cache = test_env.testing_paths.testing_cache |
635 | }) | 637 | }) |
636 | 638 | ||
637 | write_file(test_env.testing_paths.testing_dir .. "/testing_config_sftp.lua", config_content) | 639 | write_file(test_env.testing_paths.testrun_dir .. "/testing_config_sftp.lua", config_content) |
638 | 640 | ||
639 | -- luacov.config | 641 | -- luacov.config |
640 | config_content = substitute([[ | 642 | config_content = substitute([[ |
641 | return { | 643 | return { |
642 | statsfile = "%{testing_dir}/luacov.stats.out", | 644 | statsfile = "%{testrun_dir}/luacov.stats.out", |
643 | reportfile = "%{testing_dir}/luacov.report.out", | 645 | reportfile = "%{testrun_dir}/luacov.report.out", |
644 | modules = { | 646 | modules = { |
645 | ["luarocks"] = "src/bin/luarocks", | 647 | ["luarocks"] = "src/bin/luarocks", |
646 | ["luarocks-admin"] = "src/bin/luarocks-admin", | 648 | ["luarocks-admin"] = "src/bin/luarocks-admin", |
@@ -650,20 +652,31 @@ local function create_configs() | |||
650 | } | 652 | } |
651 | } | 653 | } |
652 | ]], { | 654 | ]], { |
653 | testing_dir = test_env.testing_paths.testing_dir | 655 | testrun_dir = test_env.testing_paths.testrun_dir |
654 | }) | 656 | }) |
655 | 657 | ||
656 | write_file(test_env.testing_paths.testing_dir .. "/luacov.config", config_content) | 658 | write_file(test_env.testing_paths.testrun_dir .. "/luacov.config", config_content) |
659 | |||
660 | config_content = [[ | ||
661 | -- Config file of mock LuaRocks.org site for tests | ||
662 | upload = { | ||
663 | server = "http://localhost:8080", | ||
664 | tool_version = "1.0.0", | ||
665 | api_version = "1", | ||
666 | } | ||
667 | ]] | ||
668 | write_file(test_env.testing_paths.testrun_dir .. "/luarocks_site.lua", config_content) | ||
657 | end | 669 | end |
658 | 670 | ||
659 | --- Remove testing directories. | 671 | --- Remove testing directories. |
660 | local function clean() | 672 | local function clean() |
661 | print("Cleaning testing directory...") | 673 | print("Cleaning testing directory...") |
662 | test_env.remove_dir(test_env.testing_paths.luarocks_tmp) | 674 | test_env.remove_dir(test_env.testing_paths.luarocks_tmp) |
663 | test_env.remove_subdirs(test_env.testing_paths.testing_dir, "testing[_%-]") | 675 | test_env.remove_subdirs(test_env.testing_paths.testrun_dir, "testing[_%-]") |
664 | test_env.remove_files(test_env.testing_paths.testing_dir, "testing_") | 676 | test_env.remove_files(test_env.testing_paths.testrun_dir, "testing_") |
665 | test_env.remove_files(test_env.testing_paths.testing_dir, "luacov") | 677 | test_env.remove_files(test_env.testing_paths.testrun_dir, "luacov") |
666 | test_env.remove_files(test_env.testing_paths.testing_dir, "upload_config") | 678 | test_env.remove_files(test_env.testing_paths.testrun_dir, "upload_config") |
679 | test_env.remove_files(test_env.testing_paths.testrun_dir, "luarocks_site") | ||
667 | print("Cleaning done!") | 680 | print("Cleaning done!") |
668 | end | 681 | end |
669 | 682 | ||
@@ -714,7 +727,7 @@ function test_env.mock_server_init() | |||
714 | local assert = require("luassert") | 727 | local assert = require("luassert") |
715 | local testing_paths = test_env.testing_paths | 728 | local testing_paths = test_env.testing_paths |
716 | assert.is_true(test_env.need_rock("restserver-xavante")) | 729 | assert.is_true(test_env.need_rock("restserver-xavante")) |
717 | local final_command = test_env.execute_helper(testing_paths.lua .. " " .. testing_paths.testing_dir .. "/mock-server.lua &", true, test_env.env_variables) | 730 | local final_command = test_env.execute_helper(testing_paths.lua .. " " .. testing_paths.util_dir .. "/mock-server.lua &", true, test_env.env_variables) |
718 | os.execute(final_command) | 731 | os.execute(final_command) |
719 | end | 732 | end |
720 | 733 | ||
@@ -731,13 +744,14 @@ function test_env.main() | |||
731 | clean() | 744 | clean() |
732 | end | 745 | end |
733 | 746 | ||
747 | lfs.mkdir(testing_paths.testrun_dir) | ||
734 | lfs.mkdir(testing_paths.testing_cache) | 748 | lfs.mkdir(testing_paths.testing_cache) |
735 | lfs.mkdir(testing_paths.luarocks_tmp) | 749 | lfs.mkdir(testing_paths.luarocks_tmp) |
736 | 750 | ||
737 | create_configs() | 751 | create_configs() |
738 | 752 | ||
739 | local install_env_vars = { | 753 | local install_env_vars = { |
740 | LUAROCKS_CONFIG = test_env.testing_paths.testing_dir .. "/testing_config.lua" | 754 | LUAROCKS_CONFIG = test_env.testing_paths.testrun_dir .. "/testing_config.lua" |
741 | } | 755 | } |
742 | 756 | ||
743 | install_luarocks(install_env_vars) | 757 | install_luarocks(install_env_vars) |
diff --git a/spec/util_spec.lua b/spec/util_spec.lua index 25cc51d8..3aa8fbf5 100644 --- a/spec/util_spec.lua +++ b/spec/util_spec.lua | |||
@@ -1,4 +1,4 @@ | |||
1 | local test_env = require("test/test_environment") | 1 | local test_env = require("spec.util.test_env") |
2 | local lfs = require("lfs") | 2 | local lfs = require("lfs") |
3 | local run = test_env.run | 3 | local run = test_env.run |
4 | local testing_paths = test_env.testing_paths | 4 | local testing_paths = test_env.testing_paths |
diff --git a/spec/write_rockspec_spec.lua b/spec/write_rockspec_spec.lua index 0c860939..9ee86ada 100644 --- a/spec/write_rockspec_spec.lua +++ b/spec/write_rockspec_spec.lua | |||
@@ -1,4 +1,4 @@ | |||
1 | local test_env = require("test/test_environment") | 1 | local test_env = require("spec.util.test_env") |
2 | local lfs = require("lfs") | 2 | local lfs = require("lfs") |
3 | local run = test_env.run | 3 | local run = test_env.run |
4 | 4 | ||
@@ -27,28 +27,28 @@ describe("LuaRocks write_rockspec tests #blackbox #b_write_rockspec", function() | |||
27 | 27 | ||
28 | describe("LuaRocks write_rockspec more complex tests", function() | 28 | describe("LuaRocks write_rockspec more complex tests", function() |
29 | it("LuaRocks write_rockspec git luarocks", function() | 29 | it("LuaRocks write_rockspec git luarocks", function() |
30 | assert.is_true(run.luarocks_bool("write_rockspec git://github.com/keplerproject/luarocks")) | 30 | assert.is_true(run.luarocks_bool("write_rockspec git://github.com/luarocks/testrock")) |
31 | assert.is.truthy(lfs.attributes("luarocks-dev-1.rockspec")) | 31 | assert.is.truthy(lfs.attributes("testrock-dev-1.rockspec")) |
32 | assert.is_true(os.remove("luarocks-dev-1.rockspec")) | 32 | assert.is_true(os.remove("testrock-dev-1.rockspec")) |
33 | end) | 33 | end) |
34 | 34 | ||
35 | it("LuaRocks write_rockspec git luarocks --tag=v2.3.0", function() | 35 | it("LuaRocks write_rockspec git luarocks --tag=v2.3.0", function() |
36 | assert.is_true(run.luarocks_bool("write_rockspec git://github.com/keplerproject/luarocks --tag=v2.3.0")) | 36 | assert.is_true(run.luarocks_bool("write_rockspec git://github.com/luarocks/testrock --tag=v2.3.0")) |
37 | assert.is.truthy(lfs.attributes("luarocks-2.3.0-1.rockspec")) | 37 | assert.is.truthy(lfs.attributes("testrock-2.3.0-1.rockspec")) |
38 | assert.is_true(os.remove("luarocks-2.3.0-1.rockspec")) | 38 | assert.is_true(os.remove("testrock-2.3.0-1.rockspec")) |
39 | end) | 39 | end) |
40 | 40 | ||
41 | it("LuaRocks write_rockspec git luarocks with format flag", function() | 41 | it("LuaRocks write_rockspec git luarocks with format flag", function() |
42 | assert.is_true(run.luarocks_bool("write_rockspec git://github.com/luarocks/luarocks --rockspec-format=1.1 --lua-version=5.1,5.2")) | 42 | assert.is_true(run.luarocks_bool("write_rockspec git://github.com/luarocks/testrock --rockspec-format=1.1 --lua-version=5.1,5.2")) |
43 | assert.is.truthy(lfs.attributes("luarocks-dev-1.rockspec")) | 43 | assert.is.truthy(lfs.attributes("testrock-dev-1.rockspec")) |
44 | assert.is_true(os.remove("luarocks-dev-1.rockspec")) | 44 | assert.is_true(os.remove("testrock-dev-1.rockspec")) |
45 | end) | 45 | end) |
46 | 46 | ||
47 | it("LuaRocks write_rockspec git luarocks with full flags", function() | 47 | it("LuaRocks write_rockspec git luarocks with full flags", function() |
48 | assert.is_true(run.luarocks_bool("write_rockspec git://github.com/luarocks/luarocks --lua-version=5.1,5.2 --license=\"MIT/X11\" " | 48 | assert.is_true(run.luarocks_bool("write_rockspec git://github.com/luarocks/testrock --lua-version=5.1,5.2 --license=\"MIT/X11\" " |
49 | .. " --homepage=\"http://www.luarocks.org\" --summary=\"A package manager for Lua modules\" ")) | 49 | .. " --homepage=\"http://www.luarocks.org\" --summary=\"A package manager for Lua modules\" ")) |
50 | assert.is.truthy(lfs.attributes("luarocks-dev-1.rockspec")) | 50 | assert.is.truthy(lfs.attributes("testrock-dev-1.rockspec")) |
51 | assert.is_true(os.remove("luarocks-dev-1.rockspec")) | 51 | assert.is_true(os.remove("testrock-dev-1.rockspec")) |
52 | end) | 52 | end) |
53 | 53 | ||
54 | it("LuaRocks write_rockspec rockspec via http", function() | 54 | it("LuaRocks write_rockspec rockspec via http", function() |
diff --git a/test/luarocks_site.lua b/test/luarocks_site.lua deleted file mode 100644 index cfa77dca..00000000 --- a/test/luarocks_site.lua +++ /dev/null | |||
@@ -1,6 +0,0 @@ | |||
1 | -- Config file of LuaRocks site for tests | ||
2 | upload = { | ||
3 | server = "http://localhost:8080", | ||
4 | tool_version = "1.0.0", | ||
5 | api_version = "1", | ||
6 | } \ No newline at end of file | ||
diff --git a/test/testfiles/patch_create_delete-0.1-1.rockspec b/test/testfiles/patch_create_delete-0.1-1.rockspec deleted file mode 100644 index 069e2912..00000000 --- a/test/testfiles/patch_create_delete-0.1-1.rockspec +++ /dev/null | |||
@@ -1,34 +0,0 @@ | |||
1 | rockspec_format = "3.0" | ||
2 | package = "patch_create_delete" | ||
3 | version = "0.1-1" | ||
4 | source = { | ||
5 | -- any valid URL | ||
6 | url = "git://github.com/luarocks/luarocks" | ||
7 | } | ||
8 | description = { | ||
9 | summary = "A rockspec with a patch that creates and deletes files", | ||
10 | } | ||
11 | dependencies = { | ||
12 | "lua >= 5.1" | ||
13 | } | ||
14 | build = { | ||
15 | type = "builtin", | ||
16 | modules = { | ||
17 | ["luarocks.loader"] = "src/luarocks/loader.lua" | ||
18 | }, | ||
19 | patches = { | ||
20 | ["create_delete.patch"] = | ||
21 | [[ | ||
22 | diff -Naur luarocks/test/testfiles/patch_create_delete/a_file.txt luarocks-patch/test/testfiles/patch_create_delete/a_file.txt | ||
23 | --- luarocks/test/testfiles/patch_create_delete/a_file.txt 2017-10-04 15:39:44.179306674 -0300 | ||
24 | +++ luarocks-patch/test/testfiles/patch_create_delete/a_file.txt 1969-12-31 21:00:00.000000000 -0300 | ||
25 | @@ -1 +0,0 @@ | ||
26 | -I am a file. | ||
27 | diff -Naur luarocks/test/testfiles/patch_create_delete/another_file.txt luarocks-patch/test/testfiles/patch_create_delete/another_file.txt | ||
28 | --- luarocks/test/testfiles/patch_create_delete/another_file.txt 1969-12-31 21:00:00.000000000 -0300 | ||
29 | +++ luarocks-patch/test/testfiles/patch_create_delete/another_file.txt 2017-10-04 15:40:12.836306564 -0300 | ||
30 | @@ -0,0 +1 @@ | ||
31 | +I am another file. | ||
32 | ]] | ||
33 | } | ||
34 | } | ||