From 859447896c997e8bbe5b33a4d14c7691c3ae3b9d Mon Sep 17 00:00:00 2001 From: Romain Forlot Date: Fri, 3 Aug 2018 16:49:16 +0200 Subject: Fix: segfault using several test files Fix: getrootdir function usage that needs the context to be passed. This closes file handle before going to the next one. This was causing a segfault on the second file reading. Change-Id: I1d7459e29f9b8725dcbce1a277a10d3adcd4c856 Signed-off-by: Romain Forlot --- conf.d/controller/lua.d/aft.lua | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'conf.d') diff --git a/conf.d/controller/lua.d/aft.lua b/conf.d/controller/lua.d/aft.lua index 900f3ca..917d175 100644 --- a/conf.d/controller/lua.d/aft.lua +++ b/conf.d/controller/lua.d/aft.lua @@ -580,7 +580,7 @@ end function _launch_test(context, args) _AFT.context = context - local bindingRootDir = AFB:getrootdir() + local bindingRootDir = AFB:getrootdir(_AFT.context) local loadedfile = nil -- Prepare the tests execution configuring the monitoring and loading @@ -598,12 +598,14 @@ function _launch_test(context, args) if args.files and type(args.files) == 'table' then for _,f in pairs(args.files) do - local cmdHandle = io.popen('find '..bindingRootDir..'-name '..f) + local cmdHandle = io.popen('find '..bindingRootDir..' -name '..f) loadedfile = dofile(cmdHandle:read()) + cmdHandle:close() end elseif type(args.files) == 'string' then - local cmdHandle = io.popen('find '..bindingRootDir..'-name '..args.files) + local cmdHandle = io.popen('find '..bindingRootDir..' -name '..args.files) loadedfile = dofile(cmdHandle:read()) + cmdHandle:close() end -- Execute the test within a context if given. We assume that the before -- cgit 1.2.3-korg