[commit: ghc] master: testsuite: Fix validation of ways (31281a4)

git at git.haskell.org git at git.haskell.org
Tue Sep 5 11:22:03 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/31281a476ded406091d0eaefc9d6f466272c985f/ghc

>---------------------------------------------------------------

commit 31281a476ded406091d0eaefc9d6f466272c985f
Author: Ben Gamari <bgamari.foss at gmail.com>
Date:   Mon Sep 4 07:58:48 2017 -0400

    testsuite: Fix validation of ways
    
    Test Plan: Run `make test WAY=prof`
    
    Reviewers: angerman, austin
    
    Subscribers: rwbarton, thomie
    
    GHC Trac Issues: #14181
    
    Differential Revision: https://phabricator.haskell.org/D3917


>---------------------------------------------------------------

31281a476ded406091d0eaefc9d6f466272c985f
 testsuite/driver/runtests.py | 27 ++++++++++++++++++---------
 1 file changed, 18 insertions(+), 9 deletions(-)

diff --git a/testsuite/driver/runtests.py b/testsuite/driver/runtests.py
index 3e03ed3..9f74494 100644
--- a/testsuite/driver/runtests.py
+++ b/testsuite/driver/runtests.py
@@ -51,8 +51,8 @@ parser.add_argument("--rootdir", action='append', help="root of tree containing
 parser.add_argument("--summary-file", help="file in which to save the (human-readable) summary")
 parser.add_argument("--no-print-summary", action="store_true", help="should we print the summary?")
 parser.add_argument("--only", action="append", help="just this test (can be give multiple --only= flags)")
-parser.add_argument("--way", choices=config.run_ways+config.compile_ways+config.other_ways, help="just this way")
-parser.add_argument("--skipway", action="append", choices=config.run_ways+config.compile_ways+config.other_ways, help="skip this way")
+parser.add_argument("--way", action="append", help="just this way")
+parser.add_argument("--skipway", action="append", help="skip this way")
 parser.add_argument("--threads", type=int, help="threads to run simultaneously")
 parser.add_argument("--check-files-written", help="check files aren't written by multiple tests") # NOTE: This doesn't seem to exist?
 parser.add_argument("--verbose", type=int, choices=[0,1,2,3,4,5], help="verbose (Values 0 through 5 accepted)")
@@ -71,6 +71,7 @@ for arg in args.config:
     field, value = arg.split('=', 1)
     setattr(config, field, value)
 
+all_ways = config.run_ways+config.compile_ways+config.other_ways
 config.rootdirs = args.rootdir
 config.summary_file = args.summary_file
 config.no_print_summary = args.no_print_summary
@@ -80,15 +81,23 @@ if args.only:
     config.run_only_some_tests = True
 
 if args.way:
-    config.cmdline_ways = [args.way] + config.cmdline_ways
-    if (args.way in config.other_ways):
-        config.run_ways = [args.way] + config.run_ways
-        config.compile_ways = [args.way] + config.compile_ways
+    for way in args.way:
+        if way not in all_ways:
+            print('WARNING: Unknown WAY %s in --way' % way)
+        else:
+            config.cmdline_ways += [way]
+            if way in config.other_ways:
+                config.run_ways += [way]
+                config.compile_ways += [way]
 
 if args.skipway:
-    config.other_ways = [w for w in config.other_ways if w != args.skipway]
-    config.run_ways = [w for w in config.run_ways if w != args.skipway]
-    config.compile_ways = [w for w in config.compile_ways if w != args.skipway]
+    for way in args.skipway:
+        if way not in all_ways:
+            print('WARNING: Unknown WAY %s in --skipway' % way)
+
+    config.other_ways = [w for w in config.other_ways if w not in args.skipway]
+    config.run_ways = [w for w in config.run_ways if w not in args.skipway]
+    config.compile_ways = [w for w in config.compile_ways if w not in args.skipway]
 
 if args.threads:
     config.threads = args.threads



More information about the ghc-commits mailing list