diff options
| author | Yaroslav Dynnikov <yaroslav.dynnikov@gmail.com> | 2019-05-14 19:51:37 +0300 |
|---|---|---|
| committer | Yaroslav Dynnikov <yaroslav.dynnikov@gmail.com> | 2019-05-29 13:33:20 +0300 |
| commit | b3a046edacb223bf2209dfd70131c132efb94a97 (patch) | |
| tree | 9a5ef870042fdbcabce2a49f5aa9262fa92ab6c6 /src | |
| parent | cae940b7e3a89ff1cabc5752c30a138e9e52729b (diff) | |
| download | luarocks-b3a046edacb223bf2209dfd70131c132efb94a97.tar.gz luarocks-b3a046edacb223bf2209dfd70131c132efb94a97.tar.bz2 luarocks-b3a046edacb223bf2209dfd70131c132efb94a97.zip | |
test: fix reporting failures on 'command' backend
Diffstat (limited to 'src')
| -rw-r--r-- | src/luarocks/test/command.lua | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/luarocks/test/command.lua b/src/luarocks/test/command.lua index 396450db..999cc325 100644 --- a/src/luarocks/test/command.lua +++ b/src/luarocks/test/command.lua | |||
| @@ -32,14 +32,22 @@ function command.run_tests(test, args) | |||
| 32 | end | 32 | end |
| 33 | end | 33 | end |
| 34 | 34 | ||
| 35 | local ok | ||
| 36 | |||
| 35 | if test.script then | 37 | if test.script then |
| 36 | if not fs.exists(test.script) then | 38 | if not fs.exists(test.script) then |
| 37 | return nil, "Test script " .. test.script .. " does not exist" | 39 | return nil, "Test script " .. test.script .. " does not exist" |
| 38 | end | 40 | end |
| 39 | local lua = fs.Q(dir.path(cfg.variables["LUA_BINDIR"], cfg.lua_interpreter)) -- get lua interpreter configured | 41 | local lua = fs.Q(dir.path(cfg.variables["LUA_BINDIR"], cfg.lua_interpreter)) -- get lua interpreter configured |
| 40 | return fs.execute(lua, test.script, unpack(args)) | 42 | ok = fs.execute(lua, test.script, unpack(args)) |
| 41 | elseif test.command then | 43 | elseif test.command then |
| 42 | return fs.execute(test.command, unpack(args)) | 44 | ok = fs.execute(test.command, unpack(args)) |
| 45 | end | ||
| 46 | |||
| 47 | if ok then | ||
| 48 | return true | ||
| 49 | else | ||
| 50 | return nil, "tests failed with non-zero exit code" | ||
| 43 | end | 51 | end |
| 44 | end | 52 | end |
| 45 | 53 | ||
