diff options
author | Romain Forlot <romain.forlot@iot.bzh> | 2018-07-03 12:35:57 +0200 |
---|---|---|
committer | Romain Forlot <romain.forlot@iot.bzh> | 2018-07-10 17:12:14 +0200 |
commit | 15d3a0730fd5ab4dc8c5c6d91dcc07de3a93e294 (patch) | |
tree | 829cc0179b84b18ea96569bdd0d1b62f605b319f | |
parent | 0a66e335764af73ff6402ab5d2580899c2e2783b (diff) |
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 <romain.forlot@iot.bzh>
-rw-r--r-- | conf.d/project/etc/aft-mapis.json | 2 | ||||
-rw-r--r-- | conf.d/project/etc/aft-test.json | 2 | ||||
-rw-r--r-- | src/test-binding.c | 12 |
3 files changed, 13 insertions, 3 deletions
diff --git a/conf.d/project/etc/aft-mapis.json b/conf.d/project/etc/aft-mapis.json index 4ecfbbb..edcfc87 100644 --- a/conf.d/project/etc/aft-mapis.json +++ b/conf.d/project/etc/aft-mapis.json @@ -10,7 +10,7 @@ "low-can" ] }, - "onload": { + "testVerb": { "uid": "launch_all_tests", "info": "Launch all the tests", "action": "lua://AFT#_launch_test", diff --git a/conf.d/project/etc/aft-test.json b/conf.d/project/etc/aft-test.json index fa26c5f..eabe877 100644 --- a/conf.d/project/etc/aft-test.json +++ b/conf.d/project/etc/aft-test.json @@ -10,7 +10,7 @@ "hello" ] }, - "onload": { + "testVerb": { "uid": "launch_all_tests", "info": "Launch all the tests", "action": "lua://AFT#_launch_test", 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 */ }; |