Bug 1365621 - Allow multiple test arguments for |mach test-info|; r=jmaher
authorGeoff Brown <gbrown@mozilla.com>
Wed, 17 May 2017 10:30:34 -0600
changeset 358844 af8c7cffc22a382b0914bcda418f69ee62af1b32
parent 358843 75ec8cde6e200705e9819653a64e7db23c812e25
child 358845 347c5cc8e367e0519d45a0da97ce98608128fd38
push id31839
push userkwierso@gmail.com
push dateWed, 17 May 2017 21:55:52 +0000
treeherdermozilla-central@2c783a7b6d05 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjmaher
bugs1365621
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1365621 - Allow multiple test arguments for |mach test-info|; r=jmaher
testing/mach_commands.py
--- a/testing/mach_commands.py
+++ b/testing/mach_commands.py
@@ -1,14 +1,15 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 from __future__ import absolute_import, print_function, unicode_literals
 
+import argparse
 import json
 import os
 import sys
 import tempfile
 import subprocess
 import shutil
 from collections import defaultdict
 
@@ -882,18 +883,18 @@ class ChunkFinder(MachCommandBase):
             shutil.rmtree(temp_dir)
 
 
 @CommandProvider
 class TestInfoCommand(MachCommandBase):
     from datetime import date, timedelta
     @Command('test-info', category='testing',
         description='Display historical test result summary.')
-    @CommandArgument('test_name', nargs='?', metavar='N',
-        help='Test of interest.')
+    @CommandArgument('test_names', nargs=argparse.REMAINDER,
+        help='Test(s) of interest.')
     @CommandArgument('--branches',
         default='mozilla-central,mozilla-inbound,autoland',
         help='Report for named branches (default: mozilla-central,mozilla-inbound,autoland)')
     @CommandArgument('--start',
         default=(date.today() - timedelta(7)).strftime("%Y-%m-%d"),
         help='Start date (YYYY-MM-DD)')
     @CommandArgument('--end',
         default=date.today().strftime("%Y-%m-%d"),
@@ -901,26 +902,21 @@ class TestInfoCommand(MachCommandBase):
     @CommandArgument('--verbose', action='store_true',
         help='Enable debug logging.')
 
     def test_info(self, **params):
 
         import which
         from mozbuild.base import MozbuildObject
 
-        self.test_name = params['test_name']
         self.branches = params['branches']
         self.start = params['start']
         self.end = params['end']
         self.verbose = params['verbose']
 
-        if len(self.test_name) < 6:
-            print("'%s' is too short for a test name!" % self.test_name)
-            return
-
         here = os.path.abspath(os.path.dirname(__file__))
         build_obj = MozbuildObject.from_environment(cwd=here)
 
         self._hg = None
         if conditions.is_hg(build_obj):
             if self._is_windows():
                 self._hg = which.which('hg.exe')
             else:
@@ -928,20 +924,26 @@ class TestInfoCommand(MachCommandBase):
 
         self._git = None
         if conditions.is_git(build_obj):
             if self._is_windows():
                 self._git = which.which('git.exe')
             else:
                 self._git = which.which('git')
 
-        self.set_test_name()
-        self.report_test_results()
-        self.report_test_durations()
-        self.report_bugs()
+        for test_name in params['test_names']:
+            print("===== %s =====" % test_name)
+            self.test_name = test_name
+            if len(self.test_name) < 6:
+                print("'%s' is too short for a test name!" % self.test_name)
+                continue
+            self.set_test_name()
+            self.report_test_results()
+            self.report_test_durations()
+            self.report_bugs()
 
     def find_in_hg_or_git(self, test_name):
         if self._hg:
             cmd = [self._hg, 'files', '-I', test_name]
         elif self._git:
             cmd = [self._git, 'ls-files', test_name]
         else:
             return None