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 9DEPS = [ 10 'recipe_engine/context', 11 'recipe_engine/file', 12 'recipe_engine/path', 13 'recipe_engine/properties', 14 'recipe_engine/step', 15 'recipe_engine/time', 16] 17 18 19def RunSteps(api): 20 # Upload the nanobench results. 21 builder_name = api.properties['buildername'] 22 23 now = api.time.utcnow() 24 src_path = api.path['start_dir'].join('perf') 25 with api.context(cwd=src_path): 26 results = api.file.glob_paths( 27 'find results', 28 src_path, 29 '*.json', 30 test_data=['nanobench_abc123.json']) 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 41 issue = api.properties.get('patch_issue') 42 patchset = api.properties.get('patch_set') 43 if issue and patchset: 44 gs_path = '/'.join(('trybot', gs_path, str(issue), str(patchset))) 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) 53 54 55def GenTests(api): 56 builder = 'Perf-Debian9-GCC-GCE-CPU-AVX2-x86_64-All-Debug' 57 yield ( 58 api.test('normal_bot') + 59 api.properties(buildername=builder, 60 gs_bucket='skia-perf', 61 revision='abc123', 62 path_config='kitchen') 63 ) 64 65 yield ( 66 api.test('trybot') + 67 api.properties(buildername=builder, 68 gs_bucket='skia-perf', 69 revision='abc123', 70 path_config='kitchen', 71 patch_storage='gerrit') + 72 api.properties.tryserver( 73 buildername=builder, 74 gerrit_project='skia', 75 gerrit_url='https://skia-review.googlesource.com/', 76 ) 77 ) 78