diff options
author | Thune Tran <thune.a.tran@boeing.com> | 2025-06-26 20:57:21 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-07-01 08:49:37 +0100 |
commit | 041ba867db947c9336c47747c621d2a1719d5c4c (patch) | |
tree | ae5fa9e709e159b239bafaa17f5ece9d5a8c929a | |
parent | ece7bb5490c8c8cc8db6529cad5f512e591d2ecb (diff) | |
download | poky-041ba867db947c9336c47747c621d2a1719d5c4c.tar.gz |
oeqa/sdk: Simplify test specification and discovery
Simplify how tests are specified and discovered for different SDK configurations
to allow per-layer customization.
* Introduce `TESTSDK_CASE_DIRS` variable to specify test directory types,
replacing the need to modify the default_cases class member
* Discover tests from configured layers using a common discovery pattern
(`<LAYER_DIR>/lib/oeqa/<dirname>/cases`) where `<dirname>` is specified in `TESTSDK_CASE_DIRS`
* The buildtools directories were renamed to follow the common discovery pattern
(`<LAYER_DIR>/lib/oeqa/<dirname>/cases`) for consistency across all SDK configurations.
meta/lib/oeqa/
├── sdk/cases/ # Standard SDK: dirname="sdk"
├── buildtools/cases/ # Buildtools: dirname="buildtools"
└── buildtools-docs/cases/ # Buildtools-docs: dirname="buildtools-docs"
meta-mingw/lib/oeqa/
└── sdkmingw/cases/ # MinGW: dirname="sdkmingw"
meta-foo/lib/oeqa/
└── sdk/cases/ # Standard SDK: dirname="sdk"
Tested by:
1. Adding new tests using the default discovery pattern `<LAYER_DIR>/lib/oeqa/sdk/cases` and
verifying they are discovered and executed.
2. Verifying existing SDK configuration tests work (requires -c populate_sdk first):
* Standard SDK: `bitbake core-image-minimal -c testsdk`
* Buildtools tarball: `bitbake buildtools-tarball -c testsdk`
* Buildtools docs tarball: `bitbake buildtools-docs-tarball -c testsdk`
* Mingw SDK: (SDKMACHINE = "x86_64-mingw32") `bitbake core-image-minimal -c testsdk`
(From OE-Core rev: bde94c128c0b4e7e1ebea40f582b4dd6dcc965ff)
Signed-off-by: Thune Tran <thune.a.tran@boeing.com>
Signed-off-by: Chuck Wolber <chuck.wolber@boeing.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/classes-recipe/testsdk.bbclass | 1 | ||||
-rw-r--r-- | meta/lib/oeqa/buildtools-docs/cases/README (renamed from meta/lib/oeqa/sdk/buildtools-docs-cases/README) | 0 | ||||
-rw-r--r-- | meta/lib/oeqa/buildtools-docs/cases/build.py (renamed from meta/lib/oeqa/sdk/buildtools-docs-cases/build.py) | 0 | ||||
-rw-r--r-- | meta/lib/oeqa/buildtools/cases/README (renamed from meta/lib/oeqa/sdk/buildtools-cases/README) | 0 | ||||
-rw-r--r-- | meta/lib/oeqa/buildtools/cases/build.py (renamed from meta/lib/oeqa/sdk/buildtools-cases/build.py) | 0 | ||||
-rw-r--r-- | meta/lib/oeqa/buildtools/cases/gcc.py (renamed from meta/lib/oeqa/sdk/buildtools-cases/gcc.py) | 0 | ||||
-rw-r--r-- | meta/lib/oeqa/buildtools/cases/https.py (renamed from meta/lib/oeqa/sdk/buildtools-cases/https.py) | 0 | ||||
-rw-r--r-- | meta/lib/oeqa/buildtools/cases/sanity.py (renamed from meta/lib/oeqa/sdk/buildtools-cases/sanity.py) | 0 | ||||
-rw-r--r-- | meta/lib/oeqa/sdk/testsdk.py | 24 | ||||
-rw-r--r-- | meta/recipes-core/meta/buildtools-docs-tarball.bb | 3 | ||||
-rw-r--r-- | meta/recipes-core/meta/buildtools-tarball.bb | 21 |
11 files changed, 29 insertions, 20 deletions
diff --git a/meta/classes-recipe/testsdk.bbclass b/meta/classes-recipe/testsdk.bbclass index 59d2834c99..b1c4fa67e6 100644 --- a/meta/classes-recipe/testsdk.bbclass +++ b/meta/classes-recipe/testsdk.bbclass | |||
@@ -19,6 +19,7 @@ TESTSDK_SUITES ?= "" | |||
19 | 19 | ||
20 | TESTSDK_CLASS_NAME ?= "oeqa.sdk.testsdk.TestSDK" | 20 | TESTSDK_CLASS_NAME ?= "oeqa.sdk.testsdk.TestSDK" |
21 | TESTSDKEXT_CLASS_NAME ?= "oeqa.sdkext.testsdk.TestSDKExt" | 21 | TESTSDKEXT_CLASS_NAME ?= "oeqa.sdkext.testsdk.TestSDKExt" |
22 | TESTSDK_CASE_DIRS ?= "sdk" | ||
22 | 23 | ||
23 | def import_and_run(name, d): | 24 | def import_and_run(name, d): |
24 | import importlib | 25 | import importlib |
diff --git a/meta/lib/oeqa/sdk/buildtools-docs-cases/README b/meta/lib/oeqa/buildtools-docs/cases/README index f8edbc7dad..f8edbc7dad 100644 --- a/meta/lib/oeqa/sdk/buildtools-docs-cases/README +++ b/meta/lib/oeqa/buildtools-docs/cases/README | |||
diff --git a/meta/lib/oeqa/sdk/buildtools-docs-cases/build.py b/meta/lib/oeqa/buildtools-docs/cases/build.py index 6e3ee94292..6e3ee94292 100644 --- a/meta/lib/oeqa/sdk/buildtools-docs-cases/build.py +++ b/meta/lib/oeqa/buildtools-docs/cases/build.py | |||
diff --git a/meta/lib/oeqa/sdk/buildtools-cases/README b/meta/lib/oeqa/buildtools/cases/README index d4f20faa9f..d4f20faa9f 100644 --- a/meta/lib/oeqa/sdk/buildtools-cases/README +++ b/meta/lib/oeqa/buildtools/cases/README | |||
diff --git a/meta/lib/oeqa/sdk/buildtools-cases/build.py b/meta/lib/oeqa/buildtools/cases/build.py index c85c32496b..c85c32496b 100644 --- a/meta/lib/oeqa/sdk/buildtools-cases/build.py +++ b/meta/lib/oeqa/buildtools/cases/build.py | |||
diff --git a/meta/lib/oeqa/sdk/buildtools-cases/gcc.py b/meta/lib/oeqa/buildtools/cases/gcc.py index a62c4d0bc4..a62c4d0bc4 100644 --- a/meta/lib/oeqa/sdk/buildtools-cases/gcc.py +++ b/meta/lib/oeqa/buildtools/cases/gcc.py | |||
diff --git a/meta/lib/oeqa/sdk/buildtools-cases/https.py b/meta/lib/oeqa/buildtools/cases/https.py index 4525e3d758..4525e3d758 100644 --- a/meta/lib/oeqa/sdk/buildtools-cases/https.py +++ b/meta/lib/oeqa/buildtools/cases/https.py | |||
diff --git a/meta/lib/oeqa/sdk/buildtools-cases/sanity.py b/meta/lib/oeqa/buildtools/cases/sanity.py index a55d456656..a55d456656 100644 --- a/meta/lib/oeqa/sdk/buildtools-cases/sanity.py +++ b/meta/lib/oeqa/buildtools/cases/sanity.py | |||
diff --git a/meta/lib/oeqa/sdk/testsdk.py b/meta/lib/oeqa/sdk/testsdk.py index 52b702b6a2..cffcf9f49a 100644 --- a/meta/lib/oeqa/sdk/testsdk.py +++ b/meta/lib/oeqa/sdk/testsdk.py | |||
@@ -31,6 +31,28 @@ class TestSDK(TestSDKBase): | |||
31 | context_class = OESDKTestContext | 31 | context_class = OESDKTestContext |
32 | test_type = 'sdk' | 32 | test_type = 'sdk' |
33 | 33 | ||
34 | def sdk_dir_names(self, d): | ||
35 | """Return list from TESTSDK_CASE_DIRS.""" | ||
36 | testdirs = d.getVar("TESTSDK_CASE_DIRS") | ||
37 | if testdirs: | ||
38 | return testdirs.split() | ||
39 | |||
40 | bb.fatal("TESTSDK_CASE_DIRS unset, can't find SDK test directories.") | ||
41 | |||
42 | def get_sdk_paths(self, d): | ||
43 | """ | ||
44 | Return a list of paths where SDK test cases reside. | ||
45 | |||
46 | SDK tests are expected in <LAYER_DIR>/lib/oeqa/<dirname>/cases | ||
47 | """ | ||
48 | paths = [] | ||
49 | for layer in d.getVar("BBLAYERS").split(): | ||
50 | for dirname in self.sdk_dir_names(d): | ||
51 | case_path = os.path.join(layer, "lib", "oeqa", dirname, "cases") | ||
52 | if os.path.isdir(case_path): | ||
53 | paths.append(case_path) | ||
54 | return paths | ||
55 | |||
34 | def get_tcname(self, d): | 56 | def get_tcname(self, d): |
35 | """ | 57 | """ |
36 | Get the name of the SDK file | 58 | Get the name of the SDK file |
@@ -115,7 +137,7 @@ class TestSDK(TestSDKBase): | |||
115 | 137 | ||
116 | try: | 138 | try: |
117 | modules = (d.getVar("TESTSDK_SUITES") or "").split() | 139 | modules = (d.getVar("TESTSDK_SUITES") or "").split() |
118 | tc.loadTests(self.context_executor_class.default_cases, modules) | 140 | tc.loadTests(self.get_sdk_paths(d), modules) |
119 | except Exception as e: | 141 | except Exception as e: |
120 | import traceback | 142 | import traceback |
121 | bb.fatal("Loading tests failed:\n%s" % traceback.format_exc()) | 143 | bb.fatal("Loading tests failed:\n%s" % traceback.format_exc()) |
diff --git a/meta/recipes-core/meta/buildtools-docs-tarball.bb b/meta/recipes-core/meta/buildtools-docs-tarball.bb index 24fbc33000..98d47f7b71 100644 --- a/meta/recipes-core/meta/buildtools-docs-tarball.bb +++ b/meta/recipes-core/meta/buildtools-docs-tarball.bb | |||
@@ -18,4 +18,5 @@ TOOLCHAIN_OUTPUTNAME = "${SDK_ARCH}-buildtools-docs-nativesdk-standalone-${DISTR | |||
18 | 18 | ||
19 | SDK_TITLE = "Docs Build tools tarball" | 19 | SDK_TITLE = "Docs Build tools tarball" |
20 | 20 | ||
21 | TESTSDK_CASES = "buildtools-docs-cases" | 21 | # Directory that contains testcases |
22 | TESTSDK_CASE_DIRS = "buildtools-docs" \ No newline at end of file | ||
diff --git a/meta/recipes-core/meta/buildtools-tarball.bb b/meta/recipes-core/meta/buildtools-tarball.bb index 6fa6d93a3d..02117ab84d 100644 --- a/meta/recipes-core/meta/buildtools-tarball.bb +++ b/meta/recipes-core/meta/buildtools-tarball.bb | |||
@@ -124,22 +124,7 @@ TOOLCHAIN_NEED_CONFIGSITE_CACHE = "" | |||
124 | # The recipe doesn't need any default deps | 124 | # The recipe doesn't need any default deps |
125 | INHIBIT_DEFAULT_DEPS = "1" | 125 | INHIBIT_DEFAULT_DEPS = "1" |
126 | 126 | ||
127 | # Directory in testsdk that contains testcases | 127 | inherit testsdk |
128 | TESTSDK_CASES = "buildtools-cases" | ||
129 | 128 | ||
130 | # We have our own code, avoid deferred inherit | 129 | # Directory that contains testcases |
131 | SDK_CLASSES:remove = "testsdk" | 130 | TESTSDK_CASE_DIRS = "buildtools" \ No newline at end of file |
132 | |||
133 | python do_testsdk() { | ||
134 | import oeqa.sdk.testsdk | ||
135 | testsdk = oeqa.sdk.testsdk.TestSDK() | ||
136 | |||
137 | cases_path = os.path.join(os.path.abspath(os.path.dirname(oeqa.sdk.testsdk.__file__)), d.getVar("TESTSDK_CASES")) | ||
138 | testsdk.context_executor_class.default_cases = [cases_path,] | ||
139 | |||
140 | testsdk.run(d) | ||
141 | } | ||
142 | addtask testsdk | ||
143 | do_testsdk[nostamp] = "1" | ||
144 | do_testsdk[network] = "1" | ||
145 | do_testsdk[depends] += "xz-native:do_populate_sysroot" | ||