From 3e014cb319f91dbe47c7f7b408e114839dd5a2e5 Mon Sep 17 00:00:00 2001 From: machenbach Date: Mon, 19 Oct 2015 01:41:55 -0700 Subject: [PATCH] [test] Pull benchmarks as a dependency. BUG=chromium:535160 LOG=n Review URL: https://codereview.chromium.org/1411143002 Cr-Commit-Position: refs/heads/master@{#31359} --- .gitignore | 6 +--- DEPS | 2 ++ test/benchmarks/testcfg.py | 67 ++++++++++---------------------------- 3 files changed, 20 insertions(+), 55 deletions(-) diff --git a/.gitignore b/.gitignore index b56a783617..0c6cbb1f84 100644 --- a/.gitignore +++ b/.gitignore @@ -48,11 +48,7 @@ shell_g /out /perf.data /perf.data.old -/test/benchmarks/CHECKED_OUT_* -/test/benchmarks/downloaded_* -/test/benchmarks/kraken -/test/benchmarks/octane -/test/benchmarks/sunspider +/test/benchmarks/data /test/mozilla/data /test/promises-aplus/promises-tests /test/promises-aplus/promises-tests.tar.gz diff --git a/DEPS b/DEPS index cd4194ae24..34ceb20906 100644 --- a/DEPS +++ b/DEPS @@ -19,6 +19,8 @@ deps = { Var("git_url") + "/external/github.com/google/googletest.git" + "@" + "6f8a66431cb592dad629028a50b3dd418a408c87", "v8/testing/gmock": Var("git_url") + "/external/googlemock.git" + "@" + "0421b6f358139f02e102c9c332ce19a33faf75be", + "v8/test/benchmarks/data": + Var("git_url") + "/v8/deps/third_party/benchmarks.git" + "@" + "05d7188267b4560491ff9155c5ee13e207ecd65f", "v8/test/mozilla/data": Var("git_url") + "/v8/deps/third_party/mozilla-tests.git" + "@" + "f6c578a10ea707b1a8ab0b88943fe5115ce2b9be", "v8/test/simdjs/data": Var("git_url") + "/external/github.com/tc39/ecmascript_simd.git" + "@" + "c8ef63c728283debc25891123eb00482fee4b8cd", diff --git a/test/benchmarks/testcfg.py b/test/benchmarks/testcfg.py index 0c3698bd60..f96071b1b0 100644 --- a/test/benchmarks/testcfg.py +++ b/test/benchmarks/testcfg.py @@ -28,8 +28,6 @@ import os import shutil -import subprocess -import tarfile from testrunner.local import statusfile from testrunner.local import testsuite @@ -54,7 +52,7 @@ class BenchmarksTestSuite(testsuite.TestSuite): def __init__(self, name, root): super(BenchmarksTestSuite, self).__init__(name, root) - self.testroot = root + self.testroot = os.path.join(root, "data") def ListTests(self, context): tests = [] @@ -146,56 +144,25 @@ class BenchmarksTestSuite(testsuite.TestSuite): with open(filename) as f: return f.read() - def _DownloadIfNecessary(self, url, revision, target_dir): - # Maybe we're still up to date? - revision_file = "CHECKED_OUT_%s" % target_dir - checked_out_revision = None - if os.path.exists(revision_file): - with open(revision_file) as f: - checked_out_revision = f.read() - if checked_out_revision == revision: - return - - # If we have a local archive file with the test data, extract it. - if os.path.exists(target_dir): - shutil.rmtree(target_dir) - archive_file = "downloaded_%s_%s.tar.gz" % (target_dir, revision) - if os.path.exists(archive_file): - with tarfile.open(archive_file, "r:gz") as tar: - tar.extractall() - with open(revision_file, "w") as f: - f.write(revision) - return - - # No cached copy. Check out via SVN, and pack as .tar.gz for later use. - command = "svn co %s -r %s %s" % (url, revision, target_dir) - code = subprocess.call(command, shell=True) - if code != 0: - raise Exception("Error checking out %s benchmark" % target_dir) - with tarfile.open(archive_file, "w:gz") as tar: - tar.add("%s" % target_dir) - with open(revision_file, "w") as f: - f.write(revision) - def DownloadData(self): - old_cwd = os.getcwd() - os.chdir(os.path.abspath(self.root)) + print "Benchmarks download is deprecated. It's part of DEPS." - self._DownloadIfNecessary( - ("http://svn.webkit.org/repository/webkit/trunk/PerformanceTests/" - "SunSpider/tests/sunspider-1.0.2/"), - "159499", "sunspider") + def rm_dir(directory): + directory_name = os.path.join(self.root, directory) + if os.path.exists(directory_name): + shutil.rmtree(directory_name) - self._DownloadIfNecessary( - ("http://kraken-mirror.googlecode.com/svn/trunk/kraken/tests/" - "kraken-1.1/"), - "8", "kraken") - - self._DownloadIfNecessary( - "http://octane-benchmark.googlecode.com/svn/trunk/", - "26", "octane") - - os.chdir(old_cwd) + # Clean up old directories and archive files. + rm_dir('kraken') + rm_dir('octane') + rm_dir('sunspider') + archive_files = [f for f in os.listdir(self.root) + if f.startswith("downloaded_") or + f.startswith("CHECKED_OUT_")] + if len(archive_files) > 0: + print "Clobber outdated test archives ..." + for f in archive_files: + os.remove(os.path.join(self.root, f)) def _VariantGeneratorFactory(self): return BenchmarksVariantGenerator