summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa
diff options
context:
space:
mode:
Diffstat (limited to 'meta/lib/oeqa')
-rw-r--r--meta/lib/oeqa/buildperf/base.py15
-rw-r--r--meta/lib/oeqa/buildperf/test_basic.py5
2 files changed, 7 insertions, 13 deletions
diff --git a/meta/lib/oeqa/buildperf/base.py b/meta/lib/oeqa/buildperf/base.py
index fe18181f2b..c1dc86e5db 100644
--- a/meta/lib/oeqa/buildperf/base.py
+++ b/meta/lib/oeqa/buildperf/base.py
@@ -23,6 +23,7 @@ import unittest
23from datetime import datetime, timedelta 23from datetime import datetime, timedelta
24from functools import partial 24from functools import partial
25 25
26import oe.path
26from oeqa.utils.commands import CommandError, runCmd, get_bb_vars 27from oeqa.utils.commands import CommandError, runCmd, get_bb_vars
27from oeqa.utils.git import GitError, GitRepo 28from oeqa.utils.git import GitError, GitRepo
28 29
@@ -297,29 +298,21 @@ class BuildPerfTestCase(unittest.TestCase):
297 shutil.move(self.bb_vars['BUILDSTATS_BASE'], 298 shutil.move(self.bb_vars['BUILDSTATS_BASE'],
298 os.path.join(self.out_dir, 'buildstats-' + self.name)) 299 os.path.join(self.out_dir, 'buildstats-' + self.name))
299 300
300 @staticmethod
301 def force_rm(path):
302 """Equivalent of 'rm -rf'"""
303 if os.path.isfile(path) or os.path.islink(path):
304 os.unlink(path)
305 elif os.path.isdir(path):
306 shutil.rmtree(path)
307
308 def rm_tmp(self): 301 def rm_tmp(self):
309 """Cleanup temporary/intermediate files and directories""" 302 """Cleanup temporary/intermediate files and directories"""
310 log.debug("Removing temporary and cache files") 303 log.debug("Removing temporary and cache files")
311 for name in ['bitbake.lock', 'conf/sanity_info', 304 for name in ['bitbake.lock', 'conf/sanity_info',
312 self.bb_vars['TMPDIR']]: 305 self.bb_vars['TMPDIR']]:
313 self.force_rm(name) 306 oe.path.remove(name, recurse=True)
314 307
315 def rm_sstate(self): 308 def rm_sstate(self):
316 """Remove sstate directory""" 309 """Remove sstate directory"""
317 log.debug("Removing sstate-cache") 310 log.debug("Removing sstate-cache")
318 self.force_rm(self.bb_vars['SSTATE_DIR']) 311 oe.path.remove(self.bb_vars['SSTATE_DIR'], recurse=True)
319 312
320 def rm_cache(self): 313 def rm_cache(self):
321 """Drop bitbake caches""" 314 """Drop bitbake caches"""
322 self.force_rm(self.bb_vars['PERSISTENT_DIR']) 315 oe.path.remove(self.bb_vars['PERSISTENT_DIR'], recurse=True)
323 316
324 @staticmethod 317 @staticmethod
325 def sync(): 318 def sync():
diff --git a/meta/lib/oeqa/buildperf/test_basic.py b/meta/lib/oeqa/buildperf/test_basic.py
index b8bec6d6f2..9310f3d86a 100644
--- a/meta/lib/oeqa/buildperf/test_basic.py
+++ b/meta/lib/oeqa/buildperf/test_basic.py
@@ -13,6 +13,7 @@
13import os 13import os
14import shutil 14import shutil
15 15
16import oe.path
16from oeqa.buildperf import BuildPerfTestCase 17from oeqa.buildperf import BuildPerfTestCase
17from oeqa.utils.commands import get_bb_vars 18from oeqa.utils.commands import get_bb_vars
18 19
@@ -85,11 +86,11 @@ class Test3(BuildPerfTestCase):
85 """Parsing time metrics (bitbake -p)""" 86 """Parsing time metrics (bitbake -p)"""
86 # Drop all caches and parse 87 # Drop all caches and parse
87 self.rm_cache() 88 self.rm_cache()
88 self.force_rm(os.path.join(self.bb_vars['TMPDIR'], 'cache')) 89 oe.path.remove(os.path.join(self.bb_vars['TMPDIR'], 'cache'), True)
89 self.measure_cmd_resources(['bitbake', '-p'], 'parse_1', 90 self.measure_cmd_resources(['bitbake', '-p'], 'parse_1',
90 'bitbake -p (no caches)') 91 'bitbake -p (no caches)')
91 # Drop tmp/cache 92 # Drop tmp/cache
92 self.force_rm(os.path.join(self.bb_vars['TMPDIR'], 'cache')) 93 oe.path.remove(os.path.join(self.bb_vars['TMPDIR'], 'cache'), True)
93 self.measure_cmd_resources(['bitbake', '-p'], 'parse_2', 94 self.measure_cmd_resources(['bitbake', '-p'], 'parse_2',
94 'bitbake -p (no tmp/cache)') 95 'bitbake -p (no tmp/cache)')
95 # Parse with fully cached data 96 # Parse with fully cached data