Chromium Code Reviews| Index: tools/telemetry/telemetry/test_runner.py |
| diff --git a/tools/telemetry/telemetry/test_runner.py b/tools/telemetry/telemetry/test_runner.py |
| index fe9922a7843ff2bfba6b3d726d64551a0c7f8c8d..bc589dec5084a26567af131a9461a18e9ce1da19 100644 |
| --- a/tools/telemetry/telemetry/test_runner.py |
| +++ b/tools/telemetry/telemetry/test_runner.py |
| @@ -54,31 +54,39 @@ class Help(Command): |
| return 0 |
| +def GetShortDescriptionOf(thing): |
|
dtu
2013/07/03 01:25:43
_GetShortDescriptionOf
|
| + if not thing.__doc__: |
| + return None |
| + return thing.__doc__.splitlines()[0] |
| + |
| + |
| class List(Command): |
| """Lists the available tests""" |
| def AddParserOptions(self, parser): |
| parser.add_option('-j', '--json', action='store_true') |
| + test.AddOptionsForRunDecoratorToParser(parser) |
| def Run(self, options, args): |
| + test_list = [] |
| + for test_name, test_class in sorted(_GetTests().items()): |
| + if not test_class.CanRun(options): |
| + continue |
| + test_list.append({ |
| + 'name': test_name, |
| + 'description': GetShortDescriptionOf(test_class), |
| + 'options': test_class.options, |
| + }) |
| + |
| if options.json: |
| - test_list = [] |
| - for test_name, test_class in sorted(_GetTests().items()): |
| - test_list.append({ |
| - 'name': test_name, |
| - 'description': test_class.__doc__, |
| - 'enabled': test_class.enabled, |
|
dtu
2013/07/03 01:25:43
There are two tests in content/test/gpu/gpu_tests
|
| - 'options': test_class.options, |
| - }) |
| print json.dumps(test_list) |
| else: |
| - print 'Available tests are:' |
| - for test_name, test_class in sorted(_GetTests().items()): |
| - if test_class.__doc__: |
| - print ' %-20s %s' % (test_name, |
| - test_class.__doc__.splitlines()[0]) |
| + print'Available tests are:' |
| + for t in test_list: |
| + if t['description']: |
|
dtu
2013/07/03 01:25:43
If GetShortDescriptionOf() returns '', you don't n
|
| + print ' %-20s %s' % (t['name'], t['description']) |
| else: |
| - print ' %-20s' % test_name |
| + print ' %-20s' % t['name'] |
| return 0 |
| @@ -90,14 +98,18 @@ class Run(Command): |
| def CreateParser(self): |
| options = browser_options.BrowserOptions() |
| parser = options.CreateParser('%%prog %s %s' % (self.name, self.usage)) |
| + test.AddOptionsForRunDecoratorToParser(parser) |
| return parser |
| def ValidateCommandLine(self, parser, options, args): |
| if not args: |
| parser.error('Must provide at least one test name') |
| for test_name in args: |
| - if test_name not in _GetTests(): |
| + t = _GetTests().get(test_name, None) |
| + if not t: |
| parser.error('No test named "%s"' % test_name) |
| + if not t.CanRun(options): |
| + parser.error('Test "%s" can not run with these options.' % test_name) |
| def Run(self, options, args): |
| total_failures = 0 |