Bug 1482057 - [raptor] Fix benchmark setup on Windows, r=jmaher
authorAndrew Halberstadt <ahalberstadt@mozilla.com>
Tue, 14 Aug 2018 18:06:20 +0000
changeset 431440 f88a04dbc4b16d8137261bcd5ef66d6788b66e3d
parent 431439 c22115a387fe44ad09ed8ec2a2483fdbe0d6d839
child 431441 1e0dffecbfb06dafcd853949ac06e4f0e8c7eaca
push id67769
push userahalberstadt@mozilla.com
push dateTue, 14 Aug 2018 18:07:19 +0000
treeherderautoland@f88a04dbc4b1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjmaher
bugs1482057
milestone63.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 1482057 - [raptor] Fix benchmark setup on Windows, r=jmaher This fixes a bug where the benchmarks weren't being copied properly on Windows. While it is slightly slower to add every file to the manifest (~0.2 seconds), it still outperforms shutil.copytree and is more robust (will use links on Linux/Mac while using copy on Windows). Differential Revision: https://phabricator.services.mozilla.com/D3234
testing/raptor/mach_commands.py
--- a/testing/raptor/mach_commands.py
+++ b/testing/raptor/mach_commands.py
@@ -6,24 +6,24 @@
 
 # Integrates raptor mozharness with mach
 
 from __future__ import absolute_import, print_function, unicode_literals
 
 import os
 import sys
 import json
+import shutil
 import socket
 import subprocess
 
+import mozfile
 from mach.decorators import CommandProvider, Command
 from mozboot.util import get_state_dir
 from mozbuild.base import MozbuildObject, MachCommandBase
-from mozpack.copier import FileCopier
-from mozpack.manifests import InstallManifest
 
 HERE = os.path.dirname(os.path.realpath(__file__))
 BENCHMARK_REPOSITORY = 'https://github.com/mozilla/perf-automation'
 BENCHMARK_REVISION = '4befd28725c687b91ce749420eab29352ecbcab4'
 
 
 class RaptorRunner(MozbuildObject):
     def run_test(self, raptor_args):
@@ -69,34 +69,40 @@ class RaptorRunner(MozbuildObject):
         if not os.path.isdir(external_repo_path):
             subprocess.check_call(['git', 'clone', BENCHMARK_REPOSITORY, external_repo_path])
         else:
             subprocess.check_call(['git', 'checkout', 'master'], cwd=external_repo_path)
             subprocess.check_call(['git', 'pull'], cwd=external_repo_path)
 
         subprocess.check_call(['git', 'checkout', BENCHMARK_REVISION], cwd=external_repo_path)
 
-        # Link benchmarks to the objdir
+        # Link or copy benchmarks to the objdir
         benchmark_paths = (
             os.path.join(external_repo_path, 'benchmarks'),
             os.path.join(self.topsrcdir, 'third_party', 'webkit', 'PerformanceTests'),
         )
-        manifest = InstallManifest()
+
+        benchmark_dest = os.path.join(self.topobjdir, 'testing', 'raptor', 'benchmarks')
+        if not os.path.isdir(benchmark_dest):
+            os.makedirs(benchmark_dest)
 
         for benchmark_path in benchmark_paths:
-            for path in os.listdir(benchmark_path):
-                abspath = os.path.join(benchmark_path, path)
-                if not os.path.isdir(abspath) or path.startswith('.'):
+            for name in os.listdir(benchmark_path):
+                path = os.path.join(benchmark_path, name)
+                dest = os.path.join(benchmark_dest, name)
+                if not os.path.isdir(path) or name.startswith('.'):
                     continue
 
-                manifest.add_link(abspath, path)
-
-        copier = FileCopier()
-        manifest.populate_registry(copier)
-        copier.copy(os.path.join(self.topobjdir, 'testing', 'raptor', 'benchmarks'))
+                if hasattr(os, 'symlink'):
+                    if not os.path.exists(dest):
+                        os.symlink(path, dest)
+                else:
+                    # Clobber the benchmark in case a recent update removed any files.
+                    mozfile.remove(dest)
+                    shutil.copytree(path, dest)
 
     def make_config(self):
         default_actions = ['populate-webroot', 'install-chrome', 'create-virtualenv', 'run-tests']
         self.config = {
             'run_local': True,
             'binary_path': self.binary_path,
             'repo_path': self.topsrcdir,
             'raptor_path': self.raptor_dir,