blob: 08507cfaf6b7354dbdf4390aa597c6eeeb99ebfa [file] [log] [blame]
borenetf23dc492016-09-23 06:37:57 -07001# 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
9DEPS = [
Robert Iannucci297a7ef2017-05-12 19:09:38 -070010 'recipe_engine/context',
Eric Boren3e2ffd72017-06-16 13:10:22 -040011 'recipe_engine/file',
Eric Boren4c7754c2017-04-10 08:19:10 -040012 'recipe_engine/path',
borenetf23dc492016-09-23 06:37:57 -070013 'recipe_engine/properties',
Eric Boren4c7754c2017-04-10 08:19:10 -040014 'recipe_engine/step',
15 'recipe_engine/time',
borenetf23dc492016-09-23 06:37:57 -070016]
17
18
19def RunSteps(api):
Eric Boren4c7754c2017-04-10 08:19:10 -040020 # Upload the nanobench resuls.
21 builder_name = api.properties['buildername']
22
23 now = api.time.utcnow()
Eric Borencd0a98c2018-06-20 13:23:16 -040024 src_path = api.path['start_dir'].join('perf')
Robert Iannucci297a7ef2017-05-12 19:09:38 -070025 with api.context(cwd=src_path):
Eric Boren3e2ffd72017-06-16 13:10:22 -040026 results = api.file.glob_paths(
Eric Boren4c7754c2017-04-10 08:19:10 -040027 'find results',
Eric Boren3e2ffd72017-06-16 13:10:22 -040028 src_path,
29 '*.json',
30 test_data=['nanobench_abc123.json'])
Eric Boren4c7754c2017-04-10 08:19:10 -040031 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 Borenf9aa9e52017-04-10 09:56:10 -040041 issue = api.properties.get('patch_issue')
42 patchset = api.properties.get('patch_set')
Eric Boren4c7754c2017-04-10 08:19:10 -040043 if issue and patchset:
Eric Borenf9aa9e52017-04-10 09:56:10 -040044 gs_path = '/'.join(('trybot', gs_path, str(issue), str(patchset)))
Eric Boren4c7754c2017-04-10 08:19:10 -040045
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)
borenetf23dc492016-09-23 06:37:57 -070053
54
55def GenTests(api):
Kevin Lubick9ef6de72017-10-15 21:05:58 -040056 builder = 'Perf-Debian9-GCC-GCE-CPU-AVX2-x86_64-All-Debug'
borenetf23dc492016-09-23 06:37:57 -070057 yield (
Eric Boren4c7754c2017-04-10 08:19:10 -040058 api.test('normal_bot') +
59 api.properties(buildername=builder,
Eric Boren965861b2017-02-06 15:38:41 -050060 gs_bucket='skia-perf',
borenetf23dc492016-09-23 06:37:57 -070061 revision='abc123',
62 path_config='kitchen')
63 )
Eric Boren4c7754c2017-04-10 08:19:10 -040064
Eric Boren4c7754c2017-04-10 08:19:10 -040065 yield (
66 api.test('trybot') +
67 api.properties(buildername=builder,
68 gs_bucket='skia-perf',
69 revision='abc123',
70 path_config='kitchen',
Eric Borenf9aa9e52017-04-10 09:56:10 -040071 patch_storage='gerrit') +
72 api.properties.tryserver(
73 buildername=builder,
74 gerrit_project='skia',
75 gerrit_url='https://skia-review.googlesource.com/',
76 )
Eric Boren4c7754c2017-04-10 08:19:10 -040077 )