X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=commands%2Fcheck.py;h=6d9f38bac88f26e1442ddb3981f4d0a48bb24c28;hb=03d495c2749b4ccbd234a7edd33e06ec344a1c2d;hp=ecc83a0e69753295dc8f9d69d9b99315e90c08b1;hpb=d403698cba290a11f513c4e2104ccce7e6d39b44;p=tools%2Fsat.git diff --git a/commands/check.py b/commands/check.py index ecc83a0..6d9f38b 100644 --- a/commands/check.py +++ b/commands/check.py @@ -23,9 +23,11 @@ import src # Define all possible option for the check command : sat check parser = src.options.Options() parser.add_option('p', 'products', 'list2', 'products', - _('products to configure. This option can be' + _('Optional: products to configure. This option can be' ' passed several time to configure several products.')) +CHECK_PROPERTY = "has_unit_tests" + def get_products_list(options, cfg, logger): '''method that gives the product list with their informations from configuration regarding the passed options. @@ -116,6 +118,47 @@ def check_product(p_name_info, config, logger): logger.write(header, 3) logger.write("\n", 4, False) logger.flush() + + # Verify if the command has to be launched or not + ignored = False + if not src.get_property_in_product_cfg(p_info, CHECK_PROPERTY): + msg = _("The product %s is defined as not having tests. " + "product ignored." % p_name) + logger.write("%s\n" % msg, 4) + ignored = True + if "build_dir" not in p_info: + msg = _("No build_dir key defined in " + "the config file of %s: product ignored." % p_name) + logger.write("%s\n" % msg, 4) + ignored = True + if not src.product.product_compiles(p_info): + msg = _("The product %s is defined as not compiling. " + "product ignored." % p_name) + logger.write("%s\n" % msg, 4) + ignored = True + + # Get the command to execute for script products + cmd_found = True + if src.product.product_has_script(p_info): + command = src.get_cfg_param(p_info, "test_build", "Not found") + if command == "Not found": + cmd_found = False + msg = _('WARNING: The product %s is defined as having tests. But it' + ' is compiled using a script and the key "test_build" is ' + 'not defined in the definition of %s' % p_name) + logger.write("%s\n" % msg, 4) + + if ignored or not cmd_found: + log_step(logger, header, "ignored") + logger.write("==== %(name)s %(IGNORED)s\n" % + { "name" : p_name , + "IGNORED" : src.printcolors.printcInfo("IGNORED")}, + 4) + logger.write("\n", 3, False) + logger.flush() + if not cmd_found: + return 1 + return 0 # Instantiate the class that manages all the construction commands # like cmake, check, make install, make test, environment management, etc... @@ -126,10 +169,9 @@ def check_product(p_name_info, config, logger): res_prepare = builder.prepare() log_res_step(logger, res_prepare) - # Execute buildconfigure, configure if the product is autotools - # Execute ccheck if the product is ccheck len_end_line = 20 + # Launch the check log_step(logger, header, "CHECK") res = builder.check() log_res_step(logger, res) @@ -159,7 +201,10 @@ def description(): :rtype: str ''' return _("The check command executes the \"check\" command in" - " the build directory") + " the build directory of all the products of the application." + "\nIt is possible to reduce the list of products to check by using" + " the --products option\n\nexample\nsat check SALOME-master " + "--products KERNEL,GUI,GEOM") def run(args, runner, logger): '''method that is called when salomeTools is called with check parameter.