borenet | f23dc49 | 2016-09-23 06:37:57 -0700 | [diff] [blame] | 1 | # Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 | # Use of this source code is governed by a BSD-style license that can be |
| 3 | # found in the LICENSE file. |
| 4 | |
| 5 | |
| 6 | # Recipe for uploading nanobench results. |
| 7 | |
| 8 | |
| 9 | DEPS = [ |
Robert Iannucci | 297a7ef | 2017-05-12 19:09:38 -0700 | [diff] [blame] | 10 | 'recipe_engine/context', |
Eric Boren | 3e2ffd7 | 2017-06-16 13:10:22 -0400 | [diff] [blame] | 11 | 'recipe_engine/file', |
Eric Boren | 4c7754c | 2017-04-10 08:19:10 -0400 | [diff] [blame] | 12 | 'recipe_engine/path', |
borenet | f23dc49 | 2016-09-23 06:37:57 -0700 | [diff] [blame] | 13 | 'recipe_engine/properties', |
Eric Boren | 4c7754c | 2017-04-10 08:19:10 -0400 | [diff] [blame] | 14 | 'recipe_engine/step', |
| 15 | 'recipe_engine/time', |
borenet | f23dc49 | 2016-09-23 06:37:57 -0700 | [diff] [blame] | 16 | ] |
| 17 | |
| 18 | |
| 19 | def RunSteps(api): |
Eric Boren | 4c7754c | 2017-04-10 08:19:10 -0400 | [diff] [blame] | 20 | # Upload the nanobench resuls. |
| 21 | builder_name = api.properties['buildername'] |
| 22 | |
| 23 | now = api.time.utcnow() |
Eric Boren | cd0a98c | 2018-06-20 13:23:16 -0400 | [diff] [blame] | 24 | src_path = api.path['start_dir'].join('perf') |
Robert Iannucci | 297a7ef | 2017-05-12 19:09:38 -0700 | [diff] [blame] | 25 | with api.context(cwd=src_path): |
Eric Boren | 3e2ffd7 | 2017-06-16 13:10:22 -0400 | [diff] [blame] | 26 | results = api.file.glob_paths( |
Eric Boren | 4c7754c | 2017-04-10 08:19:10 -0400 | [diff] [blame] | 27 | 'find results', |
Eric Boren | 3e2ffd7 | 2017-06-16 13:10:22 -0400 | [diff] [blame] | 28 | src_path, |
| 29 | '*.json', |
| 30 | test_data=['nanobench_abc123.json']) |
Eric Boren | 4c7754c | 2017-04-10 08:19:10 -0400 | [diff] [blame] | 31 | if len(results) != 1: # pragma: nocover |
| 32 | raise Exception('Unable to find nanobench or skpbench JSON file!') |
| 33 | |
| 34 | src = results[0] |
| 35 | basename = api.path.basename(src) |
| 36 | gs_path = '/'.join(( |
| 37 | 'nano-json-v1', str(now.year).zfill(4), |
| 38 | str(now.month).zfill(2), str(now.day).zfill(2), str(now.hour).zfill(2), |
| 39 | builder_name)) |
| 40 | |
Eric Boren | f9aa9e5 | 2017-04-10 09:56:10 -0400 | [diff] [blame] | 41 | issue = api.properties.get('patch_issue') |
| 42 | patchset = api.properties.get('patch_set') |
Eric Boren | 4c7754c | 2017-04-10 08:19:10 -0400 | [diff] [blame] | 43 | if issue and patchset: |
Eric Boren | f9aa9e5 | 2017-04-10 09:56:10 -0400 | [diff] [blame] | 44 | gs_path = '/'.join(('trybot', gs_path, str(issue), str(patchset))) |
Eric Boren | 4c7754c | 2017-04-10 08:19:10 -0400 | [diff] [blame] | 45 | |
| 46 | dst = '/'.join(( |
| 47 | 'gs://%s' % api.properties['gs_bucket'], gs_path, basename)) |
| 48 | |
| 49 | api.step( |
| 50 | 'upload', |
| 51 | cmd=['gsutil', 'cp', '-z', 'json', src, dst], |
| 52 | infra_step=True) |
borenet | f23dc49 | 2016-09-23 06:37:57 -0700 | [diff] [blame] | 53 | |
| 54 | |
| 55 | def GenTests(api): |
Kevin Lubick | 9ef6de7 | 2017-10-15 21:05:58 -0400 | [diff] [blame] | 56 | builder = 'Perf-Debian9-GCC-GCE-CPU-AVX2-x86_64-All-Debug' |
borenet | f23dc49 | 2016-09-23 06:37:57 -0700 | [diff] [blame] | 57 | yield ( |
Eric Boren | 4c7754c | 2017-04-10 08:19:10 -0400 | [diff] [blame] | 58 | api.test('normal_bot') + |
| 59 | api.properties(buildername=builder, |
Eric Boren | 965861b | 2017-02-06 15:38:41 -0500 | [diff] [blame] | 60 | gs_bucket='skia-perf', |
borenet | f23dc49 | 2016-09-23 06:37:57 -0700 | [diff] [blame] | 61 | revision='abc123', |
| 62 | path_config='kitchen') |
| 63 | ) |
Eric Boren | 4c7754c | 2017-04-10 08:19:10 -0400 | [diff] [blame] | 64 | |
Eric Boren | 4c7754c | 2017-04-10 08:19:10 -0400 | [diff] [blame] | 65 | yield ( |
| 66 | api.test('trybot') + |
| 67 | api.properties(buildername=builder, |
| 68 | gs_bucket='skia-perf', |
| 69 | revision='abc123', |
| 70 | path_config='kitchen', |
Eric Boren | f9aa9e5 | 2017-04-10 09:56:10 -0400 | [diff] [blame] | 71 | patch_storage='gerrit') + |
| 72 | api.properties.tryserver( |
| 73 | buildername=builder, |
| 74 | gerrit_project='skia', |
| 75 | gerrit_url='https://skia-review.googlesource.com/', |
| 76 | ) |
Eric Boren | 4c7754c | 2017-04-10 08:19:10 -0400 | [diff] [blame] | 77 | ) |