diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2018-04-23 10:55:24 -0300 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2018-05-07 19:27:37 -0300 |
commit | 3d8a9fffacec6bbd3be6429f6e849d82d3812827 (patch) | |
tree | b76220a8a7b0700868e8984bdfb48839057a496d | |
parent | 129207c5088d0c7a4143de20844a898267b471de (diff) | |
download | luarocks-3d8a9fffacec6bbd3be6429f6e849d82d3812827.tar.gz luarocks-3d8a9fffacec6bbd3be6429f6e849d82d3812827.tar.bz2 luarocks-3d8a9fffacec6bbd3be6429f6e849d82d3812827.zip |
test: add --test-type flag for not auto-detected test types
-rw-r--r-- | src/luarocks/cmd/test.lua | 11 | ||||
-rw-r--r-- | src/luarocks/test.lua | 10 | ||||
-rw-r--r-- | src/luarocks/util.lua | 1 |
3 files changed, 16 insertions, 6 deletions
diff --git a/src/luarocks/cmd/test.lua b/src/luarocks/cmd/test.lua index e8a05f09..66c6f4ab 100644 --- a/src/luarocks/cmd/test.lua +++ b/src/luarocks/cmd/test.lua | |||
@@ -7,7 +7,7 @@ local util = require("luarocks.util") | |||
7 | local test = require("luarocks.test") | 7 | local test = require("luarocks.test") |
8 | 8 | ||
9 | cmd_test.help_summary = "Run the test suite in the current directory." | 9 | cmd_test.help_summary = "Run the test suite in the current directory." |
10 | cmd_test.help_arguments = "[<rockspec>] [-- <args>]" | 10 | cmd_test.help_arguments = "[--test-type=<type>] [<rockspec>] [-- <args>]" |
11 | cmd_test.help = [[ | 11 | cmd_test.help = [[ |
12 | Run the test suite for the Lua project in the current directory. | 12 | Run the test suite for the Lua project in the current directory. |
13 | If the first argument is a rockspec, it will use it to determine | 13 | If the first argument is a rockspec, it will use it to determine |
@@ -18,6 +18,11 @@ Any additional arguments are forwarded to the test suite. | |||
18 | To make sure that any flags passed in <args> are not interpreted | 18 | To make sure that any flags passed in <args> are not interpreted |
19 | as LuaRocks flags, use -- to separate LuaRocks arguments from | 19 | as LuaRocks flags, use -- to separate LuaRocks arguments from |
20 | test suite arguments. | 20 | test suite arguments. |
21 | |||
22 | --test-type=<type> Specify the test suite type manually if it was not | ||
23 | specified in the rockspec and it could not be | ||
24 | auto-detected. | ||
25 | |||
21 | ]]..util.deps_mode_help() | 26 | ]]..util.deps_mode_help() |
22 | 27 | ||
23 | --- Driver function for "build" command. | 28 | --- Driver function for "build" command. |
@@ -34,7 +39,7 @@ function cmd_test.command(flags, arg, ...) | |||
34 | local args = { ... } | 39 | local args = { ... } |
35 | 40 | ||
36 | if arg and arg:match("rockspec$") then | 41 | if arg and arg:match("rockspec$") then |
37 | return test.run_test_suite(arg, args) | 42 | return test.run_test_suite(arg, flags["test-type"], args) |
38 | end | 43 | end |
39 | 44 | ||
40 | table.insert(args, 1, arg) | 45 | table.insert(args, 1, arg) |
@@ -44,7 +49,7 @@ function cmd_test.command(flags, arg, ...) | |||
44 | return nil, err | 49 | return nil, err |
45 | end | 50 | end |
46 | 51 | ||
47 | return test.run_test_suite(rockspec, args) | 52 | return test.run_test_suite(rockspec, flags["test-type"], args) |
48 | end | 53 | end |
49 | 54 | ||
50 | return cmd_test | 55 | return cmd_test |
diff --git a/src/luarocks/test.lua b/src/luarocks/test.lua index c7e3e013..c550c5b8 100644 --- a/src/luarocks/test.lua +++ b/src/luarocks/test.lua | |||
@@ -33,7 +33,7 @@ local function get_test_type(rockspec) | |||
33 | end | 33 | end |
34 | 34 | ||
35 | -- Run test suite as configured in rockspec in the current directory. | 35 | -- Run test suite as configured in rockspec in the current directory. |
36 | function test.run_test_suite(rockspec_arg, args) | 36 | function test.run_test_suite(rockspec_arg, test_type, args) |
37 | local rockspec | 37 | local rockspec |
38 | if type(rockspec_arg) == "string" then | 38 | if type(rockspec_arg) == "string" then |
39 | local err, errcode | 39 | local err, errcode |
@@ -46,10 +46,14 @@ function test.run_test_suite(rockspec_arg, args) | |||
46 | rockspec = rockspec_arg | 46 | rockspec = rockspec_arg |
47 | end | 47 | end |
48 | 48 | ||
49 | local test_type, err = get_test_type(rockspec) | ||
50 | if not test_type then | 49 | if not test_type then |
51 | return nil, err | 50 | local err |
51 | test_type, err = get_test_type(rockspec, test_type) | ||
52 | if not test_type then | ||
53 | return nil, err | ||
54 | end | ||
52 | end | 55 | end |
56 | assert(test_type) | ||
53 | 57 | ||
54 | if next(rockspec.test_dependencies) then | 58 | if next(rockspec.test_dependencies) then |
55 | local ok, err, errcode = deps.fulfill_dependencies(rockspec, "test_dependencies", "all") | 59 | local ok, err, errcode = deps.fulfill_dependencies(rockspec, "test_dependencies", "all") |
diff --git a/src/luarocks/util.lua b/src/luarocks/util.lua index f96f5c32..85c83744 100644 --- a/src/luarocks/util.lua +++ b/src/luarocks/util.lua | |||
@@ -141,6 +141,7 @@ local supported_flags = { | |||
141 | ["summary"] = "\"<text>\"", | 141 | ["summary"] = "\"<text>\"", |
142 | ["system-config"] = true, | 142 | ["system-config"] = true, |
143 | ["tag"] = "<tag>", | 143 | ["tag"] = "<tag>", |
144 | ["test-type"] = "<type>", | ||
144 | ["temp-key"] = "<key>", | 145 | ["temp-key"] = "<key>", |
145 | ["timeout"] = "<seconds>", | 146 | ["timeout"] = "<seconds>", |
146 | ["to"] = "<path>", | 147 | ["to"] = "<path>", |