Fix dm/nanobench uploads for Gerrit-based trybots

BUG=skia:5719

GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2710

Change-Id: I43f03b19a9d7223b67de7dc7c4efea8cb75dba05
Reviewed-on: https://skia-review.googlesource.com/2710
Reviewed-by: Eric Boren <borenet@google.com>
Commit-Queue: Eric Boren <borenet@google.com>
This commit is contained in:
Eric Boren 2016-09-27 11:30:48 -04:00 committed by Skia Commit-Bot
parent 600c6a716d
commit cfdd64f41f
4 changed files with 208 additions and 4 deletions

View File

@ -0,0 +1,125 @@
[
{
"cmd": [
"python",
"-u",
"\nimport shutil\nimport sys\nshutil.copy(sys.argv[1], sys.argv[2])\n",
"[CWD]/dm/dm.json",
"/path/to/tmp/json"
],
"name": "validate dm.json",
"~followup_annotations": [
"@@@STEP_LOG_LINE@json.output (invalid)@null@@@",
"@@@STEP_LOG_END@json.output (invalid)@@@"
]
},
{
"cmd": [
"python",
"-u",
"\nimport sys, os\npath = sys.argv[1]\nmode = int(sys.argv[2])\nif not os.path.isdir(path):\n if os.path.exists(path):\n print \"%s exists but is not a dir\" % path\n sys.exit(1)\n os.makedirs(path, mode)\n",
"[CWD]/tmp_upload",
"511"
],
"name": "makedirs tmp dir",
"~followup_annotations": [
"@@@STEP_LOG_LINE@python.inline@@@@",
"@@@STEP_LOG_LINE@python.inline@import sys, os@@@",
"@@@STEP_LOG_LINE@python.inline@path = sys.argv[1]@@@",
"@@@STEP_LOG_LINE@python.inline@mode = int(sys.argv[2])@@@",
"@@@STEP_LOG_LINE@python.inline@if not os.path.isdir(path):@@@",
"@@@STEP_LOG_LINE@python.inline@ if os.path.exists(path):@@@",
"@@@STEP_LOG_LINE@python.inline@ print \"%s exists but is not a dir\" % path@@@",
"@@@STEP_LOG_LINE@python.inline@ sys.exit(1)@@@",
"@@@STEP_LOG_LINE@python.inline@ os.makedirs(path, mode)@@@",
"@@@STEP_LOG_END@python.inline@@@"
]
},
{
"cmd": [
"python",
"-u",
"\nimport shutil\nimport sys\nshutil.copy(sys.argv[1], sys.argv[2])\n",
"[CWD]/dm/dm.json",
"[CWD]/tmp_upload"
],
"name": "copy dm.json"
},
{
"cmd": [
"python",
"-u",
"\nimport shutil\nimport sys\nshutil.copy(sys.argv[1], sys.argv[2])\n",
"[CWD]/dm/verbose.log",
"[CWD]/tmp_upload"
],
"name": "copy verbose.log"
},
{
"cmd": [
"python",
"-u",
"\nimport os\nimport sys\nos.remove(sys.argv[1])\n",
"[CWD]/dm/dm.json"
],
"name": "rm old dm.json",
"~followup_annotations": [
"@@@STEP_LOG_LINE@python.inline@@@@",
"@@@STEP_LOG_LINE@python.inline@import os@@@",
"@@@STEP_LOG_LINE@python.inline@import sys@@@",
"@@@STEP_LOG_LINE@python.inline@os.remove(sys.argv[1])@@@",
"@@@STEP_LOG_END@python.inline@@@"
]
},
{
"cmd": [
"python",
"-u",
"\nimport os\nimport sys\nos.remove(sys.argv[1])\n",
"[CWD]/dm/verbose.log"
],
"name": "rm old verbose.log",
"~followup_annotations": [
"@@@STEP_LOG_LINE@python.inline@@@@",
"@@@STEP_LOG_LINE@python.inline@import os@@@",
"@@@STEP_LOG_LINE@python.inline@import sys@@@",
"@@@STEP_LOG_LINE@python.inline@os.remove(sys.argv[1])@@@",
"@@@STEP_LOG_END@python.inline@@@"
]
},
{
"cmd": [
"python",
"-u",
"\nimport glob\nimport sys\nwith open(sys.argv[1], 'w') as f:\n f.write('\\n'.join(glob.glob(sys.argv[2])))\n",
"/path/to/tmp/",
"[CWD]/dm/*"
],
"name": "find images"
},
{
"cmd": [
"gsutil",
"cp",
"[CWD]/dm/*",
"gs://skia-infra-gm/dm-images-v1"
],
"name": "upload images"
},
{
"cmd": [
"gsutil",
"cp",
"-z",
"json,log",
"[CWD]/tmp_upload/*",
"gs://skia-infra-gm/trybot/dm-json-v1/2012/05/14/12/abc123/Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Debug-Trybot/1337018001/2100/2"
],
"name": "upload JSON and logs"
},
{
"name": "$result",
"recipe_result": null,
"status_code": 0
}
]

