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 <anas.nashif@intel.com>
This commit is contained in:
Anas Nashif 2020-01-22 18:10:17 -05:00
commit dd65f7c38a

View file

@ -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))