summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/lib/oeqa/buildperf/__init__.py3
-rw-r--r--meta/lib/oeqa/buildperf/base.py15
2 files changed, 12 insertions, 6 deletions
diff --git a/meta/lib/oeqa/buildperf/__init__.py b/meta/lib/oeqa/buildperf/__init__.py
index 85abf3a25e..605f429ecc 100644
--- a/meta/lib/oeqa/buildperf/__init__.py
+++ b/meta/lib/oeqa/buildperf/__init__.py
@@ -14,5 +14,6 @@ from .base import (BuildPerfTestCase,
14 BuildPerfTestLoader, 14 BuildPerfTestLoader,
15 BuildPerfTestResult, 15 BuildPerfTestResult,
16 BuildPerfTestRunner, 16 BuildPerfTestRunner,
17 KernelDropCaches) 17 KernelDropCaches,
18 runCmd2)
18from .test_basic import * 19from .test_basic import *
diff --git a/meta/lib/oeqa/buildperf/base.py b/meta/lib/oeqa/buildperf/base.py
index d592bd26b9..52c2ab61bf 100644
--- a/meta/lib/oeqa/buildperf/base.py
+++ b/meta/lib/oeqa/buildperf/base.py
@@ -21,6 +21,7 @@ import time
21import traceback 21import traceback
22import unittest 22import unittest
23from datetime import datetime, timedelta 23from datetime import datetime, timedelta
24from functools import partial
24 25
25from oeqa.utils.commands import runCmd, get_bb_vars 26from oeqa.utils.commands import runCmd, get_bb_vars
26from oeqa.utils.git import GitError, GitRepo 27from oeqa.utils.git import GitError, GitRepo
@@ -28,6 +29,10 @@ from oeqa.utils.git import GitError, GitRepo
28# Get logger for this module 29# Get logger for this module
29log = logging.getLogger('build-perf') 30log = logging.getLogger('build-perf')
30 31
32# Our own version of runCmd which does not raise AssertErrors which would cause
33# errors to interpreted as failures
34runCmd2 = partial(runCmd, assert_error=False)
35
31 36
32class KernelDropCaches(object): 37class KernelDropCaches(object):
33 """Container of the functions for dropping kernel caches""" 38 """Container of the functions for dropping kernel caches"""
@@ -39,7 +44,7 @@ class KernelDropCaches(object):
39 from getpass import getpass 44 from getpass import getpass
40 from locale import getdefaultlocale 45 from locale import getdefaultlocale
41 cmd = ['sudo', '-k', '-n', 'tee', '/proc/sys/vm/drop_caches'] 46 cmd = ['sudo', '-k', '-n', 'tee', '/proc/sys/vm/drop_caches']
42 ret = runCmd(cmd, ignore_status=True, data=b'0') 47 ret = runCmd2(cmd, ignore_status=True, data=b'0')
43 if ret.output.startswith('sudo:'): 48 if ret.output.startswith('sudo:'):
44 pass_str = getpass( 49 pass_str = getpass(
45 "\nThe script requires sudo access to drop caches between " 50 "\nThe script requires sudo access to drop caches between "
@@ -59,7 +64,7 @@ class KernelDropCaches(object):
59 input_data = b'' 64 input_data = b''
60 cmd += ['tee', '/proc/sys/vm/drop_caches'] 65 cmd += ['tee', '/proc/sys/vm/drop_caches']
61 input_data += b'3' 66 input_data += b'3'
62 runCmd(cmd, data=input_data) 67 runCmd2(cmd, data=input_data)
63 68
64 69
65def time_cmd(cmd, **kwargs): 70def time_cmd(cmd, **kwargs):
@@ -71,7 +76,7 @@ def time_cmd(cmd, **kwargs):
71 timecmd += cmd 76 timecmd += cmd
72 # TODO: 'ignore_status' could/should be removed when globalres.log is 77 # TODO: 'ignore_status' could/should be removed when globalres.log is
73 # deprecated. The function would just raise an exception, instead 78 # deprecated. The function would just raise an exception, instead
74 ret = runCmd(timecmd, ignore_status=True, **kwargs) 79 ret = runCmd2(timecmd, ignore_status=True, **kwargs)
75 timedata = tmpf.file.read() 80 timedata = tmpf.file.read()
76 return ret, timedata 81 return ret, timedata
77 82
@@ -213,7 +218,7 @@ class BuildPerfTestCase(unittest.TestCase):
213 """Run a command and log it's output""" 218 """Run a command and log it's output"""
214 cmd_log = os.path.join(self.out_dir, 'commands.log') 219 cmd_log = os.path.join(self.out_dir, 'commands.log')
215 with open(cmd_log, 'a') as fobj: 220 with open(cmd_log, 'a') as fobj:
216 runCmd(cmd, stdout=fobj) 221 runCmd2(cmd, stdout=fobj)
217 222
218 def measure_cmd_resources(self, cmd, name, legend): 223 def measure_cmd_resources(self, cmd, name, legend):
219 """Measure system resource usage of a command""" 224 """Measure system resource usage of a command"""
@@ -265,7 +270,7 @@ class BuildPerfTestCase(unittest.TestCase):
265 """Estimate disk usage of a file or directory""" 270 """Estimate disk usage of a file or directory"""
266 # TODO: 'ignore_status' could/should be removed when globalres.log is 271 # TODO: 'ignore_status' could/should be removed when globalres.log is
267 # deprecated. The function would just raise an exception, instead 272 # deprecated. The function would just raise an exception, instead
268 ret = runCmd(['du', '-s', path], ignore_status=True) 273 ret = runCmd2(['du', '-s', path], ignore_status=True)
269 if ret.status: 274 if ret.status:
270 log.error("du failed, disk usage will be reported as 0") 275 log.error("du failed, disk usage will be reported as 0")
271 size = 0 276 size = 0