View File

@ -28,8 +28,17 @@ VERBOSE_LOG = 'verbose.log'
def RunSteps(api):
builder_name = api.properties['buildername']
revision = api.properties['revision']
issue = str(api.properties.get('issue', ''))
patchset = str(api.properties.get('patchset', ''))
patch_storage = api.properties.get('patch_storage', 'rietveld')
issue = None
patchset = None
if builder_name.endswith('-Trybot'):
if patch_storage == 'gerrit':
issue = str(api.properties['event.change.number'])
patchset = str(api.properties['event.patchSet.ref'].split('/')[-1])
else:
issue = str(api.properties['issue'])
patchset = str(api.properties['patchset'])
results_dir = api.path['cwd'].join('dm')
@ -104,3 +113,18 @@ def GenTests(api):
issue='12345',
patchset='1002')
)
gerrit_kwargs = {
'patch_storage': 'gerrit',
'repository': 'skia',
'event.patchSet.ref': 'refs/changes/00/2100/2',
'event.change.number': '2100',
}
yield (
api.test('recipe_with_gerrit_patch') +
api.properties(
buildername=builder,
revision='abc123',
path_config='kitchen',
**gerrit_kwargs)
)

View File

@ -0,0 +1,31 @@
[
{
"cmd": [
"python",
"-u",
"\nimport glob\nimport sys\nwith open(sys.argv[1], 'w') as f:\n f.write('\\n'.join(glob.glob(sys.argv[2])))\n",
"/path/to/tmp/",
"nanobench*.json"
],
"cwd": "[CWD]/perfdata/Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Debug-Trybot/data",
"name": "find results"
},
{
"cmd": [
"gsutil",
"cp",
"-a",
"public-read",
"-z",
"json",
"[CWD]/perfdata/Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Debug-Trybot/data/nanobench_abc123.json",
"gs://skia-perf/trybot/nano-json-v1/2012/05/14/12/Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Debug-Trybot/2100/2/nanobench_abc123.json"
],
"name": "upload"
},
{
"name": "$result",
"recipe_result": null,
"status_code": 0
}
]

View File

@ -18,8 +18,17 @@ DEPS = [
def RunSteps(api):
# Upload the nanobench resuls.
builder_name = api.properties['buildername']
issue = str(api.properties.get('issue', ''))
patchset = str(api.properties.get('patchset', ''))
patch_storage = api.properties.get('patch_storage', 'rietveld')
issue = None
patchset = None
if builder_name.endswith('-Trybot'):
if patch_storage == 'gerrit':
issue = str(api.properties['event.change.number'])
patchset = str(api.properties['event.patchSet.ref'].split('/')[-1])
else:
issue = str(api.properties['issue'])
patchset = str(api.properties['patchset'])
now = api.time.utcnow()
@ -71,3 +80,18 @@ def GenTests(api):
issue='12345',
patchset='1002')
)
gerrit_kwargs = {
'patch_storage': 'gerrit',
'repository': 'skia',
'event.patchSet.ref': 'refs/changes/00/2100/2',
'event.change.number': '2100',
}
yield (
api.test('recipe_with_gerrit_patch') +
api.properties(
buildername=builder,
revision='abc123',
path_config='kitchen',
**gerrit_kwargs)
)