summaryrefslogtreecommitdiffstats
path: root/scripts/oe-selftest
diff options
context:
space:
mode:
authorCostin Constantin <costin.c.constantin@intel.com>2016-02-22 14:32:55 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-02-28 11:32:34 +0000
commit445b84456659ebb355149f6b0dca543b0bb2679c (patch)
tree1cbcbac28f07cae2c710bfcfd7f8ebc1a000e792 /scripts/oe-selftest
parent1b32ffcf9e889766d7a94d55a00f8359bbbf7c1a (diff)
downloadopenembedded-core-445b84456659ebb355149f6b0dca543b0bb2679c.tar.gz
openembedded-core-445b84456659ebb355149f6b0dca543b0bb2679c.tar.bz2
openembedded-core-445b84456659ebb355149f6b0dca543b0bb2679c.zip
oe-selftest: Add support for lib/oeqa/selftest subdirectories
This patch adds functionality to allow creating subdirectories inside lib/oeqa/selftest for all layers present in BBLAYERS. Like this, test cases can be grouped into organized directories. Addresses [YOCTO #7865] Signed-off-by: Costin Constantin <costin.c.constantin@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
Diffstat (limited to 'scripts/oe-selftest')
-rwxr-xr-xscripts/oe-selftest53
1 files changed, 28 insertions, 25 deletions
diff --git a/scripts/oe-selftest b/scripts/oe-selftest
index bd9cbe0826..de98a6cb0d 100755
--- a/scripts/oe-selftest
+++ b/scripts/oe-selftest
@@ -162,19 +162,33 @@ def remove_inc_files():
except:
pass
+
+def get_tests_modules(include_hidden=False):
+ modules_list = list()
+ for modules_path in oeqa.selftest.__path__:
+ for (p, d, f) in os.walk(modules_path):
+ files = sorted([f for f in os.listdir(p) if f.endswith('.py') and not (f.startswith('_') and not include_hidden) and not f.startswith('__') and f != 'base.py'])
+ for f in files:
+ submodules = p.split("selftest")[-1]
+ module = ""
+ if submodules:
+ module = 'oeqa.selftest' + submodules.replace("/",".") + "." + f.split('.py')[0]
+ else:
+ module = 'oeqa.selftest.' + f.split('.py')[0]
+ if module not in modules_list:
+ modules_list.append(module)
+ return modules_list
+
+
def get_tests(exclusive_modules=[], include_hidden=False):
- testslist = []
+ test_modules = list()
for x in exclusive_modules:
- testslist.append('oeqa.selftest.' + x)
- if not testslist:
- for testpath in oeqa.selftest.__path__:
- files = sorted([f for f in os.listdir(testpath) if f.endswith('.py') and not (f.startswith('_') and not include_hidden) and not f.startswith('__') and f != 'base.py'])
- for f in files:
- module = 'oeqa.selftest.' + f[:-3]
- if module not in testslist:
- testslist.append(module)
+ test_modules.append('oeqa.selftest.' + x)
+ if not test_modules:
+ inc_hidden = include_hidden
+ test_modules = get_tests_modules(inc_hidden)
- return testslist
+ return test_modules
class Tc:
@@ -221,23 +235,12 @@ def get_tests_from_module(tmod):
def get_all_tests():
- tmodules = set()
- testlist = []
- prefix = 'oeqa.selftest.'
-
# Get all the test modules (except the hidden ones)
- for tpath in oeqa.selftest.__path__:
- files = sorted([f for f in os.listdir(tpath) if f.endswith('.py') and not
- f.startswith(('_', '__')) and f != 'base.py'])
- for f in files:
- tmodules.add(prefix + f.rstrip('.py'))
-
+ testlist = []
+ tests_modules = get_tests_modules()
# Get all the tests from modules
- tmodules = sorted(list(tmodules))
-
- for tmod in tmodules:
+ for tmod in sorted(tests_modules):
testlist += get_tests_from_module(tmod)
-
return testlist
@@ -481,7 +484,7 @@ def main():
log.info('Listing all available test modules:')
testslist = get_tests(include_hidden=True)
for test in testslist:
- module = test.split('.')[-1]
+ module = test.split('oeqa.selftest.')[-1]
info = ''
if module.startswith('_'):
info = ' (hidden)'