summaryrefslogtreecommitdiffstats
path: root/meta/lib
diff options
context:
space:
mode:
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>2016-08-26 10:33:09 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-09-03 09:58:41 +0100
commit85b7b10b4a981cc17fca688e6ac592a5683a2546 (patch)
treefb7e656e0ee539db7a99b1fba953d934116bd6a3 /meta/lib
parent6722b0412c60d21fc988a671f4d9583bf6f06801 (diff)
downloadpoky-85b7b10b4a981cc17fca688e6ac592a5683a2546.tar.gz
oeqa.buildperf: make tests independent
Add test set-up functionality so that the individual tests do not depend on each other. This should make sure that a failure in one test does not affect the results of another test. The patch also makes it reasonable to run only a subset of the tests by using the --run-tests option. The increase in total execution time of the full suite - caused by the additional set-up steps - is insignificant because normally no additional tasks need to be run. The previous test has already done all set-up work. (From OE-Core rev: 69b3c63e32d09ea4a41b21daacdff6bf1fc447c1) Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-rw-r--r--meta/lib/oeqa/buildperf/base.py7
-rw-r--r--meta/lib/oeqa/buildperf/test_basic.py10
2 files changed, 14 insertions, 3 deletions
diff --git a/meta/lib/oeqa/buildperf/base.py b/meta/lib/oeqa/buildperf/base.py
index e4a79486f2..83439f1bdb 100644
--- a/meta/lib/oeqa/buildperf/base.py
+++ b/meta/lib/oeqa/buildperf/base.py
@@ -257,6 +257,7 @@ class BuildPerfTestCase(unittest.TestCase):
257 """Base class for build performance tests""" 257 """Base class for build performance tests"""
258 SYSRES = 'sysres' 258 SYSRES = 'sysres'
259 DISKUSAGE = 'diskusage' 259 DISKUSAGE = 'diskusage'
260 build_target = None
260 261
261 def __init__(self, *args, **kwargs): 262 def __init__(self, *args, **kwargs):
262 super(BuildPerfTestCase, self).__init__(*args, **kwargs) 263 super(BuildPerfTestCase, self).__init__(*args, **kwargs)
@@ -271,6 +272,12 @@ class BuildPerfTestCase(unittest.TestCase):
271 self.times = [] 272 self.times = []
272 self.sizes = [] 273 self.sizes = []
273 274
275 def setUp(self):
276 """Set-up fixture for each test"""
277 if self.build_target:
278 self.log_cmd_output(['bitbake', self.build_target,
279 '-c', 'fetchall'])
280
274 def run(self, *args, **kwargs): 281 def run(self, *args, **kwargs):
275 """Run test""" 282 """Run test"""
276 self.start_time = datetime.now() 283 self.start_time = datetime.now()
diff --git a/meta/lib/oeqa/buildperf/test_basic.py b/meta/lib/oeqa/buildperf/test_basic.py
index 9310f3d86a..25dbfb0bf7 100644
--- a/meta/lib/oeqa/buildperf/test_basic.py
+++ b/meta/lib/oeqa/buildperf/test_basic.py
@@ -23,7 +23,6 @@ class Test1P1(BuildPerfTestCase):
23 23
24 def test1(self): 24 def test1(self):
25 """Measure wall clock of bitbake core-image-sato and size of tmp dir""" 25 """Measure wall clock of bitbake core-image-sato and size of tmp dir"""
26 self.log_cmd_output("bitbake {} -c fetchall".format(self.build_target))
27 self.rm_tmp() 26 self.rm_tmp()
28 self.rm_sstate() 27 self.rm_sstate()
29 self.rm_cache() 28 self.rm_cache()
@@ -39,8 +38,10 @@ class Test1P2(BuildPerfTestCase):
39 38
40 def test12(self): 39 def test12(self):
41 """Measure bitbake virtual/kernel""" 40 """Measure bitbake virtual/kernel"""
42 self.log_cmd_output("bitbake {} -c cleansstate".format( 41 # Build and cleans state in order to get all dependencies pre-built
43 self.build_target)) 42 self.log_cmd_output(['bitbake', self.build_target])
43 self.log_cmd_output(['bitbake', self.build_target, '-c', 'cleansstate'])
44
44 self.sync() 45 self.sync()
45 self.measure_cmd_resources(['bitbake', self.build_target], 'build', 46 self.measure_cmd_resources(['bitbake', self.build_target], 'build',
46 'bitbake ' + self.build_target) 47 'bitbake ' + self.build_target)
@@ -73,6 +74,9 @@ class Test2(BuildPerfTestCase):
73 74
74 def test2(self): 75 def test2(self):
75 """Measure bitbake core-image-sato -c rootfs with sstate""" 76 """Measure bitbake core-image-sato -c rootfs with sstate"""
77 # Build once in order to populate sstate cache
78 self.log_cmd_output(['bitbake', self.build_target])
79
76 self.rm_tmp() 80 self.rm_tmp()
77 self.rm_cache() 81 self.rm_cache()
78 self.sync() 82 self.sync()