[Piglit] [PATCH 14/16] piglit-summary.py: Make -s and -d mutually exclusive

Dylan Baker baker.dylan.c at gmail.com
Thu Jun 13 08:36:21 PDT 2013


Since -s/--summary will always override -d/--diff don't allow them to be
called together. While this may seem a little confusing, the idea of
asking for --diffs and then not getting them is a bug in the original
implementation.

Signed-off-by: Dylan Baker <baker.dylan.c at gmail.com>
---
 piglit-summary.py | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/piglit-summary.py b/piglit-summary.py
index 70c74dc..f07d644 100755
--- a/piglit-summary.py
+++ b/piglit-summary.py
@@ -44,16 +44,22 @@ def parse_listfile(filename):
     return open(filename, "r").read().rstrip().split('\n')
 
 
+
 def main():
     parser = argparse.ArgumentParser()
-    parser.add_argument("-d", "--diff",
+
+    # Set the -d and -s options as exclusive, since it's silly to call for diff
+    # and then call for only summary
+    excGroup1 = parser.add_mutually_exclusive_group()
+    excGroup1.add_argument("-d", "--diff",
                         action  = "store_true",
                         help    = "Only display the differences between"
                                   "multiple result files")
-    parser.add_argument("-s", "--summary",
+    excGroup1.add_argument("-s", "--summary",
                         action  = "store_true",
                         help    = "Only display the summary, not the"
                                   "individual test results")
+
     parser.add_argument("-l", "--list",
                         action  = "store",
                         help    = "Use test results from a list file")
-- 
1.8.1.4



More information about the Piglit mailing list