diff --git a/waft/smplpkgs.py b/waft/smplpkgs.py index 5805a8fa3..4031b90b7 100644 --- a/waft/smplpkgs.py +++ b/waft/smplpkgs.py @@ -163,9 +163,11 @@ def __init__(self, bld, uses): # fixme: ugly layer-busting hack. self.script_environ['.bats'] = dict(BATS_LIB_PATH=bld.path.parent.find_dir("test").abspath()) - if not self.bld.env.TESTS: - debug("smplpkgs: tests suppressed for " + self.bld.path.name) - return + # fixme: want to still build but just not run tests if --tests is omitted.... + # if not self.bld.env.TESTS: + # debug("smplpkgs: tests suppressed for " + self.bld.path.name) + # return + debug(f"smplpkgs: test status: {self.bld.env.TESTS}") for group in test_group_sequence: self.do_group(group) @@ -174,17 +176,21 @@ def __init__(self, bld, uses): def do_group(self, group): self.bld.cycle_group("testing_"+group) - features = "" if group == "check" else "test" + features = "" + if group in ("atomic",) and self.bld.env.TESTS: + features = "test" # run as unit test prefixes = [group] prefixes += self.extra_prefixes.get(group, []) + debug(f'tests: group "{group}" with features "{features}" and prefixes "{prefixes}"') + for prefix in prefixes: for ext in self.compiled_extensions: pat = self.source_glob(prefix, ext) for one in self.bld.path.ant_glob(pat): - debug("tests: (%s) %s" %(features, one)) + debug(f'tests: ({features}) source: "{one}"') self.program(one, features) if group == "check": @@ -199,8 +205,8 @@ def do_group(self, group): def __enter__(self): - if not self.bld.env.TESTS: - debug("smplpkgs: variant checks will not be built nor run for " + self.bld.path.name) + # if not self.bld.env.TESTS: + # debug("smplpkgs: variant checks will not be built nor run for " + self.bld.path.name) return self def __exit__(self, exc_type, exc_value, exc_traceback): @@ -246,11 +252,9 @@ def nodify_declare(self, name_or_node, path=None): def program(self, source, features=""): '''Compile a C++ program to use in validation. - Add "test" as a feature to also run as a unit test. - ''' - if not self.bld.env.TESTS: - return + # if not self.bld.env.TESTS: + # return features = ["cxx","cxxprogram"] + to_list(features) rpath = self.bld.get_rpath(self.uses) # fixme source = self.nodify_resource(source) @@ -306,8 +310,8 @@ def script(self, source): def rule(self, rule, source="", target="", **kwds): 'Simple wrapper for arbitrary rule' - if not self.bld.env.TESTS: - return + # if not self.bld.env.TESTS: + # return self.bld(rule=rule, source=source, target=target, **kwds) diff --git a/waft/wcb_unit_test.py b/waft/wcb_unit_test.py index 8c467505b..33b1197d7 100644 --- a/waft/wcb_unit_test.py +++ b/waft/wcb_unit_test.py @@ -102,7 +102,6 @@ def make_interpreted_test(self): self.ut_env = env else: self.ut_env = dict(os.environ) - Logs.debug("wut: bats lib path: " + self.ut_env.get("BATS_LIB_PATH", "none")) paths = getattr(self, 'test_scripts_paths', {}) for (k,v) in paths.items(): @@ -321,7 +320,6 @@ def options(opt): """ Provide the ``--alltests``, ``--notests`` and ``--testcmd`` command-line options. """ - opt.add_option('--tests', default=None, action='store_true', help="Activate tests [default: off]") opt.add_option('--test-duration', type="float", action='store', @@ -343,6 +341,7 @@ def options(opt): opt.add_option('--dump-test-scripts', action='store_true', default=False, help='Create python scripts to help debug tests', dest='dump_test_scripts') + def intern_test_options(ctx, force=False): ''' Set ctx.env from options if they are given or forced. @@ -350,6 +349,7 @@ def intern_test_options(ctx, force=False): if force or ctx.options.tests is not None: ctx.env.TESTS = bool(ctx.options.tests) + Logs.debug(f'wut: tests:{ctx.options.tests} TESTS:{ctx.env.TESTS}') if force or ctx.options.test_duration is not None: ctx.env.TEST_DURATION = ctx.options.test_duration