Chromium Code Reviews| Index: dart/tools/test.py |
| =================================================================== |
| --- dart/tools/test.py (revision 813) |
| +++ dart/tools/test.py (working copy) |
| @@ -417,10 +417,11 @@ |
| self.context = context |
| self.duration = None |
| self.arch = [] |
| + self.FOOBAR = [] |
| def IsBatchable(self): |
| if self.context.use_batch: |
| - if self.arch and 'dartc' in self.arch: |
| + if self.FOOBAR and 'dartc' in self.FOOBAR: |
| return True |
| return False |
| @@ -530,11 +531,12 @@ |
| filename.close() |
| return self.config |
| - def ListTests(self, current_path, path, context, mode, arch): |
| + def ListTests(self, current_path, path, context, mode, arch, FOOBAR): |
| return self.GetConfiguration(context).ListTests(current_path, |
| path, |
| mode, |
| - arch) |
| + arch, |
| + FOOBAR) |
| def GetTestStatus(self, context, sections, defs): |
| self.GetConfiguration(context).GetTestStatus(sections, defs) |
| @@ -547,14 +549,14 @@ |
| super(LiteralTestSuite, self).__init__('root') |
| self.tests = tests |
| - def ListTests(self, current_path, path, context, mode, arch): |
| + def ListTests(self, current_path, path, context, mode, arch, FOOBAR): |
| name = path[0] |
| result = [] |
| for test in self.tests: |
| test_name = test.GetName() |
| if name.match(test_name): |
| full_path = current_path + [test_name] |
| - result += test.ListTests(full_path, path, context, mode, arch) |
| + result += test.ListTests(full_path, path, context, mode, arch, FOOBAR) |
| return result |
| def GetTestStatus(self, context, sections, defs): |
| @@ -598,9 +600,9 @@ |
| else: |
| return path |
| - def GetDart(self, mode, arch): |
| + def GetDart(self, mode, arch, FOOBAR): |
| """Returns the path to the Dart test runner (executes the .dart file).""" |
| - if arch == 'dartc': |
| + if FOOBAR == 'dartc': |
| command = [os.path.abspath( |
| os.path.join(self.GetBuildRoot(mode, arch), |
| 'compiler', 'bin', 'dartc_test'))] |
| @@ -743,7 +745,6 @@ |
| def Evaluate(self, env, defs): |
| """Evaluates expression in the .status file. e.g. ($arch == ia32).""" |
| - |
| if self.op == '||' or self.op == ',': |
| return self.left.Evaluate(env, defs) or self.right.Evaluate(env, defs) |
| elif self.op == 'if': |
| @@ -808,7 +809,7 @@ |
| """Lexical analysis of an expression in a .status file. |
| Example: |
| - [ $mode == debug && ($arch == chromium || $arch == dartc) ] |
| + [ $mode == debug && ($FOOBAR == chromium || $FOOBAR == dartc) ] |
| Args: |
| None. |
| @@ -983,7 +984,7 @@ |
| Args: |
| cases: list of TestCase objects to classify. |
| env: dictionary containing values for 'mode', |
| - 'system', 'arch' and 'checked'. |
| + 'system', 'FOOBAR', 'arch' and 'checked'. |
| Returns: |
| A triplet of (result, rules, expected_outcomes). |
| @@ -1153,7 +1154,7 @@ |
| result.add_option( |
| '--arch', |
| help='The architecture to run tests for', |
| - metavar='[all,ia32,x64,simarm,arm,dartc]', |
| + metavar='[all,ia32,x64,simarm,arm]', |
| default=ARCH_GUESS) |
| result.add_option( |
| '--os', |
| @@ -1186,7 +1187,7 @@ |
| action='store_true') |
| result.add_option( |
| '--batch', |
| - help='Run multiple tests for dartc architecture in a single vm', |
| + help='Run multiple tests for dartc FOOBAR in a single vm', |
| choices=['true', 'false'], |
| default='true', |
| type='choice') |
| @@ -1195,6 +1196,12 @@ |
| help='Invoke dart compiler with --optimize flag', |
| default=False, |
| action='store_true') |
| + result.add_option( |
| + '--FOOBAR', |
| + help='The runtime to test against ' |
| + '(most, vm, dartc, chromium, dartium, frog, frosh)', |
| + metavar='[most,vm,dartc,chromium,dartium,frog,frogsh]', |
| + default='vm') |
| return result |
| @@ -1204,20 +1211,31 @@ |
| options.arch = 'ia32,x64,simarm' |
| if options.mode == 'all': |
| options.mode = 'debug,release' |
| + if options.FOOBAR == 'most': |
| + options.FOOBAR = 'vm,dartc,frogsh' |
| + |
| + if 'dartc' in options.arch: |
| + options.FOOBAR = 'dartc' |
| + if 'dartium' in options.arch: |
| + options.FOOBAR = 'dartium' |
| + if 'chromium' in options.arch: |
| + options.FOOBAR = 'chromium' |
| + |
| # By default we run with a higher timeout setting in when running on |
| # a simulated architecture and in debug mode. |
| if not options.timeout: |
| options.timeout = TIMEOUT_SECS |
| - if 'dartc' in options.arch: |
| + if 'dartc' in options.FOOBAR: |
| options.timeout *= 4 |
| - elif 'chromium' in options.arch: |
| + elif 'chromium' in options.FOOBAR: |
| options.timeout *= 4 |
| - elif 'dartium' in options.arch: |
| + elif 'dartium' in options.FOOBAR: |
| options.timeout *= 4 |
| elif 'debug' in options.mode: |
| options.timeout *= 2 |
| options.mode = options.mode.split(',') |
| options.arch = options.arch.split(',') |
| + options.FOOBAR = options.FOOBAR.split(',') |
| for mode in options.mode: |
| if not mode in ['debug', 'release']: |
| print 'Unknown mode %s' % mode |
| @@ -1227,6 +1245,10 @@ |
| 'chromium']: |
| print 'Unknown arch %s' % arch |
| return False |
| + for FOOBAR in options.FOOBAR: |
| + if not FOOBAR in ['vm', 'dartc', 'chromium', 'dartium', 'frog', 'frogsh' ]: |
| + print 'Unknown FOOBAR %s' % FOOBAR |
| + return False |
| options.flags = [] |
| options.flags.append('--ignore-unrecognized-flags') |
| if options.checked: |
| @@ -1423,22 +1445,24 @@ |
| for path in paths: |
| for mode in options.mode: |
| for arch in options.arch: |
| - env = { |
| - 'mode': mode, |
| - 'system': utils.GuessOS(), |
| - 'arch': arch, |
| - 'checked': options.checked |
| - } |
| - test_list = root.ListTests([], path, context, mode, arch) |
| - (cases, unused_rules, unused_outcomes) = config.ClassifyTests( |
| - test_list, env) |
| - if globally_unused_rules is None: |
| - globally_unused_rules = set(unused_rules) |
| - else: |
| - globally_unused_rules = ( |
| - globally_unused_rules.intersection(unused_rules)) |
| - all_cases += cases |
| - all_unused.append(unused_rules) |
| + for FOOBAR in options.FOOBAR: |
| + env = { |
| + 'mode': mode, |
| + 'system': utils.GuessOS(), |
| + 'arch': arch, |
| + 'foobar': FOOBAR, |
|
ngeoffray
2011/10/27 14:30:13
Our tokenizer lower case expressions, so $FOOBAR i
|
| + 'checked': options.checked |
| + } |
| + test_list = root.ListTests([], path, context, mode, arch, FOOBAR) |
| + (cases, unused_rules, unused_outcomes) = config.ClassifyTests( |
| + test_list, env) |
| + if globally_unused_rules is None: |
| + globally_unused_rules = set(unused_rules) |
| + else: |
| + globally_unused_rules = ( |
| + globally_unused_rules.intersection(unused_rules)) |
| + all_cases += cases |
| + all_unused.append(unused_rules) |
| if options.report: |
| PrintReport(all_cases) |