From fd65ad40cb1a1b52b5207d45a58962b5f590046b Mon Sep 17 00:00:00 2001 From: Romain Forlot Date: Thu, 17 May 2018 02:32:11 +0200 Subject: Adding more material to do tests Make the lua interpreter find the luaunit module. Find a way to use it from the controller. Adding canreplayer file and write a script that could launch in background the canplayer. No process handling by now which have to done in the next step Change-Id: I2d35472ba0e2fbb03ead121ff2587d831fe4ff17 Signed-off-by: Romain Forlot --- src/test-binding.c | 66 +++++++++++++----------------------------------------- src/test-binding.h | 1 + 2 files changed, 17 insertions(+), 50 deletions(-) (limited to 'src') diff --git a/src/test-binding.c b/src/test-binding.c index 7b28b01..2f6f915 100644 --- a/src/test-binding.c +++ b/src/test-binding.c @@ -1,19 +1,20 @@ /* - * Copyright (C) 2016 "IoT.bzh" - * Author Fulup Ar Foll - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +* Copyright (C) 2016 "IoT.bzh" +* Author Fulup Ar Foll +* Author Romain Forlot +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ #define _GNU_SOURCE #include @@ -31,7 +32,6 @@ static CtlSectionT ctrlSections[] = { {.key = "resources", .loadCB = PluginConfig}, {.key = "onload", .loadCB = OnloadConfig}, {.key = "events", .loadCB = EventConfig}, - {.key = NULL} }; @@ -107,36 +107,6 @@ static int CtrlLoadOneApi(void *cbdata, AFB_ApiT apiHandle) { return err; } -int AddLunitFrameworkResource(AFB_ApiT apihandle, CtlConfigT *ctrlConfig) -{ - int err = 0; - json_object *luaunitFrameworkJ = NULL, *resourcesJ = NULL; - json_object *savedJ = NULL; - - err = wrap_json_pack(&luaunitFrameworkJ, "{ss, ss, ss, ss}", - "uid", "lunit", - "info", "Lunit LUA xUnit framework", - "spath", CONTROL_PLUGIN_PATH, - "libs", "luaunit.lua"); - if(err) { - AFB_ApiError(apihandle, "Loading LUA xUnit framework"); - return ERROR; - } - - if(json_object_object_get_ex(ctrlConfig->configJ, "resources", &resourcesJ) && - json_object_is_type(resourcesJ, json_type_array)) { - savedJ = json_object_get(json_object_array_get_idx(resourcesJ, 0)); - json_object_array_put_idx(resourcesJ, 0, luaunitFrameworkJ); - json_object_array_add(resourcesJ, savedJ); - } - else { - AFB_ApiError(apihandle, "Resources section isn't a JSON array or does not exists."); - return ERROR; - } - - return 0; -} - int afbBindingVdyn(afb_dynapi *apiHandle) { AFB_default = apiHandle; @@ -171,10 +141,6 @@ int afbBindingVdyn(afb_dynapi *apiHandle) { AFB_ApiNotice(apiHandle, "Controller API='%s' info='%s'", ctrlConfig->api, ctrlConfig->info); - - if (AddLunitFrameworkResource(apiHandle, ctrlConfig)) - return ERROR; - // create one API per config file (Pre-V3 return code ToBeChanged) int status = afb_dynapi_new_api(apiHandle, ctrlConfig->api, ctrlConfig->info, 1, CtrlLoadOneApi, ctrlConfig); diff --git a/src/test-binding.h b/src/test-binding.h index 8b0e62d..7ac00a0 100644 --- a/src/test-binding.h +++ b/src/test-binding.h @@ -1,6 +1,7 @@ /* * Copyright (C) 2016 "IoT.bzh" * Author Fulup Ar Foll + * Author Romain Forlot * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. -- cgit 1.2.3-korg