From 92b5a542e4c20c1b2952ea2c7bad4eb01076986a Mon Sep 17 00:00:00 2001 From: Serge Rehbinder Date: Thu, 2 Feb 2017 11:36:57 +0100 Subject: [PATCH] add the --check option to the compile command in order to launch the tests after compilation --- commands/compile.py | 44 +++++++++++++++++++++++++++++--------------- complete_sat.sh | 4 ++-- 2 files changed, 31 insertions(+), 17 deletions(-) diff --git a/commands/compile.py b/commands/compile.py index 20afeb9..ece2588 100644 --- a/commands/compile.py +++ b/commands/compile.py @@ -51,6 +51,8 @@ parser.add_option('', 'show', 'boolean', 'no_compile', parser.add_option('', 'stop_first_fail', 'boolean', 'stop_first_fail', _( "Optional: Stops the command at first product compilation" " fail."), False) +parser.add_option('', 'check', 'boolean', 'check', _( + "Optional: execute the unit tests after compilation"), False) def get_products_list(options, cfg, logger): '''method that gives the product list with their informations from @@ -358,23 +360,29 @@ def compile_all_products(sat, config, options, products_infos, logger): len_end_line) if res_prod != 0: - # Clean the install directory if there is any - logger.write(_("Cleaning the install directory if there is any\n"), - 5) - sat.clean(config.VARS.application + - " --products " + p_name + - " --install", - batch=True, - verbose=0, - logger_add_link = logger) res += 1 + if error_step != "CHECK": + # Clean the install directory if there is any + logger.write(_( + "Cleaning the install directory if there is any\n"), + 5) + sat.clean(config.VARS.application + + " --products " + p_name + + " --install", + batch=True, + verbose=0, + logger_add_link = logger) + # Log the result if res_prod > 0: logger.write("\r%s%s" % (header, " " * len_end_line), 3) logger.write("\r" + header + src.printcolors.printcError("KO ") + error_step) logger.write("\n==== %(KO)s in compile of %(name)s \n" % { "name" : p_name , "KO" : src.printcolors.printcInfo("ERROR")}, 4) + if error_step == "CHECK": + logger.write(_("\nINSTALL directory = %s" % + src.printcolors.printcInfo(p_info.install_dir)), 3) logger.flush() else: logger.write("\r%s%s" % (header, " " * len_end_line), 3) @@ -448,12 +456,18 @@ def compile_product(sat, p_name_info, config, options, logger, header, len_end): if res==0: logger.write(_("Add the config file in installation directory\n"), 5) add_compile_config_file(p_info, config) - - # Do the unit tests (call the check command) - log_step(logger, header, "CHECK") - res += sat.check(config.VARS.application + " --products " + p_name, - verbose = 0, - logger_add_link = logger) + + if options.check: + # Do the unit tests (call the check command) + log_step(logger, header, "CHECK") + res_check = sat.check( + config.VARS.application + " --products " + p_name, + verbose = 0, + logger_add_link = logger) + if res_check != 0: + error_step = "CHECK" + + res += res_check return res, len_end_line, error_step diff --git a/complete_sat.sh b/complete_sat.sh index 27b3f8a..bd05037 100755 --- a/complete_sat.sh +++ b/complete_sat.sh @@ -154,7 +154,7 @@ _salomeTools_complete() # show argument for each command case "${command}" in config) - opts="--value --list --copy --edit --no_label --info" + opts="--value --list --copy --edit --no_label --info --show_patchs" COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) return 0 ;; @@ -204,7 +204,7 @@ _salomeTools_complete() return 0 ;; compile) - opts="--products --with_fathers --with_children --clean_all --make_flags --show --stop_first_fail" + opts="--products --with_fathers --with_children --clean_all --make_flags --show --stop_first_fail --check" COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) return 0 ;; -- 2.39.2