From b3a046edacb223bf2209dfd70131c132efb94a97 Mon Sep 17 00:00:00 2001 From: Yaroslav Dynnikov Date: Tue, 14 May 2019 19:51:37 +0300 Subject: test: fix reporting failures on 'command' backend --- src/luarocks/test/command.lua | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src') 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) end end + local ok + if test.script then if not fs.exists(test.script) then return nil, "Test script " .. test.script .. " does not exist" end local lua = fs.Q(dir.path(cfg.variables["LUA_BINDIR"], cfg.lua_interpreter)) -- get lua interpreter configured - return fs.execute(lua, test.script, unpack(args)) + ok = fs.execute(lua, test.script, unpack(args)) elseif test.command then - return fs.execute(test.command, unpack(args)) + ok = fs.execute(test.command, unpack(args)) + end + + if ok then + return true + else + return nil, "tests failed with non-zero exit code" end end -- cgit v1.2.3-55-g6feb