def verify_facets(tree, description_list, subset, mat, first, matlimit): def flatten(tree): for k, v in tree.items(): if v is None and '.yaml' in k: yield k elif v is not None and '.disable' not in k: for x in flatten(v): yield x def pptree(tree, tabs=0): ret = "" for k, v in tree.items(): if v is None: ret += ('\t' * tabs) + k.ljust(10) + "\n" else: ret += ('\t' * tabs) + (k + ':').ljust(10) + "\n" ret += pptree(v, tabs + 1) return ret def deyamlify(name): if name.endswith('.yaml'): return name[:-5] else: return name for facet in (deyamlify(_) for _ in flatten(tree)): found = False for i in description_list: if facet in i: found = True break if not found: print( "tree\n{tree}\ngenerated list\n{desc}\n\nfrom matrix\n\n{matrix}\nsubset {subset} without facet {fac}" .format(tree=pptree(tree), desc='\n'.join(description_list), subset=subset, matrix=str(mat), fac=facet)) all_desc = build_matrix.generate_combinations( 'root', mat, 0, mat.size()) for i, desc in zip(range(mat.size()), all_desc): if i == first: print('==========') print("{} {}".format(i, desc)) if i + 1 == matlimit: print('==========') assert found
def verify_facets(tree, description_list, subset, mat, first, matlimit): def flatten(tree): for k,v in tree.iteritems(): if v is None and '.yaml' in k: yield k elif v is not None and '.disable' not in k: for x in flatten(v): yield x def pptree(tree, tabs=0): ret = "" for k, v in tree.iteritems(): if v is None: ret += ('\t'*tabs) + k.ljust(10) + "\n" else: ret += ('\t'*tabs) + (k + ':').ljust(10) + "\n" ret += pptree(v, tabs+1) return ret for facet in flatten(tree): found = False for i in description_list: if facet in i: found = True break if not found: print "tree\n{tree}\ngenerated list\n{desc}\n\nfrom matrix\n\n{matrix}\nsubset {subset} without facet {fac}".format( tree=pptree(tree), desc='\n'.join(description_list), subset=subset, matrix=str(mat), fac=facet) all_desc = build_matrix.generate_combinations( 'root', mat, 0, mat.size()) for i, desc in zip(xrange(mat.size()), all_desc): if i == first: print '==========' print i, desc if i + 1 == matlimit: print '==========' assert found
def output_summary(path, limit=0, seed=None, subset=None, show_desc=True, show_frag=False, show_matrix=False, filter_in=None, filter_out=None, filter_all=None, filter_fragments=True): """ Prints number of all facets for a given suite for inspection, taking into accout such options like --subset, --filter, --filter-out and --filter-all. Optionally dumps matrix objects, yaml files which is used for generating combinations. """ random.seed(seed) mat, first, matlimit = _get_matrix(path, subset) configs = generate_combinations(path, mat, first, matlimit) count = 0 suite = os.path.basename(path) config_list = util.filter_configs(configs, suite_name=suite, filter_in=filter_in, filter_out=filter_out, filter_all=filter_all, filter_fragments=filter_fragments) for c in config_list: if limit and count >= limit: break count += 1 if show_desc or show_frag: print("{}".format(c[0])) if show_frag: for path in c[1]: print(" {}".format(util.strip_fragment_path(path))) if show_matrix: print(mat.tostr(1)) print("# {}/{} {}".format(count, len(configs), path))
def generate_description_list(tree, subset): mat, first, matlimit = build_matrix._get_matrix('root', subset=subset) return [ i[0] for i in build_matrix.generate_combinations( 'root', mat, first, matlimit) ], mat, first, matlimit
def generate_description_list(tree, subset): mat, first, matlimit = build_matrix._get_matrix( 'root', subset=subset) return [i[0] for i in build_matrix.generate_combinations( 'root', mat, first, matlimit)], mat, first, matlimit