Add openjdk as a golem resource
Bug: 173189095
Change-Id: Iea47dfbf52a670f415a02bade43330d21725fab1
diff --git a/tools/run_on_app_dump.py b/tools/run_on_app_dump.py
index 176ce02..cc22a3b 100755
--- a/tools/run_on_app_dump.py
+++ b/tools/run_on_app_dump.py
@@ -9,6 +9,7 @@
import compiledump
import gradle
import hashlib
+import jdk
import optparse
import os
import shutil
@@ -449,7 +450,7 @@
f.write(line)
-def download_app(app_sha, internal, quiet=False):
+def download_sha(app_sha, internal, quiet=False):
if internal:
utils.DownloadFromX20(app_sha)
else:
@@ -508,7 +509,7 @@
else os.path.join(opensource_basedir, app_folder))
if not os.path.exists(app_dir) and not options.golem:
# Download the app from google storage.
- download_app(app_dir + ".tar.gz.sha1", app.internal)
+ download_sha(app_dir + ".tar.gz.sha1", app.internal)
# Ensure that the dumps are in place
assert os.path.isfile(dump_for_app(app_dir, app)), "Could not find dump " \
@@ -997,6 +998,10 @@
print('')
print('createOpenSourceAppBenchmarks() {')
print_indented('final cpus = ["Lenovo M90"];', 2)
+ # Avoid calculating this for every app
+ jdk_gz = jdk.GetJdkHome() + '.tar.gz'
+ download_sha(jdk_gz + '.sha1', False, quiet=True)
+ jdk_sha256 = get_sha256(jdk_gz)
for app in options.apps:
if app.folder and not app.internal:
indentation = 2;
@@ -1015,24 +1020,31 @@
print_indented('options.fromRevision = 9700;', indentation);
print_indented('options.mainFile = "tools/run_on_app_dump.py "', indentation)
print_indented('"--golem --shrinker r8 --app %s";' % app.name, indentation + 4)
+
app_gz = os.path.join(utils.OPENSOURCE_DUMPS_DIR, app.folder + '.tar.gz')
- app_sha = app_gz + '.sha1'
- # Golem uses a sha256 of the file in the cache, and you need to specify that.
- download_app(app_sha, app.internal, quiet=True)
- sha256 = get_sha256(app_gz)
- sha = get_sha_from_file(app_sha)
- print_indented('final resource = BenchmarkResource("",', indentation)
- print_indented('type: BenchmarkResourceType.Storage,', indentation + 4)
- print_indented('uri: "gs://r8-deps/%s",' % sha, indentation + 4)
- print_indented('hash:', indentation + 4)
- print_indented('"%s",' % sha256, indentation + 8)
- print_indented('extract: "gz");', indentation + 4);
- print_indented('options.resources.add(resource);', indentation)
+ add_golem_resource(indentation, app_gz, 'app_resource')
+ add_golem_resource(indentation, jdk_gz, 'openjdk', sha256=jdk_sha256)
+
print_indented('dumpsSuite.addBenchmark(name);', indentation)
indentation = 2
print_indented('}', indentation)
print('}')
+def add_golem_resource(indentation, gz, name, sha256=None):
+ sha = gz + '.sha1'
+ if not sha256:
+ # Golem uses a sha256 of the file in the cache, and you need to specify that.
+ download_sha(sha, False, quiet=True)
+ sha256 = get_sha256(gz)
+ sha = get_sha_from_file(sha)
+ print_indented('final %s = BenchmarkResource("",' % name, indentation)
+ print_indented('type: BenchmarkResourceType.Storage,', indentation + 4)
+ print_indented('uri: "gs://r8-deps/%s",' % sha, indentation + 4)
+ print_indented('hash:', indentation + 4)
+ print_indented('"%s",' % sha256, indentation + 8)
+ print_indented('extract: "gz");', indentation + 4);
+ print_indented('options.resources.add(%s);' % name, indentation)
+
def main(argv):
(options, args) = parse_options(argv)