Bug 1331482 - Upload a list of manifests as an artifact in mochitest jobs r=jgraham
authorAndrew Halberstadt <ahalberstadt@mozilla.com>
Thu, 12 Jan 2017 15:29:47 -0500
changeset 329790 0be9ebdc6488a99a072b38e4b427d0a11e575371
parent 329789 66363b305bc6f12b1b3eea6e9b0376339d172ecc
child 329791 59d503b1f67e32ac05d83298ef442e3a12fe6c2c
push id36168
push userahalberstadt@mozilla.com
push dateWed, 18 Jan 2017 14:23:36 +0000
treeherderautoland@0be9ebdc6488 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
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 1331482 - Upload a list of manifests as an artifact in mochitest jobs r=jgraham MozReview-Commit-ID: C0sVKADG70C
--- a/testing/mochitest/runtests.py
+++ b/testing/mochitest/runtests.py
@@ -1370,55 +1370,68 @@ toolbar#nav-bar {
                 exists=False, disabled=disabled, filters=filters, **info)
             if len(tests) == 0:
                 self.log.error("no tests to run using specified "
                                "combination of filters: {}".format(
         paths = []
+        # When running mochitest locally the manifest is based on topsrcdir,
+        # but when running in automation it is based on the test root.
+        manifest_root = build_obj.topsrcdir if build_obj else self.testRootAbs
+        manifests = set()
         for test in tests:
             if len(tests) == 1 and 'disabled' in test:
                 del test['disabled']
             pathAbs = os.path.abspath(test['path'])
             assert pathAbs.startswith(self.testRootAbs)
             tp = pathAbs[len(self.testRootAbs):].replace('\\', '/').strip('/')
             if not self.isTest(options, tp):
                     'Warning: %s from manifest %s is not a valid test' %
                     (test['name'], test['manifest']))
+            manifests.add(os.path.relpath(test['manifest'], manifest_root))
             testob = {'path': tp}
             if 'disabled' in test:
                 testob['disabled'] = test['disabled']
             if 'expected' in test:
                 testob['expected'] = test['expected']
             if 'scheme' in test:
                 testob['scheme'] = test['scheme']
         def path_sort(ob1, ob2):
             path1 = ob1['path'].split('/')
             path2 = ob2['path'].split('/')
             return cmp(path1, path2)
-        self._active_tests = paths
         if options.dump_tests:
             options.dump_tests = os.path.expanduser(options.dump_tests)
             assert os.path.exists(os.path.dirname(options.dump_tests))
             with open(options.dump_tests, 'w') as dumpFile:
-                dumpFile.write(json.dumps({'active_tests': self._active_tests}))
+                dumpFile.write(json.dumps({'active_tests': paths}))
             self.log.info("Dumping active_tests to %s file." % options.dump_tests)
+        # Upload a list of test manifests that were executed in this run.
+        if 'MOZ_UPLOAD_DIR' in os.environ:
+            artifact = os.path.join(os.environ['MOZ_UPLOAD_DIR'], 'manifests.list')
+            with open(artifact, 'a') as fh:
+                fh.write('\n'.join(sorted(manifests)))
+        self._active_tests = paths
         return self._active_tests
     def getTestManifest(self, options):
         if isinstance(options.manifestFile, TestManifest):
             manifest = options.manifestFile
         elif options.manifestFile and os.path.isfile(options.manifestFile):
             manifestFileAbs = os.path.abspath(options.manifestFile)
             assert manifestFileAbs.startswith(SCRIPT_DIR)