aboutsummaryrefslogtreecommitdiffhomepage
path: root/infra/bots/recipes
diff options
context:
space:
mode:
authorGravatar Yuqian Li <liyuqian@google.com>2017-10-24 09:43:21 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-10-24 14:19:31 +0000
commit2ebf3d11f1c6d43e1d8304c4efcc6a041c1bf6a0 (patch)
tree2dace42ec79562e023274590cdd520da955fe796 /infra/bots/recipes
parent027815fb7815d960a494d1eee38cf67da9b415cb (diff)
Upload calmbench results
Bug: skia: Change-Id: I31c8a625e2b4ed30a8cf0f03035b311ca1c21f88 Reviewed-on: https://skia-review.googlesource.com/63060 Commit-Queue: Yuqian Li <liyuqian@google.com> Reviewed-by: Eric Boren <borenet@google.com>
Diffstat (limited to 'infra/bots/recipes')
-rw-r--r--infra/bots/recipes/calmbench.py4
-rw-r--r--infra/bots/recipes/upload_calmbench_results.expected/normal_bot.json167
-rw-r--r--infra/bots/recipes/upload_calmbench_results.expected/trybot.json171
-rw-r--r--infra/bots/recipes/upload_calmbench_results.py101
4 files changed, 443 insertions, 0 deletions
diff --git a/infra/bots/recipes/calmbench.py b/infra/bots/recipes/calmbench.py
index 82d5e0dfe1..cceceb6f53 100644
--- a/infra/bots/recipes/calmbench.py
+++ b/infra/bots/recipes/calmbench.py
@@ -20,6 +20,10 @@ DEPS = [
'vars',
]
+# TODO (liyuqian): Currently, this recipe combines both compile and nanobench
+# functions. In the future, we may want to break it into two recipes, which
+# would be useful for Android/iOS tests. To do that, I also have to add compile-
+# only option to tools/calmbench/calmbench.py.
def RunSteps(api):
api.core.setup()
api.flavor.install(skps=True, svgs=True)
diff --git a/infra/bots/recipes/upload_calmbench_results.expected/normal_bot.json b/infra/bots/recipes/upload_calmbench_results.expected/normal_bot.json
new file mode 100644
index 0000000000..400f56e15c
--- /dev/null
+++ b/infra/bots/recipes/upload_calmbench_results.expected/normal_bot.json
@@ -0,0 +1,167 @@
+[
+ {
+ "cmd": [
+ "python",
+ "-u",
+ "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+ "--json-output",
+ "/path/to/tmp/json",
+ "ensure-directory",
+ "--mode",
+ "0777",
+ "[CUSTOM_/_B_WORK]"
+ ],
+ "infra_step": true,
+ "name": "makedirs checkout_path"
+ },
+ {
+ "cmd": [
+ "python",
+ "-u",
+ "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+ "--json-output",
+ "/path/to/tmp/json",
+ "remove",
+ "[CUSTOM_/_B_WORK]/.gclient_entries"
+ ],
+ "infra_step": true,
+ "name": "remove [CUSTOM_/_B_WORK]/.gclient_entries"
+ },
+ {
+ "cmd": [
+ "python",
+ "-u",
+ "RECIPE_MODULE[depot_tools::bot_update]/resources/bot_update.py",
+ "--spec-path",
+ "cache_dir = '[CUSTOM_/_B_CACHE]'\nsolutions = [{'deps_file': '.DEPS.git', 'managed': False, 'name': 'skia', 'url': 'https://skia.googlesource.com/skia.git'}]",
+ "--patch_root",
+ "skia",
+ "--revision_mapping_file",
+ "{\"got_revision\": \"skia\"}",
+ "--git-cache-dir",
+ "[CUSTOM_/_B_CACHE]",
+ "--cleanup-dir",
+ "[CLEANUP]/bot_update",
+ "--output_json",
+ "/path/to/tmp/json",
+ "--revision",
+ "skia@abc123"
+ ],
+ "cwd": "[CUSTOM_/_B_WORK]",
+ "env_prefixes": {
+ "PATH": [
+ "RECIPE_PACKAGE_REPO[depot_tools]"
+ ]
+ },
+ "infra_step": true,
+ "name": "bot_update",
+ "~followup_annotations": [
+ "@@@STEP_TEXT@Some step text@@@",
+ "@@@STEP_LOG_LINE@json.output@{@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"did_run\": true, @@@",
+ "@@@STEP_LOG_LINE@json.output@ \"fixed_revisions\": {@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"skia\": \"abc123\"@@@",
+ "@@@STEP_LOG_LINE@json.output@ }, @@@",
+ "@@@STEP_LOG_LINE@json.output@ \"manifest\": {@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"skia\": {@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"repository\": \"https://fake.org/skia.git\", @@@",
+ "@@@STEP_LOG_LINE@json.output@ \"revision\": \"9046e2e693bb92a76e972b694580e5d17ad10748\"@@@",
+ "@@@STEP_LOG_LINE@json.output@ }@@@",
+ "@@@STEP_LOG_LINE@json.output@ }, @@@",
+ "@@@STEP_LOG_LINE@json.output@ \"patch_failure\": false, @@@",
+ "@@@STEP_LOG_LINE@json.output@ \"patch_root\": \"skia\", @@@",
+ "@@@STEP_LOG_LINE@json.output@ \"properties\": {@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"got_revision\": \"9046e2e693bb92a76e972b694580e5d17ad10748\", @@@",
+ "@@@STEP_LOG_LINE@json.output@ \"got_revision_cp\": \"refs/heads/master@{#164710}\"@@@",
+ "@@@STEP_LOG_LINE@json.output@ }, @@@",
+ "@@@STEP_LOG_LINE@json.output@ \"root\": \"skia\", @@@",
+ "@@@STEP_LOG_LINE@json.output@ \"step_text\": \"Some step text\"@@@",
+ "@@@STEP_LOG_LINE@json.output@}@@@",
+ "@@@STEP_LOG_END@json.output@@@",
+ "@@@SET_BUILD_PROPERTY@got_revision@\"9046e2e693bb92a76e972b694580e5d17ad10748\"@@@",
+ "@@@SET_BUILD_PROPERTY@got_revision_cp@\"refs/heads/master@{#164710}\"@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "python",
+ "-u",
+ "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+ "--json-output",
+ "/path/to/tmp/json",
+ "ensure-directory",
+ "--mode",
+ "0777",
+ "[START_DIR]/tmp"
+ ],
+ "infra_step": true,
+ "name": "makedirs tmp_dir"
+ },
+ {
+ "cmd": [
+ "python",
+ "-u",
+ "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+ "--json-output",
+ "/path/to/tmp/json",
+ "glob",
+ "[START_DIR]",
+ "*.json"
+ ],
+ "infra_step": true,
+ "name": "find json results",
+ "stdout": "/path/to/tmp/",
+ "~followup_annotations": [
+ "@@@STEP_LOG_LINE@glob@[START_DIR]/bench_modified_master.json@@@",
+ "@@@STEP_LOG_END@glob@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "python",
+ "-u",
+ "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+ "--json-output",
+ "/path/to/tmp/json",
+ "glob",
+ "[START_DIR]",
+ "*.csv"
+ ],
+ "infra_step": true,
+ "name": "find csv results",
+ "stdout": "/path/to/tmp/",
+ "~followup_annotations": [
+ "@@@STEP_LOG_LINE@glob@[START_DIR]/bench_modified_master.csv@@@",
+ "@@@STEP_LOG_END@glob@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "gsutil",
+ "cp",
+ "-z",
+ "json",
+ "[START_DIR]/bench_modified_master.json",
+ "gs://skia-calmbench/calmbench-v1/2012/05/14/12/Calmbench-Debian9-Clang-x86_64-Release/bench_modified_master_9046e2e693bb92a76e972b694580e5d17ad10748_1337000001.json"
+ ],
+ "infra_step": true,
+ "name": "upload json"
+ },
+ {
+ "cmd": [
+ "gsutil",
+ "cp",
+ "-z",
+ "csv",
+ "[START_DIR]/bench_modified_master.csv",
+ "gs://skia-calmbench/calmbench-v1/2012/05/14/12/Calmbench-Debian9-Clang-x86_64-Release/bench_modified_master_9046e2e693bb92a76e972b694580e5d17ad10748_1337000001.csv"
+ ],
+ "infra_step": true,
+ "name": "upload csv"
+ },
+ {
+ "name": "$result",
+ "recipe_result": null,
+ "status_code": 0
+ }
+] \ No newline at end of file
diff --git a/infra/bots/recipes/upload_calmbench_results.expected/trybot.json b/infra/bots/recipes/upload_calmbench_results.expected/trybot.json
new file mode 100644
index 0000000000..12ee743d38
--- /dev/null
+++ b/infra/bots/recipes/upload_calmbench_results.expected/trybot.json
@@ -0,0 +1,171 @@
+[
+ {
+ "cmd": [
+ "python",
+ "-u",
+ "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+ "--json-output",
+ "/path/to/tmp/json",
+ "ensure-directory",
+ "--mode",
+ "0777",
+ "[CUSTOM_/_B_WORK]"
+ ],
+ "infra_step": true,
+ "name": "makedirs checkout_path"
+ },
+ {
+ "cmd": [
+ "python",
+ "-u",
+ "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+ "--json-output",
+ "/path/to/tmp/json",
+ "remove",
+ "[CUSTOM_/_B_WORK]/.gclient_entries"
+ ],
+ "infra_step": true,
+ "name": "remove [CUSTOM_/_B_WORK]/.gclient_entries"
+ },
+ {
+ "cmd": [
+ "python",
+ "-u",
+ "RECIPE_MODULE[depot_tools::bot_update]/resources/bot_update.py",
+ "--spec-path",
+ "cache_dir = '[CUSTOM_/_B_CACHE]'\nsolutions = [{'deps_file': '.DEPS.git', 'managed': False, 'name': 'skia', 'url': 'https://skia.googlesource.com/skia.git'}]",
+ "--patch_root",
+ "skia",
+ "--revision_mapping_file",
+ "{\"got_revision\": \"skia\"}",
+ "--git-cache-dir",
+ "[CUSTOM_/_B_CACHE]",
+ "--cleanup-dir",
+ "[CLEANUP]/bot_update",
+ "--gerrit_repo",
+ "https://skia.googlesource.com/skia.git",
+ "--gerrit_ref",
+ "refs/changes/89/456789/12",
+ "--output_json",
+ "/path/to/tmp/json",
+ "--revision",
+ "skia@abc123"
+ ],
+ "cwd": "[CUSTOM_/_B_WORK]",
+ "env_prefixes": {
+ "PATH": [
+ "RECIPE_PACKAGE_REPO[depot_tools]"
+ ]
+ },
+ "infra_step": true,
+ "name": "bot_update",
+ "~followup_annotations": [
+ "@@@STEP_TEXT@Some step text@@@",
+ "@@@STEP_LOG_LINE@json.output@{@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"did_run\": true, @@@",
+ "@@@STEP_LOG_LINE@json.output@ \"fixed_revisions\": {@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"skia\": \"abc123\"@@@",
+ "@@@STEP_LOG_LINE@json.output@ }, @@@",
+ "@@@STEP_LOG_LINE@json.output@ \"manifest\": {@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"skia\": {@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"repository\": \"https://fake.org/skia.git\", @@@",
+ "@@@STEP_LOG_LINE@json.output@ \"revision\": \"9046e2e693bb92a76e972b694580e5d17ad10748\"@@@",
+ "@@@STEP_LOG_LINE@json.output@ }@@@",
+ "@@@STEP_LOG_LINE@json.output@ }, @@@",
+ "@@@STEP_LOG_LINE@json.output@ \"patch_failure\": false, @@@",
+ "@@@STEP_LOG_LINE@json.output@ \"patch_root\": \"skia\", @@@",
+ "@@@STEP_LOG_LINE@json.output@ \"properties\": {@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"got_revision\": \"9046e2e693bb92a76e972b694580e5d17ad10748\", @@@",
+ "@@@STEP_LOG_LINE@json.output@ \"got_revision_cp\": \"refs/heads/master@{#164710}\"@@@",
+ "@@@STEP_LOG_LINE@json.output@ }, @@@",
+ "@@@STEP_LOG_LINE@json.output@ \"root\": \"skia\", @@@",
+ "@@@STEP_LOG_LINE@json.output@ \"step_text\": \"Some step text\"@@@",
+ "@@@STEP_LOG_LINE@json.output@}@@@",
+ "@@@STEP_LOG_END@json.output@@@",
+ "@@@SET_BUILD_PROPERTY@got_revision@\"9046e2e693bb92a76e972b694580e5d17ad10748\"@@@",
+ "@@@SET_BUILD_PROPERTY@got_revision_cp@\"refs/heads/master@{#164710}\"@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "python",
+ "-u",
+ "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+ "--json-output",
+ "/path/to/tmp/json",
+ "ensure-directory",
+ "--mode",
+ "0777",
+ "[START_DIR]/tmp"
+ ],
+ "infra_step": true,
+ "name": "makedirs tmp_dir"
+ },
+ {
+ "cmd": [
+ "python",
+ "-u",
+ "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+ "--json-output",
+ "/path/to/tmp/json",
+ "glob",
+ "[START_DIR]",
+ "*.json"
+ ],
+ "infra_step": true,
+ "name": "find json results",
+ "stdout": "/path/to/tmp/",
+ "~followup_annotations": [
+ "@@@STEP_LOG_LINE@glob@[START_DIR]/bench_modified_master.json@@@",
+ "@@@STEP_LOG_END@glob@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "python",
+ "-u",
+ "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+ "--json-output",
+ "/path/to/tmp/json",
+ "glob",
+ "[START_DIR]",
+ "*.csv"
+ ],
+ "infra_step": true,
+ "name": "find csv results",
+ "stdout": "/path/to/tmp/",
+ "~followup_annotations": [
+ "@@@STEP_LOG_LINE@glob@[START_DIR]/bench_modified_master.csv@@@",
+ "@@@STEP_LOG_END@glob@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "gsutil",
+ "cp",
+ "-z",
+ "json",
+ "[START_DIR]/bench_modified_master.json",
+ "gs://skia-calmbench/trybot/calmbench-v1/2012/05/14/12/Calmbench-Debian9-Clang-x86_64-Release/456789/12/bench_modified_master_9046e2e693bb92a76e972b694580e5d17ad10748_1337000001.json"
+ ],
+ "infra_step": true,
+ "name": "upload json"
+ },
+ {
+ "cmd": [
+ "gsutil",
+ "cp",
+ "-z",
+ "csv",
+ "[START_DIR]/bench_modified_master.csv",
+ "gs://skia-calmbench/trybot/calmbench-v1/2012/05/14/12/Calmbench-Debian9-Clang-x86_64-Release/456789/12/bench_modified_master_9046e2e693bb92a76e972b694580e5d17ad10748_1337000001.csv"
+ ],
+ "infra_step": true,
+ "name": "upload csv"
+ },
+ {
+ "name": "$result",
+ "recipe_result": null,
+ "status_code": 0
+ }
+] \ No newline at end of file
diff --git a/infra/bots/recipes/upload_calmbench_results.py b/infra/bots/recipes/upload_calmbench_results.py
new file mode 100644
index 0000000000..2815b162be
--- /dev/null
+++ b/infra/bots/recipes/upload_calmbench_results.py
@@ -0,0 +1,101 @@
+# Copyright 2017 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+
+# Recipe for uploading calmbench results.
+
+
+import calendar
+
+
+DEPS = [
+ 'core',
+ 'recipe_engine/context',
+ 'recipe_engine/file',
+ 'recipe_engine/path',
+ 'recipe_engine/properties',
+ 'recipe_engine/step',
+ 'recipe_engine/time',
+ 'vars',
+]
+
+
+def FindFile(api, suffix):
+ with api.context(cwd=api.path['start_dir']):
+ results = api.file.glob_paths(
+ 'find %s results' % suffix,
+ api.path['start_dir'],
+ '*.%s' % suffix,
+ test_data=['bench_modified_master.%s' % suffix])
+ if len(results) != 1: # pragma: nocover
+ raise Exception('Unable to find the %s file!' % suffix)
+ return results[0]
+
+
+def RunSteps(api):
+ api.core.setup()
+
+ builder_name = api.properties['buildername']
+
+ now = api.time.utcnow()
+
+ json_src = FindFile(api, "json")
+ csv_src = FindFile(api, "csv")
+
+ ts = int(calendar.timegm(now.utctimetuple()))
+ basename = "bench_modified_master_%s_%d" % (api.vars.got_revision, ts)
+
+ gs_path = '/'.join((
+ 'calmbench-v1', str(now.year).zfill(4),
+ str(now.month).zfill(2), str(now.day).zfill(2), str(now.hour).zfill(2),
+ builder_name))
+
+ issue = api.properties.get('patch_issue')
+ patchset = api.properties.get('patch_set')
+ if issue and patchset:
+ gs_path = '/'.join(('trybot', gs_path, str(issue), str(patchset)))
+
+ dst = '/'.join((
+ 'gs://%s' % api.properties['gs_bucket'], gs_path, basename))
+
+ json_dst = dst + ".json"
+ csv_dst = dst + ".csv"
+
+ api.step(
+ 'upload json',
+ cmd=['gsutil', 'cp', '-z', 'json', json_src, json_dst],
+ infra_step=True)
+ api.step(
+ 'upload csv',
+ cmd=['gsutil', 'cp', '-z', 'csv', csv_src, csv_dst],
+ infra_step=True)
+
+
+def GenTests(api):
+ builder = 'Calmbench-Debian9-Clang-x86_64-Release'
+ yield (
+ api.test('normal_bot') +
+ api.properties(buildername=builder,
+ repository='https://skia.googlesource.com/skia.git',
+ gs_bucket='skia-calmbench',
+ swarm_out_dir='[SWARM_OUT_DIR]',
+ revision='abc123',
+ path_config='kitchen')
+ )
+
+ yield (
+ api.test('trybot') +
+ api.properties(buildername=builder,
+ repository='https://skia.googlesource.com/skia.git',
+ gs_bucket='skia-calmbench',
+ swarm_out_dir='[SWARM_OUT_DIR]',
+ revision='abc123',
+ path_config='kitchen',
+ patch_storage='gerrit') +
+ api.properties.tryserver(
+ buildername=builder,
+ gerrit_project='skia',
+ gerrit_url='https://skia-review.googlesource.com/',
+ )
+ )