mirror of
git://git.yoctoproject.org/poky.git
synced 2025-07-19 21:09:03 +02:00
oeqa/buildperf: don't archive stdout/stderr of commands
Stop capturing output of the shell commands into <test>/commands.log. Redirecting output into a file prevented the unittest framework from capturing it, causing useless errors (with empty output) like: oeqa.utils.CommandError: Command '['bitbake', 'core-image-sato']' returned non-zero exit status 1 with output: In general, the console output of commands is only interesting when something fails. Also, dropping the commands.log file is a huge saving in disk space, and thus, repository size when results are archived in Git. (From OE-Core rev: e004664287ec03e7367a7bf553d9a3038444e82e) Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
parent
8279d6f257
commit
fcd28fd50f
|
@ -163,8 +163,6 @@ class BuildPerfTestResult(unittest.TextTestResult):
|
||||||
('status', status),
|
('status', status),
|
||||||
('start_time', test.start_time),
|
('start_time', test.start_time),
|
||||||
('elapsed_time', test.elapsed_time),
|
('elapsed_time', test.elapsed_time),
|
||||||
('cmd_log_file', os.path.relpath(test.cmd_log_file,
|
|
||||||
self.out_dir)),
|
|
||||||
('measurements', test.measurements)])
|
('measurements', test.measurements)])
|
||||||
if status in ('ERROR', 'FAILURE', 'EXPECTED_FAILURE'):
|
if status in ('ERROR', 'FAILURE', 'EXPECTED_FAILURE'):
|
||||||
test_result['message'] = str(test.err[1])
|
test_result['message'] = str(test.err[1])
|
||||||
|
@ -268,18 +266,13 @@ class BuildPerfTestCase(unittest.TestCase):
|
||||||
def out_dir(self):
|
def out_dir(self):
|
||||||
return os.path.join(self.base_dir, self.name)
|
return os.path.join(self.base_dir, self.name)
|
||||||
|
|
||||||
@property
|
|
||||||
def cmd_log_file(self):
|
|
||||||
return os.path.join(self.out_dir, 'commands.log')
|
|
||||||
|
|
||||||
def shortDescription(self):
|
def shortDescription(self):
|
||||||
return super(BuildPerfTestCase, self).shortDescription() or ""
|
return super(BuildPerfTestCase, self).shortDescription() or ""
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
"""Set-up fixture for each test"""
|
"""Set-up fixture for each test"""
|
||||||
if self.build_target:
|
if self.build_target:
|
||||||
self.log_cmd_output(['bitbake', self.build_target,
|
self.run_cmd(['bitbake', self.build_target, '-c', 'fetchall'])
|
||||||
'-c', 'fetchall'])
|
|
||||||
|
|
||||||
def run(self, *args, **kwargs):
|
def run(self, *args, **kwargs):
|
||||||
"""Run test"""
|
"""Run test"""
|
||||||
|
@ -287,13 +280,12 @@ class BuildPerfTestCase(unittest.TestCase):
|
||||||
super(BuildPerfTestCase, self).run(*args, **kwargs)
|
super(BuildPerfTestCase, self).run(*args, **kwargs)
|
||||||
self.elapsed_time = datetime.now() - self.start_time
|
self.elapsed_time = datetime.now() - self.start_time
|
||||||
|
|
||||||
def log_cmd_output(self, cmd):
|
def run_cmd(self, cmd):
|
||||||
"""Run a command and log it's output"""
|
"""Convenience method for running a command"""
|
||||||
cmd_str = cmd if isinstance(cmd, str) else ' '.join(cmd)
|
cmd_str = cmd if isinstance(cmd, str) else ' '.join(cmd)
|
||||||
log.info("Logging command: %s", cmd_str)
|
log.info("Logging command: %s", cmd_str)
|
||||||
try:
|
try:
|
||||||
with open(self.cmd_log_file, 'a') as fobj:
|
runCmd2(cmd)
|
||||||
runCmd2(cmd, stdout=fobj)
|
|
||||||
except CommandError as err:
|
except CommandError as err:
|
||||||
log.error("Command failed: %s", err.retcode)
|
log.error("Command failed: %s", err.retcode)
|
||||||
raise
|
raise
|
||||||
|
@ -338,17 +330,14 @@ class BuildPerfTestCase(unittest.TestCase):
|
||||||
log.info("Timing command: %s", cmd_str)
|
log.info("Timing command: %s", cmd_str)
|
||||||
data_q = SimpleQueue()
|
data_q = SimpleQueue()
|
||||||
try:
|
try:
|
||||||
with open(self.cmd_log_file, 'a') as fobj:
|
proc = Process(target=_worker, args=(data_q, cmd,))
|
||||||
proc = Process(target=_worker, args=(data_q, cmd,),
|
proc.start()
|
||||||
kwargs={'stdout': fobj})
|
data = data_q.get()
|
||||||
proc.start()
|
proc.join()
|
||||||
data = data_q.get()
|
|
||||||
proc.join()
|
|
||||||
if isinstance(data, Exception):
|
if isinstance(data, Exception):
|
||||||
raise data
|
raise data
|
||||||
except CommandError:
|
except CommandError:
|
||||||
log.error("Command '%s' failed, see %s for more details", cmd_str,
|
log.error("Command '%s' failed", cmd_str)
|
||||||
self.cmd_log_file)
|
|
||||||
raise
|
raise
|
||||||
etime = data['elapsed_time']
|
etime = data['elapsed_time']
|
||||||
|
|
||||||
|
|
|
@ -38,8 +38,8 @@ class Test1P2(BuildPerfTestCase):
|
||||||
def test12(self):
|
def test12(self):
|
||||||
"""Build virtual/kernel"""
|
"""Build virtual/kernel"""
|
||||||
# Build and cleans state in order to get all dependencies pre-built
|
# Build and cleans state in order to get all dependencies pre-built
|
||||||
self.log_cmd_output(['bitbake', self.build_target])
|
self.run_cmd(['bitbake', self.build_target])
|
||||||
self.log_cmd_output(['bitbake', self.build_target, '-c', 'cleansstate'])
|
self.run_cmd(['bitbake', self.build_target, '-c', 'cleansstate'])
|
||||||
|
|
||||||
self.sync()
|
self.sync()
|
||||||
self.measure_cmd_resources(['bitbake', self.build_target], 'build',
|
self.measure_cmd_resources(['bitbake', self.build_target], 'build',
|
||||||
|
@ -74,7 +74,7 @@ class Test2(BuildPerfTestCase):
|
||||||
def test2(self):
|
def test2(self):
|
||||||
"""Run core-image-sato do_rootfs with sstate"""
|
"""Run core-image-sato do_rootfs with sstate"""
|
||||||
# Build once in order to populate sstate cache
|
# Build once in order to populate sstate cache
|
||||||
self.log_cmd_output(['bitbake', self.build_target])
|
self.run_cmd(['bitbake', self.build_target])
|
||||||
|
|
||||||
self.rm_tmp()
|
self.rm_tmp()
|
||||||
self.rm_cache()
|
self.rm_cache()
|
||||||
|
@ -106,8 +106,8 @@ class Test4(BuildPerfTestCase):
|
||||||
|
|
||||||
def test4(self):
|
def test4(self):
|
||||||
"""eSDK metrics"""
|
"""eSDK metrics"""
|
||||||
self.log_cmd_output("bitbake {} -c do_populate_sdk_ext".format(
|
self.run_cmd(['bitbake', '-c', 'do_populate_sdk_ext',
|
||||||
self.build_target))
|
self.build_target])
|
||||||
self.bb_vars = get_bb_vars(None, self.build_target)
|
self.bb_vars = get_bb_vars(None, self.build_target)
|
||||||
tmp_dir = self.bb_vars['TMPDIR']
|
tmp_dir = self.bb_vars['TMPDIR']
|
||||||
installer = os.path.join(
|
installer = os.path.join(
|
||||||
|
|
Loading…
Reference in New Issue
Block a user