From 15d3a0730fd5ab4dc8c5c6d91dcc07de3a93e294 Mon Sep 17 00:00:00 2001 From: Romain Forlot Date: Tue, 3 Jul 2018 12:35:57 +0200 Subject: Update onload to testVerb Then tests are executed at verb call instead of at the binding launch Change-Id: I133c203c28f561dd6d4242bf8c78bfcf71f73209 Signed-off-by: Romain Forlot --- src/test-binding.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/test-binding.c b/src/test-binding.c index d0fcb3c..aa9fde5 100644 --- a/src/test-binding.c +++ b/src/test-binding.c @@ -29,7 +29,7 @@ afb_dynapi *AFB_default; // Config Section definition static CtlSectionT ctrlSections[] = { {.key = "resources", .loadCB = PluginConfig}, - {.key = "onload", .loadCB = OnloadConfig}, + {.key = "testVerb", .loadCB = ControlConfig}, {.key = "events", .loadCB = EventConfig}, {.key = "mapis", .loadCB = mapisConfig}, {.key = NULL} @@ -45,9 +45,19 @@ static void ctrlapi_ping(AFB_ReqT request) { return; } +static void ctrlapi_exit(AFB_ReqT request) { + + AFB_ReqNotice(request, "Exiting..."); + AFB_ReqSuccess(request, NULL, NULL); + exit(0); + + return; +} + static AFB_ApiVerbs CtrlApiVerbs[] = { /* VERB'S NAME FUNCTION TO CALL SHORT DESCRIPTION */ {.verb = "ping", .callback = ctrlapi_ping, .info = "ping test for API"}, + {.verb = "exit", .callback = ctrlapi_exit, .info = "Exit test"}, {.verb = NULL} /* marker for end of the array */ }; -- cgit 1.2.3-korg