diff options
author | Romain Forlot <romain.forlot@iot.bzh> | 2018-07-03 15:32:05 +0200 |
---|---|---|
committer | Romain Forlot <romain.forlot@iot.bzh> | 2018-07-10 17:12:14 +0200 |
commit | 1ec0a201bedf5299ba157322508d438b426cf8f6 (patch) | |
tree | 5e5726d8deddc3c431da0591a1faa50be402ec01 /conf.d/project/lua.d | |
parent | 92f8820eca4e0a42a4fde07a143ce4c6de3dfebb (diff) |
Add an exit handler also in LUA.
Needs to make it as a parameter tested at the end of
afb request call "launch_all_test".
Change-Id: I87b93aae67561e5aec0a138bfbdc0dabac3bdc21
Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'conf.d/project/lua.d')
-rw-r--r-- | conf.d/project/lua.d/aft.lua | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/conf.d/project/lua.d/aft.lua b/conf.d/project/lua.d/aft.lua index 5b0a4b7..babd5c1 100644 --- a/conf.d/project/lua.d/aft.lua +++ b/conf.d/project/lua.d/aft.lua @@ -30,6 +30,7 @@ print = function(...) end _AFT = { + exit = {0, code}, context = _ctx, tests_list = {}, event_history = false, @@ -48,6 +49,11 @@ function _AFT.setOutputFile(filePath) local file = assert(io.open(filePath, "w+")) io.output(file) end + +function _AFT.exitAtEnd(code) + _AFT.exit = {1, code} +end + --[[ Events listener and assertion functions to test correctness of received event data. @@ -368,4 +374,7 @@ function _launch_test(context, args) end lu.LuaUnit:runSuiteByInstances(_AFT.tests_list) + + AFB:success(context, {"Tests launched"}) + if _AFT.exit[1] == 1 then os.exit(_AFT.exit[2]) end end |