[DEV] upgrade to support multiple run test and chach at the end only (add suport of gnuc++ on GLB (bad hook)

This commit is contained in:
Edouard DUPIN 2022-02-06 22:30:17 +01:00
parent 1604b08af7
commit 88834cc4d0
10 changed files with 294 additions and 118 deletions

View File

@ -30,9 +30,12 @@ encoding//lutin/z_system/lutinSystem_Android_m.py=utf-8
encoding//lutin/z_system/lutinSystem_IOs_c.py=utf-8
encoding//lutin/z_system/lutinSystem_IOs_cxx.py=utf-8
encoding//lutin/z_system/lutinSystem_Linux_alsa.py=utf-8
encoding//lutin/z_system/lutinSystem_Linux_bsd.py=utf-8
encoding//lutin/z_system/lutinSystem_Linux_bz2.py=utf-8
encoding//lutin/z_system/lutinSystem_Linux_c.py=utf-8
encoding//lutin/z_system/lutinSystem_Linux_cxx.py=utf-8
encoding//lutin/z_system/lutinSystem_Linux_egl.py=utf-8
encoding//lutin/z_system/lutinSystem_Linux_gnutls.py=utf-8
encoding//lutin/z_system/lutinSystem_Linux_khr.py=utf-8
encoding//lutin/z_system/lutinSystem_Linux_m.py=utf-8
encoding//lutin/z_system/lutinSystem_Linux_mysql.py=utf-8
@ -41,6 +44,7 @@ encoding//lutin/z_system/lutinSystem_Linux_pthread.py=utf-8
encoding//lutin/z_system/lutinSystem_Linux_python3-numpy.py=utf-8
encoding//lutin/z_system/lutinSystem_Linux_python3.py=utf-8
encoding//lutin/z_system/lutinSystem_Linux_rt.py=utf-8
encoding//lutin/z_system/lutinSystem_Linux_sodium.py=utf-8
encoding//lutin/z_system/lutinSystem_Linux_z.py=utf-8
encoding//lutin/z_system/lutinSystem_MacOs_Cocoa.py=utf-8
encoding//lutin/z_system/lutinSystem_Windows_ole.py=utf-8

169
bin/lutin
View File

@ -41,6 +41,7 @@ myArgs.add("o", "force-optimisation", desc="Force optimisation of the build")
myArgs.add("w", "warning", desc="Store warning in a file build file")
myArgs.add("i", "isolate-system", desc="Isolate system build (copy header of c and c++ system lib to not include unneeded external libs) EXPERIMENTAL (archlinux)")
myArgs.add("K", "ccache", desc="Enable the ccache interface")
myArgs.add("A", "async-fail", desc="Asynchronous fail of all the run execution, this permit to execute all test and report all fails")
myArgs.add_section("properties", "keep in the sequency of the cible")
myArgs.add("t", "target", haveParam=True, desc="Select a target (by default the platform is the computer that compile this) To know list : 'lutin.py --list-target'")
@ -62,27 +63,29 @@ localArgument = myArgs.parse()
display the help of this makefile
"""
def usage(full=False):
color = debug.get_color_set()
color = debug.get_color_set();
# generic argument displayed :
myArgs.display()
print(" All target can finish with '?clean' '?dump' '?gcov' ... ?action (@ can replace ?)" )
print(" " + color['green'] + "all" + color['default'])
print(" build all (only for the current selected board) (bynary and packages)")
print(" " + color['green'] + "clean" + color['default'])
print(" clean all (same as previous)")
print(" " + color['green'] + "dump" + color['default'])
print(" Dump all the module dependency and properties")
print(" " + color['green'] + "dependency" + color['default'])
print(" generate a file dependency.dot that represent all the dependency link")
print(" Select what in included: 'dependency:LPBDK'")
print(" L: Library")
print(" P: Pre-build")
print(" D: Data")
print(" B: Binary")
print(" K: Package")
print(" eg: lutin dependency:LD ; dot -Tsvg dependency.dot -o dependency.svg ; firefox dependency.svg")
print(" " + color['green'] + "gcov" + color['default'])
print(" Parse all the code of the library with the gcov resolution")
myArgs.display();
print(" All target can finish with '?clean' '?dump' '?gcov' ... ?action (@ can replace ?)" );
print(" " + color['green'] + "all" + color['default']);
print(" build all (only for the current selected board) (bynary and packages)");
print(" " + color['green'] + "clean" + color['default']);
print(" clean all (same as previous)");
print(" " + color['green'] + "dump" + color['default']);
print(" Dump all the module dependency and properties");
print(" " + color['green'] + "dependency" + color['default']);
print(" generate a file dependency.dot that represent all the dependency link");
print(" Select what in included: 'dependency:LPBDK'");
print(" L: Library");
print(" P: Pre-build");
print(" D: Data");
print(" B: Binary");
print(" K: Package");
print(" eg: lutin dependency:LD ; dot -Tsvg dependency.dot -o dependency.svg ; firefox dependency.svg");
print(" " + color['green'] + "gcov" + color['default']);
print(" Parse all the code of the library with the gcov resolution");
print(" " + color['green'] + "run" + color['default']);
print(" Execute the application in the module. add ':' to add parameter to set in the program parameters");
listOfAllModule = module.list_all_module_with_desc()
for mod in listOfAllModule:
data_print = " "
@ -172,6 +175,7 @@ def usage(full=False):
print(" ex complex arguments : " + sys.argv[0] + " -cclang -mdebug zeus-package-base?build?run%zeus-launcher:--srv=user:--elog-level=5")
print(" ex gcov: " + sys.argv[0] + " -cgcc --gcov -mdebug etk-test?build?run etk?gcov")
print(" ex gcov with output: " + sys.argv[0] + " -cgcc --gcov -mdebug etk-test?build?run etk?gcov:output")
print(" ex multiple test execution with end resume: " + sys.argv[0] + " --async-fail -cgcc -mdebug *-test?build?run")
exit(0)
@ -224,22 +228,29 @@ def parseGenericArg(argument, active):
return True
if argument.get_option_name() == "list-target":
if active == False:
list_of_target = target.list_all_target()
retValue = ""
list_of_target = target.list_all_target();
retValue = "";
for targetName in list_of_target:
if retValue != "":
retValue += " "
retValue += targetName
print(retValue)
exit(0)
retValue += " ";
retValue += targetName;
print(retValue);
exit(0);
return True
elif argument.get_option_name()=="jobs":
if active == True:
multiprocess.set_core_number(int(argument.get_arg()))
multiprocess.set_core_number(int(argument.get_arg()));
return True
elif argument.get_option_name()=="depth":
if active == True:
env.set_parse_depth(int(argument.get_arg()))
env.set_parse_depth(int(argument.get_arg()));
return True
elif argument.get_option_name()=="async-fail":
if active == True:
if check_boolean(argument.get_arg()) == True:
env.set_async_fail(True);
else:
env.set_async_fail(False);
return True
elif argument.get_option_name()=="ccache":
if active == True:
@ -379,36 +390,37 @@ config = {
"gcov":False,
"compilator-version":""
}
elementErrors = [];
# load the default target :
my_target = None
actionDone=False
my_target = None;
actionDone=False;
# parse all argument
for argument in localArgument:
if parseGenericArg(argument, False) == True:
continue
continue;
elif argument.get_option_name() == "compilator-version":
config["compilator-version"] = argument.get_arg()
config["compilator-version"] = argument.get_arg();
elif argument.get_option_name() == "package":
config["generate-package"]=False
config["generate-package"]=False;
elif argument.get_option_name() == "simulation":
config["simulation"]=True
config["simulation"]=True;
elif argument.get_option_name() == "gcov":
config["gcov"]=True
config["gcov"]=True;
elif argument.get_option_name() == "bus":
config["bus-size"]=argument.get_arg()
config["bus-size"]=argument.get_arg();
elif argument.get_option_name() == "arch":
config["arch"]=argument.get_arg()
config["arch"]=argument.get_arg();
elif argument.get_option_name() == "compilator":
if config["compilator"] != argument.get_arg():
debug.debug("change compilator ==> " + argument.get_arg())
config["compilator"] = argument.get_arg()
debug.debug("change compilator ==> " + argument.get_arg());
config["compilator"] = argument.get_arg();
#remove previous target
my_target = None
my_target = None;
elif argument.get_option_name() == "target":
# No check input ==> this will be verify automaticly chen the target will be loaded
if targetName != argument.get_arg():
targetName = argument.get_arg()
debug.debug("change target ==> '" + targetName + "' & reset mode : gcc&release")
targetName = argument.get_arg();
debug.debug("change target ==> '" + targetName + "' & reset mode : gcc&release");
#reset properties by defauult:
config = {
"compilator":lutinHost.HOST_DEFAULT_COMPILATOR,
@ -419,53 +431,76 @@ for argument in localArgument:
"simulation":False,
"gcov":False,
"compilator-version":""
}
};
#remove previous target
my_target = None
my_target = None;
elif argument.get_option_name() == "mode":
if config["mode"] != argument.get_arg():
config["mode"] = argument.get_arg()
debug.debug("change mode ==> " + config["mode"])
config["mode"] = argument.get_arg();
debug.debug("change mode ==> " + config["mode"]);
#remove previous target
my_target = None
my_target = None;
else:
argument_value = argument.get_arg()
debug.debug("something request : '" + argument_value + "'")
argument_value = argument.get_arg();
debug.debug("something request : '" + argument_value + "'");
if argument.get_option_name() != "":
debug.warning("Can not understand argument : '" + argument.get_option_name() + "'")
usage()
debug.warning("Can not understand argument : '" + argument.get_option_name() + "'");
usage();
break;
name2 = argument_value.replace("@", "?")
gettedElement = name2.split("?")
module_name = gettedElement[0]
action_list = gettedElement[1:]
name2 = argument_value.replace("@", "?");
gettedElement = name2.split("?");
module_name = gettedElement[0];
action_list = gettedElement[1:];
if len(action_list) == 0:
action_list = "build"
debug.debug("requested: '" + module_name + "' ? actions:'" + str(action_list) + "'")
multiple_module_list = []
action_list = "build";
debug.debug("requested: '" + module_name + "' ? actions:'" + str(action_list) + "'");
multiple_module_list = [];
if module_name[-1] == "*":
base_name = module_name[:-1]
base_name = module_name[:-1];
for mod in module.list_all_module():
if mod[:len(base_name)] == base_name:
debug.verbose("need do it for: " + mod);
multiple_module_list.append(mod)
multiple_module_list.append(mod);
else:
multiple_module_list.append(module_name)
debug.debug("Will do: '" + str(multiple_module_list) + "' ? actions:'" + str(action_list) + "'")
multiple_module_list.append(module_name);
debug.debug("Will do: '" + str(multiple_module_list) + "' ? actions:'" + str(action_list) + "'");
for module_name in multiple_module_list:
#load the target if needed :
if my_target == None:
my_target = target.load_target(targetName, copy.deepcopy(config))
my_target.build(module_name, actions=action_list)
actionDone=True
my_target = target.load_target(targetName, copy.deepcopy(config));
heritage, is_build, error_nodes = my_target.build(module_name, actions=action_list);
if error_nodes != None:
for err in error_nodes:
elementErrors.append(err);
actionDone=True;
# if no action done : we do "all" ...
if actionDone==False:
#load the target if needed :
if my_target == None:
my_target = target.load_target(targetName, config)
my_target.build("all")
my_target = target.load_target(targetName, config);
heritage, is_build, error_nodes = my_target.build("all");
if error_nodes != None:
for err in error_nodes:
elementErrors.append(err);
if len(elementErrors) != 0:
have_error = False;
for elret in elementErrors:
out = " '" + str(elret["module"]) + "'";
if elret["bin"] != None:
out += " ==> bin name='" + str(elret["bin"]) + "'";
if len(elret["options"]) != 0:
out += " with option: " + str(elret["options"]);
if elret["return"] != 0:
debug.warning("[ FAIL ] " + out + " RETURN value: " + str(elret["return"]));
have_error = True;
else:
debug.info("[ OK ] " + out);
if have_error:
debug.error("Execution fail...");
# stop all started threads;
multiprocess.un_init()

View File

@ -118,17 +118,29 @@ def get_warning_mode():
global store_warning
return store_warning
ccache=False
ccache=False;
def set_ccache(val):
global ccache
global ccache;
if val == True:
ccache = True
ccache = True;
else:
ccache = False
ccache = False;
def get_ccache():
global ccache
return ccache
global ccache;
return ccache;
async_fail=False
def set_async_fail(val):
global async_fail;
if val == True:
async_fail = True;
else:
async_fail = False;
def get_async_fail():
global async_fail;
return async_fail;
def end_with(name, list):
for appl in list:

View File

@ -607,7 +607,7 @@ class Module:
# optionnal dependency :
for dep, option, export, src_file, header_file, option_not_found in self._depends_optionnal:
debug.verbose("try find optionnal dependency: '" + str(dep) + "'")
inherit_list, isBuilt = target.build(dep, True, package_name=package_name)
inherit_list, isBuilt, build_errors = target.build(dep, True, package_name=package_name)
if isBuilt == True:
self._local_heritage.add_depends(dep);
self.add_flag(option[0], option[1], export=export);
@ -619,7 +619,7 @@ class Module:
self._sub_heritage_list.add_heritage_list(inherit_list)
for dep in self._depends:
debug.debug("module: '" + str(self._name) + "' request: '" + dep + "'")
inherit_list = target.build(dep, False, package_name=package_name)
inherit_list, isBuilt, build_errors = target.build(dep, False, package_name=package_name)
# add at the heritage list :
self._sub_heritage_list.add_heritage_list(inherit_list)
# do sub library action for automatic generating ...

View File

@ -156,7 +156,7 @@ list_of_element_availlable=[
"."
],
"compilation-version": {
"c++": 2017,
"c++": 2017, # -2017 for gnu17
"java": 16
},
"dependency": [
@ -660,7 +660,10 @@ def GLD_add_depend(my_module, data):
def GLD_compile_version(my_module, data):
for elem in data.keys():
my_module.compile_version(elem, data[elem])
if data[elem] < 0:
my_module.compile_version(elem, -data[elem], gnu=True)
else:
my_module.compile_version(elem, data[elem])
def GLD_copy(my_module, data):
try:

View File

@ -657,6 +657,7 @@ class Target:
## @return (None|Module handle| ...) complicated return ...
##
def build(self, name, optionnal=False, actions=[], package_name=None):
debug.extreme_verbose("call build ... " + str(name));
if len(name.split("?")) != 1\
or len(name.split("@")) != 1:
debug.error("need update")
@ -727,6 +728,7 @@ class Target:
list_of_all_element = module.list_filtered_module(name);
else:
list_of_all_element = [name]
global_run_error = [];
for module_name in list_of_all_element:
action_list = actions
for action_name in action_list:
@ -743,16 +745,17 @@ class Target:
except AttributeError:
debug.error("target have no 'un_install_package' instruction")
elif action_name[:3] == "run":
sub_action_name = action_name[3:];
"""
if mod.get_type() != "BINARY" \
and mod.get_type() != "PACKAGE":
debug.error("Can not run other than 'BINARY' ... pakage='" + mod.get_type() + "' for module='" + module_name + "'")
"""
bin_name = None
if len(action_name) > 3:
if action_name[3] == '%':
if len(sub_action_name) > 0:
if sub_action_name[0] == '%':
bin_name = ""
for elem in action_name[4:]:
for elem in sub_action_name[1:]:
if elem == ":":
break;
bin_name += elem
@ -765,19 +768,25 @@ class Target:
option_list = []
else:
option_list = []
#try:
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")
ret = self.run(module_name, option_list, bin_name);
else:
option_list = []
#try:
self.run(module_name, option_list, bin_name)
ret = self.run(module_name, option_list, bin_name)
if env.get_async_fail():
if ret != 0:
debug.error("FAIL in execute process : '" + str(module_name) + "' ==> bin name='" + str(bin_name) + "' with option: " + str(option_list) + " RETURN value: " + str(ret));
else:
debug.warning("FAIL in execute process : '" + str(module_name) + "' ==> bin name='" + str(bin_name) + "' with option: " + str(option_list) + " RETURN value: " + str(ret));
else:
global_run_error.append({
"module": module_name,
"bin": bin_name,
"options": option_list,
"return": ret,
"type": "Execution Fail ..."
})
#except AttributeError:
# debug.error("target have no 'run' instruction")
elif action_name == "log":
@ -789,7 +798,7 @@ class Target:
present = self.load_if_needed(module_name, optionnal=optionnal)
if present == False \
and optionnal == True:
ret = [heritage.HeritageList(), False]
ret = [heritage.HeritageList(), False, None]
else:
for mod in self.module_list:
debug.verbose("compare " + mod.get_name() + " == " + module_name)
@ -823,23 +832,25 @@ class Target:
if len(action_name) > 5:
debug.warning("action 'build' does not support options ... : '" + action_name + "'")
debug.debug("build module '" + module_name + "'")
if optionnal == True:
ret = [mod.build(self, package_name), True]
else:
ret = mod.build(self, package_name)
ret = [mod.build(self, package_name), True, None]
break
# at the end of the build selected...
if optionnal == True \
and ret == None:
ret = [heritage.HeritageList(), False]
ret = [heritage.HeritageList(), False, None]
break
if ret == None:
debug.error("not know module name : '" + module_name + "' to '" + action_name + "' it")
debug.verbose("requested : " + module_name + "?" + action_name + " [STOP]")
if len(action_list) == 1 and len(list_of_all_element) == 1:
return ret
#display errors
if len(global_run_error) != 0:
pass;
else:
if len(action_list) == 1 and len(list_of_all_element) == 1:
return ret
# end of all element processing...
if len(global_run_error) != 0:
return [None, False, global_run_error];
##
## @brief Add action to do for package specific part when build upper element
## @param[in] name_of_state (string) a state to call action
@ -1152,28 +1163,29 @@ class Target:
or ret_changelog
def install_package(self, pkg_name):
debug.debug("------------------------------------------------------------------------")
debug.info("-- Install package '" + pkg_name + "'")
debug.debug("------------------------------------------------------------------------")
debug.error("action not implemented ...")
debug.debug("------------------------------------------------------------------------");
debug.info("-- Install package '" + pkg_name + "'");
debug.debug("------------------------------------------------------------------------");
debug.error("action not implemented ...");
def un_install_package(self, pkg_name):
debug.debug("------------------------------------------------------------------------")
debug.info("-- Un-Install package '" + pkg_name + "'")
debug.debug("------------------------------------------------------------------------")
debug.error("action not implemented ...")
debug.debug("------------------------------------------------------------------------");
debug.info("-- Un-Install package '" + pkg_name + "'");
debug.debug("------------------------------------------------------------------------");
debug.error("action not implemented ...");
def run(self, pkg_name, option_list, binary_name = None):
debug.debug("------------------------------------------------------------------------")
debug.info("-- Run package '" + pkg_name + "' + option: " + str(option_list))
debug.debug("------------------------------------------------------------------------")
debug.error("action not implemented ...")
debug.debug("------------------------------------------------------------------------");
debug.info("-- Run package '" + pkg_name + "' + option: " + str(option_list));
debug.debug("------------------------------------------------------------------------");
debug.warning("action not implemented ...");
return -1;
def show_log(self, pkg_name):
debug.debug("------------------------------------------------------------------------")
debug.info("-- Show log logcat '" + pkg_name + "'")
debug.debug("------------------------------------------------------------------------")
debug.error("action not implemented ...")
debug.debug("------------------------------------------------------------------------");
debug.info("-- Show log logcat '" + pkg_name + "'");
debug.debug("------------------------------------------------------------------------");
debug.error("action not implemented ...");
##
## @brief convert a s list of string in a string separated by a ","

View File

@ -0,0 +1,40 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license MPL v2.0 (see license file)
##
from realog import debug
from lutin import system
from lutin import tools
from lutin import env
import os
class System(system.System):
def __init__(self, target):
system.System.__init__(self)
# create some HELP:
self.set_help("bz2 : ???")
# No check ==> on the basic std libs:
self.set_valid(True)
# todo : create a searcher of the presence of the library:
self.add_flag("link-lib", "bsd")
self.add_depend([
'c'
])
"""
if env.get_isolate_system() == True:
self.add_header_file([
"/usr/include/sys/mman.h",
"/usr/include/sys/stat.h"
],
clip_path="/usr/include",
recursive=False)
"""

View File

@ -0,0 +1,40 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license MPL v2.0 (see license file)
##
from realog import debug
from lutin import system
from lutin import tools
from lutin import env
import os
class System(system.System):
def __init__(self, target):
system.System.__init__(self)
# create some HELP:
self.set_help("bz2 : ???")
# No check ==> on the basic std libs:
self.set_valid(True)
# todo : create a searcher of the presence of the library:
self.add_flag("link-lib", "gnutls")
self.add_depend([
'c'
])
"""
if env.get_isolate_system() == True:
self.add_header_file([
"/usr/include/sys/mman.h",
"/usr/include/sys/stat.h"
],
clip_path="/usr/include",
recursive=False)
"""

View File

@ -0,0 +1,31 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license MPL v2.0 (see license file)
##
from realog import debug
from lutin import system
from lutin import tools
from lutin import env
import os
class System(system.System):
def __init__(self, target):
system.System.__init__(self)
# create some HELP:
self.set_help("sodium : ???")
# No check ==> on the basic std libs:
self.set_valid(True)
# todo : create a searcher of the presence of the library:
self.add_flag("link-lib", "sodium")
self.add_depend([
'c'
])

View File

@ -174,10 +174,9 @@ class Target(target.Target):
for elem in option_list:
cmd += elem + " ";
ret = multiprocess.run_command_pwd(cmd, appl_path);
if ret != 0:
debug.error("application exit with error: " + str(ret));
debug.debug("------------------------------------------------------------------------")
debug.info("-- Run package '" + pkg_name + "' Finished")
debug.info("-- Run package '" + pkg_name + "' Finished ret=" + str(ret))
debug.debug("------------------------------------------------------------------------")
return ret;