1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
import os, datetime, subprocess
from buildbot.steps.shell import ShellCommand
from buildbot.process.buildstep import LogLineObserver
from autobuilder.config import PERFORMANCE_PUBLISH_DIR
class OeBuildPerfTestLogLineObserver(LogLineObserver):
"""
Scans lines in order to save the oe-buil-perf-test command
output.
"""
def _handleLine(self, line):
if not hasattr(self.step, 'oe_build_perf_test_output'):
self.step.oe_build_perf_test_output = ""
self.step.oe_build_perf_test_match = False
# Search for ### Shell environment set up for builds. ### to start
# capturing.
if not self.step.oe_build_perf_test_match and line.startswith('###'):
self.step.oe_build_perf_test_match = True
if self.step.oe_build_perf_test_match:
self.step.oe_build_perf_test_output += line + '\n'
def outLineReceived(self, line):
self._handleLine(line)
def errLineReceived(self, line):
self._handleLine(line)
class RunOeBuildPerfTest(ShellCommand):
flunkOnFailure = True
name = "Running oe-build-perf-test"
def __init__(self, factory, argdict=None, **kwargs):
self.tests = None
self.factory = factory
for k, v in argdict.iteritems():
setattr(self, k, v)
self.description = "Running oe-build-perf-test"
self.timeout = 100000
kwargs['timeout']=self.timeout
ShellCommand.__init__(self, **kwargs)
self.stdio_observer = OeBuildPerfTestLogLineObserver()
self.addLogObserver('stdio', self.stdio_observer)
def start(self):
branch = self.getProperty("branch")
revision = self.getProperty("got_revision")[0:10] # small rev
machine = self.getProperty("MACHINE")
# for oe-build-perf-test
timestamp = datetime.datetime.now().strftime("%Y%m%d%H%M%S")
results_basename = 'results-%s-%s-%s' % (branch, revision, timestamp)
results_dir = os.path.join(PERFORMANCE_PUBLISH_DIR, results_basename)
lock_file = 'oe-build-perf.lock'
globalres_log = os.path.join(PERFORMANCE_PUBLISH_DIR, 'globalres.log')
git_dir = os.path.join(PERFORMANCE_PUBLISH_DIR, 'git')
self.setProperty("oe_perf_globalres_log", globalres_log, "RunOeBuildPerfTest")
self.setProperty("oe_perf_results_dir", results_dir, "RunOeBuildPerfTest")
self.command = "mkdir -p %s; " % (results_dir)
self.command += ". ./oe-init-build-env; "
self.command += """ oe-build-perf-test --out-dir "%s" \
--globalres-file "%s" --lock-file "%s" --commit-results "%s" --commit-results-branch "{tester_host}/{git_branch}/%s" \
--commit-results-tag "{tester_host}/{git_branch}/%s/{git_commit_count}-g{git_commit}/{tag_num}"
""" % (results_dir, globalres_log, lock_file, git_dir, machine, machine)
ShellCommand.start(self)
def commandComplete(self, cmd):
self.setProperty("oe_build_perf_test_output",
self.oe_build_perf_test_output, "RunOeBuildPerfTest")
|