diff options
-rw-r--r-- | meta/classes-recipe/testexport.bbclass | 43 | ||||
-rwxr-xr-x | scripts/oe-test | 12 |
2 files changed, 30 insertions, 25 deletions
diff --git a/meta/classes-recipe/testexport.bbclass b/meta/classes-recipe/testexport.bbclass index cc4088c71a..843d777e3b 100644 --- a/meta/classes-recipe/testexport.bbclass +++ b/meta/classes-recipe/testexport.bbclass | |||
@@ -85,6 +85,7 @@ def copy_needed_files(d, tc): | |||
85 | 85 | ||
86 | export_path = d.getVar('TEST_EXPORT_DIR') | 86 | export_path = d.getVar('TEST_EXPORT_DIR') |
87 | corebase_path = d.getVar('COREBASE') | 87 | corebase_path = d.getVar('COREBASE') |
88 | bblayers = d.getVar('BBLAYERS').split() | ||
88 | 89 | ||
89 | # Clean everything before starting | 90 | # Clean everything before starting |
90 | oe.path.remove(export_path) | 91 | oe.path.remove(export_path) |
@@ -92,17 +93,11 @@ def copy_needed_files(d, tc): | |||
92 | 93 | ||
93 | # The source of files to copy are relative to 'COREBASE' directory | 94 | # The source of files to copy are relative to 'COREBASE' directory |
94 | # The destination is relative to 'TEST_EXPORT_DIR' | 95 | # The destination is relative to 'TEST_EXPORT_DIR' |
95 | # Because we are squashing the libraries, we need to remove | 96 | # core files/dirs first |
96 | # the layer/script directory | 97 | core_files_to_copy = [ os.path.join('scripts', 'oe-test'), |
97 | files_to_copy = [ os.path.join('meta', 'lib', 'oeqa', 'core'), | ||
98 | os.path.join('meta', 'lib', 'oeqa', 'runtime'), | ||
99 | os.path.join('meta', 'lib', 'oeqa', 'files'), | ||
100 | os.path.join('meta', 'lib', 'oeqa', 'utils'), | ||
101 | os.path.join('scripts', 'oe-test'), | ||
102 | os.path.join('scripts', 'lib', 'argparse_oe.py'), | 98 | os.path.join('scripts', 'lib', 'argparse_oe.py'), |
103 | os.path.join('scripts', 'lib', 'scriptutils.py'), ] | 99 | os.path.join('scripts', 'lib', 'scriptutils.py'), ] |
104 | 100 | for f in core_files_to_copy: | |
105 | for f in files_to_copy: | ||
106 | src = os.path.join(corebase_path, f) | 101 | src = os.path.join(corebase_path, f) |
107 | dst = os.path.join(export_path, f.split('/', 1)[-1]) | 102 | dst = os.path.join(export_path, f.split('/', 1)[-1]) |
108 | if os.path.isdir(src): | 103 | if os.path.isdir(src): |
@@ -110,18 +105,21 @@ def copy_needed_files(d, tc): | |||
110 | else: | 105 | else: |
111 | shutil.copy2(src, dst) | 106 | shutil.copy2(src, dst) |
112 | 107 | ||
113 | # Remove cases and just copy the ones specified | 108 | # layer specific files/dirs |
114 | cases_path = os.path.join(export_path, 'lib', 'oeqa', 'runtime', 'cases') | 109 | layer_files_to_copy = [ os.path.join('lib', 'oeqa', 'core'), |
115 | oe.path.remove(cases_path) | 110 | os.path.join('lib', 'oeqa', 'runtime'), |
116 | bb.utils.mkdirhier(cases_path) | 111 | os.path.join('lib', 'oeqa', 'files'), |
117 | test_paths = get_runtime_paths(d) | 112 | os.path.join('lib', 'oeqa', 'utils'),] |
118 | test_modules = d.getVar('TEST_SUITES').split() | 113 | for layer in bblayers: |
119 | tc.loadTests(test_paths, modules=test_modules) | 114 | meta = os.path.basename(layer) |
120 | for f in getSuiteCasesFiles(tc.suites): | 115 | for f in layer_files_to_copy: |
121 | shutil.copy2(f, cases_path) | 116 | src = os.path.join(layer, f) |
122 | json_file = _get_json_file(f) | 117 | dst = os.path.join(export_path, meta, f) |
123 | if json_file: | 118 | if os.path.exists(src): |
124 | shutil.copy2(json_file, cases_path) | 119 | if os.path.isdir(src): |
120 | oe.path.copytree(src, dst) | ||
121 | else: | ||
122 | shutil.copy2(src, dst) | ||
125 | 123 | ||
126 | # Copy test data | 124 | # Copy test data |
127 | image_name = ("%s/%s" % (d.getVar('DEPLOY_DIR_IMAGE'), | 125 | image_name = ("%s/%s" % (d.getVar('DEPLOY_DIR_IMAGE'), |
@@ -142,6 +140,9 @@ def copy_needed_files(d, tc): | |||
142 | testexport_create_tarball(d, "testexport.tar.gz", d.getVar("TEST_EXPORT_DIR")) | 140 | testexport_create_tarball(d, "testexport.tar.gz", d.getVar("TEST_EXPORT_DIR")) |
143 | 141 | ||
144 | # Copy packages needed for runtime testing | 142 | # Copy packages needed for runtime testing |
143 | test_paths = get_runtime_paths(d) | ||
144 | test_modules = d.getVar('TEST_SUITES').split() | ||
145 | tc.loadTests(test_paths, modules=test_modules) | ||
145 | package_extraction(d, tc.suites) | 146 | package_extraction(d, tc.suites) |
146 | test_pkg_dir = d.getVar("TEST_NEEDED_PACKAGES_DIR") | 147 | test_pkg_dir = d.getVar("TEST_NEEDED_PACKAGES_DIR") |
147 | if os.path.isdir(test_pkg_dir) and os.listdir(test_pkg_dir): | 148 | if os.path.isdir(test_pkg_dir) and os.listdir(test_pkg_dir): |
diff --git a/scripts/oe-test b/scripts/oe-test index 55985b0b24..3a00369e01 100755 --- a/scripts/oe-test +++ b/scripts/oe-test | |||
@@ -7,14 +7,18 @@ | |||
7 | # SPDX-License-Identifier: MIT | 7 | # SPDX-License-Identifier: MIT |
8 | # | 8 | # |
9 | 9 | ||
10 | import os | ||
11 | import sys | ||
12 | import argparse | 10 | import argparse |
11 | import glob | ||
13 | import logging | 12 | import logging |
13 | import os | ||
14 | import sys | ||
14 | 15 | ||
15 | scripts_path = os.path.dirname(os.path.realpath(__file__)) | 16 | scripts_path = os.path.dirname(os.path.realpath(__file__)) |
16 | lib_path = scripts_path + '/lib' | 17 | lib_path = os.path.join(scripts_path, 'lib') |
17 | sys.path = sys.path + [lib_path] | 18 | sys.path.append(lib_path) |
19 | meta_lib_paths = glob.glob(scripts_path + '/*/lib', recursive=True) | ||
20 | for p in meta_lib_paths: | ||
21 | sys.path.append(p) | ||
18 | import argparse_oe | 22 | import argparse_oe |
19 | import scriptutils | 23 | import scriptutils |
20 | 24 | ||