diff options
author | Rico Wind <ricow@google.com> | 2021-03-16 09:37:11 +0100 |
---|---|---|
committer | Rico Wind <ricow@google.com> | 2021-03-17 07:38:22 +0000 |
commit | 61a034f9b017a95df9d41414815bf21eb1797d28 (patch) | |
tree | 4c5bb7e42c021bc38e73b25fa83e7d7995b697b7 | |
parent | e32a9c72720fa017573701a90b8690899f498760 (diff) | |
download | r8-61a034f9b017a95df9d41414815bf21eb1797d28.tar.gz |
Add openjdk as a golem resource
Bug: 173189095
Change-Id: Iea47dfbf52a670f415a02bade43330d21725fab1
-rwxr-xr-x | tools/run_on_app_dump.py | 40 |
1 files changed, 26 insertions, 14 deletions
diff --git a/tools/run_on_app_dump.py b/tools/run_on_app_dump.py index 176ce028d..cc22a3b47 100755 --- a/tools/run_on_app_dump.py +++ b/tools/run_on_app_dump.py @@ -9,6 +9,7 @@ import as_utils import compiledump import gradle import hashlib +import jdk import optparse import os import shutil @@ -449,7 +450,7 @@ def remove_print_lines(file): 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 @@ def get_results_for_app(app, options, temp_dir): 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 @@ def print_golem_config(options): 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 @@ def print_golem_config(options): 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) |