aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--conf.d/project/lua.d/aft.lua9
-rw-r--r--src/test-binding.c4
2 files changed, 9 insertions, 4 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
diff --git a/src/test-binding.c b/src/test-binding.c
index aa9fde5..d465994 100644
--- a/src/test-binding.c
+++ b/src/test-binding.c
@@ -41,8 +41,6 @@ static void ctrlapi_ping(AFB_ReqT request) {
count++;
AFB_ReqNotice(request, "Controller:ping count=%d", count);
AFB_ReqSuccess(request, json_object_new_int(count), NULL);
-
- return;
}
static void ctrlapi_exit(AFB_ReqT request) {
@@ -50,8 +48,6 @@ static void ctrlapi_exit(AFB_ReqT request) {
AFB_ReqNotice(request, "Exiting...");
AFB_ReqSuccess(request, NULL, NULL);
exit(0);
-
- return;
}
static AFB_ApiVerbs CtrlApiVerbs[] = {