aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2018-08-03 16:49:16 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2018-08-21 12:55:18 +0200
commit859447896c997e8bbe5b33a4d14c7691c3ae3b9d (patch)
tree4a2cfb9598316272ffc62c5c1af2a09a65fdcb5f
parentcd72c2a0f05f0048bd83450067578691c7f21edf (diff)
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 <romain.forlot@iot.bzh>
-rw-r--r--conf.d/controller/lua.d/aft.lua8
1 files changed, 5 insertions, 3 deletions
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