From dd65f7c38a577df1e19729e4aa42d0bd53fefef5 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Wed, 22 Jan 2020 18:10:17 -0500 Subject: [PATCH] sanitycheck: change distribution of tests per set Sort by testcase name and path and not by platforms. This way we do not have the same platform executing on CI system causing failures to overload. Right now we have almost all qemu targets executing on 1 or 2 nodes, causing those systems to be overloaded. Instead of taking the default sorting by platforms, we now sort by testcases, so the distribution is more "random", but still reproducible. Remove the ordering function that would put native_posix in the first set, it is not being used anymore. Signed-off-by: Anas Nashif --- scripts/sanitycheck | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/scripts/sanitycheck b/scripts/sanitycheck index d431ce3dbc7..f238ceff7ba 100755 --- a/scripts/sanitycheck +++ b/scripts/sanitycheck @@ -3152,7 +3152,7 @@ class TestSuite: "rom_size"] cw = csv.DictWriter(csvfile, fieldnames, lineterminator=os.linesep) cw.writeheader() - for instance in sorted(self.instances.values()): + for instance in self.instances.values(): rowdict = {"test": instance.testcase.name, "arch": instance.platform.arch, "platform": instance.platform.name, @@ -3810,23 +3810,6 @@ def export_tests(filename, tests): logger.info("{} can't be exported".format(test)) -def native_and_unit_first(a, b): - if a[0].startswith('unit_testing'): - return -1 - if b[0].startswith('unit_testing'): - return 1 - if a[0].startswith('native_posix'): - return -1 - if b[0].startswith('native_posix'): - return 1 - if a[0].split("/", 1)[0].endswith("_bsim"): - return -1 - if b[0].split("/", 1)[0].endswith("_bsim"): - return 1 - - return (a > b) - (a < b) - - class HardwareMap: schema_path = os.path.join(ZEPHYR_BASE, "scripts", "sanity_chk", "hwmap-schema.yaml") @@ -4276,8 +4259,9 @@ def main(): return if options.subset: - # suite.instances = OrderedDict(sorted(suite.instances.items(), - # key=cmp_to_key(native_and_unit_first))) + suite.instances = OrderedDict(sorted(suite.instances.items(), + key=lambda x: x[0][x[0].find("/") + 1:])) + subset, sets = options.subset.split("/") total = len(suite.instances) per_set = round(total / int(sets))