test: fix running functional tests under gdbserver

It was not possible to run the tests under the gdbserver because we were
not closing the old session before starting a new one. This caused the
server to not to be able to bind to the given address and crashing the
tests.

This commit closes the session before starting a new one.

Signed-off-by: Shreyansh Chouhan <chouhan.shreyansh2702@gmail.com>
This commit is contained in:
Shreyansh Chouhan
2021-06-13 02:53:05 +05:30
parent 490e09c6d8
commit 73d12a8b71
3 changed files with 16 additions and 14 deletions

View File

@@ -96,10 +96,7 @@ function module.get_session()
return session
end
function module.set_session(s, keep)
if session and not keep then
session:close()
end
function module.set_session(s)
session = s
end
@@ -366,7 +363,11 @@ local function remove_args(args, args_rm)
return new_args
end
function module.spawn(argv, merge, env)
function module.spawn(argv, merge, env, keep)
if session and not keep then
session:close()
end
local child_stream = ChildProcessStream.spawn(
merge and module.merge_args(prepend_argv, argv) or argv,
env)