This patch adds an authoritative list of statuses in one place as a tuple. This is left as a tuple since a tuple is immutable, but is still ordered. This list is ranked from best to worse (with skip and notrun at the end).
Signed-off-by: Dylan Baker <[email protected]> --- framework/status.py | 7 ++++++- piglit-summary-html.py | 15 +++++++++------ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/framework/status.py b/framework/status.py index bb7c594..48c8929 100644 --- a/framework/status.py +++ b/framework/status.py @@ -62,7 +62,9 @@ __all__ = ['NOTRUN', 'CRASH', 'DMESG_WARN', 'DMESG_FAIL', - 'SKIP'] + 'SKIP', + 'ALL'] + def status_lookup(status): """ Provided a string return a status object instance @@ -233,3 +235,6 @@ DMESG_FAIL = Status('dmesg-fail', 30) FAIL = Status('fail', 40) CRASH = Status('crash', 50) + +# A tuple (ordered, immutable) of all statuses in this module +ALL = (PASS, WARN, DMESG_WARN, FAIL, DMESG_FAIL, CRASH, SKIP, NOTRUN) diff --git a/piglit-summary-html.py b/piglit-summary-html.py index 4a51721..3f81fef 100755 --- a/piglit-summary-html.py +++ b/piglit-summary-html.py @@ -34,6 +34,11 @@ sys.path.append(path.dirname(path.realpath(sys.argv[0]))) def main(): + # Make a copy of the status text list and add all. This is used as the + # argument list for -e/--exclude + statuses = set(str(s) for s in status.ALL) + statuses.add('all') + parser = argparse.ArgumentParser() parser.add_argument("-o", "--overwrite", action="store_true", @@ -46,8 +51,7 @@ def main(): parser.add_argument("-e", "--exclude-details", default=[], action="append", - choices=['skip', 'pass', 'warn', 'crash' 'fail', - 'all'], + choices=statuses, help="Optionally exclude the generation of HTML pages " "for individual test pages with the status(es) " "given as arguments. This speeds up HTML " @@ -71,11 +75,10 @@ def main(): if args.exclude_details: # If exclude-results has all, then change it to be all if 'all' in args.exclude_details: - args.exclude_details = [status.SKIP, status.PASS, status.WARN, - status.CRASH, status.FAIL] + args.exclude_details = status.ALL else: - args.exclude_details = [status.status_lookup(i) for i in - args.exclude_details] + args.exclude_details = frozenset( + [status.status_lookup(i) for i in args.exclude_details]) # if overwrite is requested delete the output directory -- 1.9.1 _______________________________________________ Piglit mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/piglit
