Salome HOME
add the --check option to the compile command in order to launch the tests after...
authorSerge Rehbinder <serge.rehbinder@cea.fr>
Thu, 2 Feb 2017 10:36:57 +0000 (11:36 +0100)
committerSerge Rehbinder <serge.rehbinder@cea.fr>
Thu, 2 Feb 2017 10:36:57 +0000 (11:36 +0100)
commands/compile.py
complete_sat.sh

index 20afeb9ee29cdf6f139e0df92ac3adacf4dcf586..ece2588a9d7956069d5e7e6b30286eb54b9c86e6 100644 (file)
@@ -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
 
index 27b3f8af85c438d0b4fec764d0bef6ff34b328b1..bd05037943cd45db90a7cadc31156265b59dd596 100755 (executable)
@@ -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
             ;;