-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Propagate stack trace from Server:exec()
If a function executed with `Server:exec()` fails, luatest prints the stack trace only up to the `Server:exec()` call. If the failure happens to be in a nested function, this makes it impossible to figure out what happened. Let's propagate the error stack trace from the server to the runner and make the runner concatenate it with its own stack trace. To achieve that, we wrap errors raised by the function executed by `Serer:exec()` in `LuatestError` and set `trace` for it. Closes #396
- Loading branch information
Showing
6 changed files
with
129 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
local fio = require('fio') | ||
|
||
local t = require('luatest') | ||
local server = require('luatest.server') | ||
|
||
local g = t.group('fixtures.trace') | ||
|
||
local root = fio.dirname(fio.abspath('test.helpers')) | ||
|
||
g.before_all(function(cg) | ||
cg.server = server:new{ | ||
env = { | ||
LUA_PATH = root .. '/?.lua;' .. | ||
root .. '/?/init.lua;' .. | ||
root .. '/.rocks/share/tarantool/?.lua' | ||
} | ||
} | ||
cg.server:start() | ||
end) | ||
|
||
g.after_all(function(cg) | ||
cg.server:drop() | ||
end) | ||
|
||
g.test_error = function(cg) | ||
local function outer() | ||
cg.server:exec(function() | ||
local function inner() | ||
error('test error') | ||
end | ||
inner() | ||
end) | ||
end | ||
outer() | ||
end | ||
|
||
g.test_fail = function(cg) | ||
local function outer() | ||
cg.server:exec(function() | ||
local function inner() | ||
t.assert(false) | ||
end | ||
inner() | ||
end) | ||
end | ||
outer() | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters