[DEV] add capability to test multiple nodes

This commit is contained in:
Edouard DUPIN 2022-01-16 23:40:03 +01:00
parent 98a474d49c
commit b4687319a2
4 changed files with 149 additions and 129 deletions

View File

@ -1,4 +1,5 @@
eclipse.preferences.version=1 eclipse.preferences.version=1
encoding//bin/lutin=utf-8
encoding//lutin/__init__.py=utf-8 encoding//lutin/__init__.py=utf-8
encoding//lutin/builder.py=utf-8 encoding//lutin/builder.py=utf-8
encoding//lutin/depend.py=utf-8 encoding//lutin/depend.py=utf-8

View File

@ -7,7 +7,7 @@
## ##
## @license MPL v2.0 (see license file) ## @license MPL v2.0 (see license file)
## ##
import re
import sys import sys
import os import os
import copy import copy
@ -47,7 +47,8 @@ class Module:
## @param[in] module_name (string) Name of the module ## @param[in] module_name (string) Name of the module
## @param[in] module_type (string) Type of the module: ## @param[in] module_type (string) Type of the module:
## - BINARY ## - BINARY
## - BINARY_SHARED ## - BINARY_SHARED // deprecated ...
## - BINARY_DYNAMIC
## - BINARY_STAND_ALONE ## - BINARY_STAND_ALONE
## - LIBRARY ## - LIBRARY
## - LIBRARY_DYNAMIC ## - LIBRARY_DYNAMIC
@ -59,6 +60,8 @@ class Module:
## ##
def __init__(self, file, module_name, module_type): def __init__(self, file, module_name, module_type):
## Remove all variable to prevent error of multiple deffinition of the module ... ## Remove all variable to prevent error of multiple deffinition of the module ...
if module_type == "BINARY_SHARED":
module_type = "BINARY_DYNAMIC";
debug.verbose("Create a new module : '" + module_name + "' TYPE=" + module_type) debug.verbose("Create a new module : '" + module_name + "' TYPE=" + module_type)
self._origin_file = file; self._origin_file = file;
self._origin_path = tools.get_current_path(self._origin_file) self._origin_path = tools.get_current_path(self._origin_file)
@ -591,7 +594,7 @@ class Module:
action["action"](target, self, action["data"]); action["action"](target, self, action["data"]);
if package_name == None \ if package_name == None \
and ( self._type == 'BINARY' and ( self._type == 'BINARY'
or self._type == 'BINARY_SHARED' \ or self._type == 'BINARY_DYNAMIC' \
or self._type == 'BINARY_STAND_ALONE' \ or self._type == 'BINARY_STAND_ALONE' \
or self._type == 'PACKAGE' ) : or self._type == 'PACKAGE' ) :
# this is the endpoint binary ... # this is the endpoint binary ...
@ -626,7 +629,7 @@ class Module:
local_type = 'LIBRARY' local_type = 'LIBRARY'
if self._type == 'LIBRARY_STATIC': if self._type == 'LIBRARY_STATIC':
local_type = 'LIBRARY' local_type = 'LIBRARY'
if self._type == 'BINARY_SHARED': if self._type == 'BINARY_DYNAMIC':
local_type = 'BINARY' local_type = 'BINARY'
if self._type == 'BINARY_STAND_ALONE': if self._type == 'BINARY_STAND_ALONE':
local_type = 'BINARY' local_type = 'BINARY'
@ -652,8 +655,8 @@ class Module:
debug.print_element("Library(static)", self._name, "-", package_version_string) debug.print_element("Library(static)", self._name, "-", package_version_string)
elif self._type == 'BINARY': elif self._type == 'BINARY':
debug.print_element("Binary(auto)", self._name, "-", package_version_string) debug.print_element("Binary(auto)", self._name, "-", package_version_string)
elif self._type == 'BINARY_SHARED': elif self._type == 'BINARY_DYNAMIC':
debug.print_element("Binary (shared)", self._name, "-", package_version_string) debug.print_element("Binary (dynamic)", self._name, "-", package_version_string)
elif self._type == 'BINARY_STAND_ALONE': elif self._type == 'BINARY_STAND_ALONE':
debug.print_element("Binary (stand alone)", self._name, "-", package_version_string) debug.print_element("Binary (stand alone)", self._name, "-", package_version_string)
elif self._type == 'PACKAGE': elif self._type == 'PACKAGE':
@ -827,7 +830,7 @@ class Module:
except ValueError: except ValueError:
debug.error(" UN-SUPPORTED link format: '.jar'") debug.error(" UN-SUPPORTED link format: '.jar'")
elif self._type == 'BINARY' \ elif self._type == 'BINARY' \
or self._type == 'BINARY_SHARED' \ or self._type == 'BINARY_DYNAMIC' \
or self._type == 'BINARY_STAND_ALONE': or self._type == 'BINARY_STAND_ALONE':
shared_mode = False shared_mode = False
if "Android" in target.get_type(): if "Android" in target.get_type():
@ -841,7 +844,7 @@ class Module:
break; break;
static_mode = True static_mode = True
if target.support_dynamic_link == True: if target.support_dynamic_link == True:
if self._type == 'BINARY_SHARED': if self._type == 'BINARY_DYNAMIC':
static_mode = False static_mode = False
if shared_mode == True: if shared_mode == True:
try: try:
@ -1010,7 +1013,7 @@ class Module:
tools.remove_path_and_sub_path(pathbuild) tools.remove_path_and_sub_path(pathbuild)
return True return True
elif self._type == 'BINARY' \ elif self._type == 'BINARY' \
or self._type == 'BINARY_SHARED' \ or self._type == 'BINARY_DYNAMIC' \
or self._type == 'BINARY_STAND_ALONE' \ or self._type == 'BINARY_STAND_ALONE' \
or self._type=='PACKAGE': or self._type=='PACKAGE':
# remove path of the lib ... for this targer # remove path of the lib ... for this targer
@ -1520,7 +1523,7 @@ class Module:
or ( type == 'PACKAGE'\ or ( type == 'PACKAGE'\
and "K" not in rules) \ and "K" not in rules) \
or ( ( type == 'BINARY' \ or ( ( type == 'BINARY' \
or type == 'BINARY_SHARED' \ or type == 'BINARY_DYNAMIC' \
or type == 'BINARY_STAND_ALONE')\ or type == 'BINARY_STAND_ALONE')\
and "B" not in rules ) : and "B" not in rules ) :
return True return True
@ -1553,7 +1556,7 @@ class Module:
tmp_file.write(' color=lightblue;\n'); tmp_file.write(' color=lightblue;\n');
tmp_file.write(' ];\n'); tmp_file.write(' ];\n');
elif self._type == 'BINARY' \ elif self._type == 'BINARY' \
or self._type == 'BINARY_SHARED' \ or self._type == 'BINARY_DYNAMIC' \
or self._type == 'BINARY_STAND_ALONE': or self._type == 'BINARY_STAND_ALONE':
tmp_file.write(' node [\n'); tmp_file.write(' node [\n');
tmp_file.write(' shape=rectangle;\n'); tmp_file.write(' shape=rectangle;\n');
@ -1816,10 +1819,8 @@ def import_path(path_list):
def exist(target, name): def exist(target, name):
global __module_list global __module_list
for mod in __module_list: for mod in __module_list:
return_check = bool(re.match(name, mod[0])); debug.verbose("check exist: " + name + " => " + mod[0]);
debug.warning("check exist: " + name + " => " + mod[0]); if mod[0] == name:
#if mod[0] == name:
if return_check:
return True; return True;
return False return False
@ -1829,7 +1830,7 @@ def exist(target, name):
## @param[in] name (string) Name of the module ## @param[in] name (string) Name of the module
## @return (handle) @ref Module handle ## @return (handle) @ref Module handle
## ##
def load_module(target, nameg): def load_module(target, name):
global __module_list global __module_list
#debug.warning("Load module: " + str(len(__module_list)) + " => " + str(__module_list)); #debug.warning("Load module: " + str(len(__module_list)) + " => " + str(__module_list));
for mod in __module_list: for mod in __module_list:
@ -1902,11 +1903,22 @@ def load_module(target, nameg):
## ##
def list_all_module(): def list_all_module():
global __module_list global __module_list
tmpListName = [] out = []
for mod in __module_list: for mod in __module_list:
if mod[0] not in tmpListName: if mod[0] not in out:
tmpListName.append(mod[0]) out.append(mod[0])
return tmpListName out.sort()
return out
##
## @brief List all module with specific filter name
## @param[in] filter (string) regular expression to filter the modules
## @return ([string,...]) List of all module names filter with needed element
##
def list_filtered_module(filter):
list_of_all_module = list_all_module();
regex = re.compile(filter)
return [xxx for xxx in list_of_all_module if regex.match(xxx)]#list(filter(list_of_all_module,r.match))
## ##
## @brief List all module name whith their desc ## @brief List all module name whith their desc

View File

@ -32,7 +32,7 @@ from xmlrpc.client import boolean
def get_module_type_availlable(): def get_module_type_availlable():
return [ return [
'BINARY', 'BINARY',
'BINARY_SHARED', 'BINARY_DYNAMIC',
'BINARY_STAND_ALONE', 'BINARY_STAND_ALONE',
'LIBRARY', 'LIBRARY',
'LIBRARY_DYNAMIC', 'LIBRARY_DYNAMIC',

View File

@ -723,7 +723,11 @@ class Target:
for mod in self.module_list: for mod in self.module_list:
mod.clean(self) mod.clean(self)
else: else:
module_name = name if name.find("*") != -1:
list_of_all_element = module.list_filtered_module(name);
else:
list_of_all_element = [name]
for module_name in list_of_all_element:
action_list = actions action_list = actions
for action_name in action_list: for action_name in action_list:
debug.verbose("requested : " + module_name + "?" + action_name + " [START]") debug.verbose("requested : " + module_name + "?" + action_name + " [START]")
@ -742,7 +746,7 @@ class Target:
""" """
if mod.get_type() != "BINARY" \ if mod.get_type() != "BINARY" \
and mod.get_type() != "PACKAGE": and mod.get_type() != "PACKAGE":
debug.error("Can not run other than 'BINARY' ... package='" + mod.get_type() + "' for module='" + module_name + "'") debug.error("Can not run other than 'BINARY' ... pakage='" + mod.get_type() + "' for module='" + module_name + "'")
""" """
bin_name = None bin_name = None
if len(action_name) > 3: if len(action_name) > 3:
@ -760,10 +764,16 @@ class Target:
debug.warning("action 'run' wrong options options ... : '" + action_name + "' might be separate with ':'") debug.warning("action 'run' wrong options options ... : '" + action_name + "' might be separate with ':'")
option_list = [] option_list = []
else: else:
option_list_tmp = option_list[1:]
option_list = [] option_list = []
for elem in option_list_tmp: #try:
option_list.append(elem.replace("1234COLUMN4321", ":")) self.run(module_name, option_list, bin_name)
#except AttributeError:
# debug.error("target have no 'run' instruction")
elif action_name == "log":
try:
self.show_log(module_name)
except AttributeError:
debug.error("target have no 'show_log' instruction")
else: else:
option_list = [] option_list = []
#try: #try:
@ -781,9 +791,8 @@ class Target:
and optionnal == True: and optionnal == True:
ret = [heritage.HeritageList(), False] ret = [heritage.HeritageList(), False]
else: else:
debug.warning("compare " + str(self.module_list) + " " + module_name)
for mod in self.module_list: for mod in self.module_list:
debug.warning("compare " + mod.get_name() + " == " + module_name) debug.verbose("compare " + mod.get_name() + " == " + module_name)
if mod.get_name() == module_name: if mod.get_name() == module_name:
if action_name[:4] == "dump": if action_name[:4] == "dump":
debug.info("dump module '" + module_name + "'") debug.info("dump module '" + module_name + "'")
@ -805,10 +814,6 @@ class Target:
if len(option_list) == 0: if len(option_list) == 0:
debug.warning("action 'gcov' wrong options options ... : '" + action_name + "' might be separate with ':'") debug.warning("action 'gcov' wrong options options ... : '" + action_name + "' might be separate with ':'")
option_list = [] option_list = []
else:
option_list = option_list[1:]
else:
option_list = []
if "output" in option_list: if "output" in option_list:
ret = mod.gcov(self, generate_output=True) ret = mod.gcov(self, generate_output=True)
else: else:
@ -823,6 +828,7 @@ class Target:
else: else:
ret = mod.build(self, package_name) ret = mod.build(self, package_name)
break break
# at the end of the build selected...
if optionnal == True \ if optionnal == True \
and ret == None: and ret == None:
ret = [heritage.HeritageList(), False] ret = [heritage.HeritageList(), False]
@ -830,14 +836,15 @@ class Target:
if ret == None: if ret == None:
debug.error("not know module name : '" + module_name + "' to '" + action_name + "' it") debug.error("not know module name : '" + module_name + "' to '" + action_name + "' it")
debug.verbose("requested : " + module_name + "?" + action_name + " [STOP]") debug.verbose("requested : " + module_name + "?" + action_name + " [STOP]")
if len(action_list) == 1: if len(action_list) == 1 and len(list_of_all_element) == 1:
return ret return ret
# end of all element processing...
## ##
## @brief Add action to do for package specific part when build upper element ## @brief Add action to do for package specific part when build upper element
## @param[in] name_of_state (string) a state to call action ## @param[in] name_of_state (string) a state to call action
## - BINARY ## - BINARY
## - BINARY_SHARED ## - BINARY_DYNAMIC
## - BINARY_STAND_ALONE ## - BINARY_STAND_ALONE
## - LIBRARY ## - LIBRARY
## - LIBRARY_DYNAMIC ## - LIBRARY_DYNAMIC
@ -883,7 +890,7 @@ class Target:
elif module.get_type() == 'BINARY' \ elif module.get_type() == 'BINARY' \
or module.get_type() == 'BINARY_STAND_ALONE': or module.get_type() == 'BINARY_STAND_ALONE':
self.make_package_binary(pkg_name, pkg_properties, base_pkg_path, heritage_list, static = True) self.make_package_binary(pkg_name, pkg_properties, base_pkg_path, heritage_list, static = True)
elif module.get_type() == 'BINARY_SHARED': elif module.get_type() == 'BINARY_DYNAMIC':
self.make_package_binary(pkg_name, pkg_properties, base_pkg_path, heritage_list, static = False) self.make_package_binary(pkg_name, pkg_properties, base_pkg_path, heritage_list, static = False)
elif module.get_type() == 'PACKAGE': elif module.get_type() == 'PACKAGE':
self.make_package_binary(pkg_name, pkg_properties, base_pkg_path, heritage_list, static = False) self.make_package_binary(pkg_name, pkg_properties, base_pkg_path, heritage_list, static = False)