| OLD | NEW | 
|---|
| 1 // Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file | 
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a | 
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. | 
| 4 | 4 | 
| 5 part of testrunner; | 5 part of testrunner; | 
| 6 | 6 | 
| 7 /** Create and return an options parser for the test runner. */ | 7 /** Create and return an options parser for the test runner. */ | 
| 8 ArgParser getOptionParser() { | 8 ArgParser getOptionParser() { | 
| 9   var parser = new ArgParser(); | 9   var parser = new ArgParser(); | 
| 10 | 10 | 
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 193 /** | 193 /** | 
| 194  * Get the test runner configuration. This loads options from multiple | 194  * Get the test runner configuration. This loads options from multiple | 
| 195  * sources, in increasing order of priority: a test.config file in the | 195  * sources, in increasing order of priority: a test.config file in the | 
| 196  * current directory, a test config file specified with --configfile on | 196  * current directory, a test config file specified with --configfile on | 
| 197  * the command line, and other arguments specified on the command line. | 197  * the command line, and other arguments specified on the command line. | 
| 198  */ | 198  */ | 
| 199 ArgResults loadConfiguration(optionsParser) { | 199 ArgResults loadConfiguration(optionsParser) { | 
| 200   var options = new List(); | 200   var options = new List(); | 
| 201   // We first load options from a test.config file in the working directory. | 201   // We first load options from a test.config file in the working directory. | 
| 202   options.addAll(getFileContents('test.config', false). | 202   options.addAll(getFileContents('test.config', false). | 
| 203       filter((e) => e.trim().length > 0 && e[0] != '#')); | 203       where((e) => e.trim().length > 0 && e[0] != '#')); | 
| 204   // Next we look to see if the command line included a -testconfig argument, | 204   // Next we look to see if the command line included a -testconfig argument, | 
| 205   // and if so, load options from that file too; where these are not | 205   // and if so, load options from that file too; where these are not | 
| 206   // multi-valued they will take precedence over the ones in test.config. | 206   // multi-valued they will take precedence over the ones in test.config. | 
| 207   var commandLineArgs = new Options().arguments; | 207   var commandLineArgs = new Options().arguments; | 
| 208   var cfgarg = '--configfile'; | 208   var cfgarg = '--configfile'; | 
| 209   for (var i = 0; i < commandLineArgs.length; i++) { | 209   for (var i = 0; i < commandLineArgs.length; i++) { | 
| 210     if (commandLineArgs[i].startsWith(cfgarg)) { | 210     if (commandLineArgs[i].startsWith(cfgarg)) { | 
| 211       if (commandLineArgs[i] == cfgarg) { | 211       if (commandLineArgs[i] == cfgarg) { | 
| 212         if (i == commandLineArgs.length - 1) { | 212         if (i == commandLineArgs.length - 1) { | 
| 213           throw new Exception('Missing argument to $cfgarg'); | 213           throw new Exception('Missing argument to $cfgarg'); | 
| 214         } | 214         } | 
| 215         options.addAll(getFileContents(commandLineArgs[++i], true). | 215         options.addAll(getFileContents(commandLineArgs[++i], true). | 
| 216             filter((e) => e.trim().length > 0 && e[0] != '#')); | 216             where((e) => e.trim().length > 0 && e[0] != '#')); | 
| 217       } else if (commandLineArgs[i].startsWith('$cfgarg=')) { | 217       } else if (commandLineArgs[i].startsWith('$cfgarg=')) { | 
| 218         options.addAll( | 218         options.addAll( | 
| 219             getFileContents(commandLineArgs[i].substring(cfgarg.length), true). | 219             getFileContents(commandLineArgs[i].substring(cfgarg.length), true). | 
| 220                 filter((e) => e.trim().length > 0 && e[0] != '#')); | 220                 where((e) => e.trim().length > 0 && e[0] != '#')); | 
| 221       } else { | 221       } else { | 
| 222         throw new Exception('Missing argument to $cfgarg'); | 222         throw new Exception('Missing argument to $cfgarg'); | 
| 223       } | 223       } | 
| 224     } | 224     } | 
| 225   } | 225   } | 
| 226   // Finally, we add options from the command line. These have the highest | 226   // Finally, we add options from the command line. These have the highest | 
| 227   // precedence of all. | 227   // precedence of all. | 
| 228   options.addAll(commandLineArgs); | 228   options.addAll(commandLineArgs); | 
| 229   // Now try parse the whole collection of options, and if this fails, | 229   // Now try parse the whole collection of options, and if this fails, | 
| 230   // issue a usage message. | 230   // issue a usage message. | 
| (...skipping 25 matching lines...) Expand all  Loading... | 
| 256     print('--include and --exclude are mutually exclusive.'); | 256     print('--include and --exclude are mutually exclusive.'); | 
| 257     return false; | 257     return false; | 
| 258   } | 258   } | 
| 259   if ((config['layout-text'] || config['layout-pixel']) && | 259   if ((config['layout-text'] || config['layout-pixel']) && | 
| 260       config['runtime'] == 'vm') { | 260       config['runtime'] == 'vm') { | 
| 261     print('Layout tests must use --runtime values of "drt-dart" or "drt-js"'); | 261     print('Layout tests must use --runtime values of "drt-dart" or "drt-js"'); | 
| 262     return false; | 262     return false; | 
| 263   } | 263   } | 
| 264   return true; | 264   return true; | 
| 265 } | 265 } | 
| OLD | NEW | 
|---|