* [PATCH 1/1] testsdk: add ability to search for multilib packages
@ 2017-12-19 19:07 Joe Slater
2018-01-13 14:14 ` Richard Purdie
0 siblings, 1 reply; 2+ messages in thread
From: Joe Slater @ 2017-12-19 19:07 UTC (permalink / raw)
To: openembedded-core
We search for packages related to the sdk environment
being used for a test.
Signed-off-by: Joe Slater <jslater@windriver.com>
---
meta/lib/oeqa/sdk/cases/buildgalculator.py | 7 ++++---
meta/lib/oeqa/sdk/context.py | 15 +++++++++++++--
2 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/meta/lib/oeqa/sdk/cases/buildgalculator.py b/meta/lib/oeqa/sdk/cases/buildgalculator.py
index 780afcc..8518b15 100644
--- a/meta/lib/oeqa/sdk/cases/buildgalculator.py
+++ b/meta/lib/oeqa/sdk/cases/buildgalculator.py
@@ -8,9 +8,10 @@ class GalculatorTest(OESDKTestCase):
@classmethod
def setUpClass(self):
- if not (self.tc.hasTargetPackage("gtk\+3") or\
- self.tc.hasTargetPackage("libgtk-3.0")):
- raise unittest.SkipTest("GalculatorTest class: SDK don't support gtk+3")
+ # search for the multilib package per sdk_env
+ if not (self.tc.hasPrefixedTargetPackage("gtk\+3") or
+ self.tc.hasPrefixedTargetPackage("libgtk-3.0")):
+ raise unittest.SkipTest("GalculatorTest class: SDK doesn't support gtk+3")
def test_galculator(self):
dl_dir = self.td.get('DL_DIR', None)
diff --git a/meta/lib/oeqa/sdk/context.py b/meta/lib/oeqa/sdk/context.py
index b3d7c75..291be1e 100644
--- a/meta/lib/oeqa/sdk/context.py
+++ b/meta/lib/oeqa/sdk/context.py
@@ -22,8 +22,9 @@ class OESDKTestContext(OETestContextThreaded):
self.host_pkg_manifest = host_pkg_manifest
def _hasPackage(self, manifest, pkg):
- for host_pkg in manifest.keys():
- if re.search(pkg, host_pkg):
+ pat = re.compile(pkg)
+ for s in manifest.keys():
+ if pat.search(s):
return True
return False
@@ -33,6 +34,16 @@ class OESDKTestContext(OETestContextThreaded):
def hasTargetPackage(self, pkg):
return self._hasPackage(self.target_pkg_manifest, pkg)
+ def hasPrefixedTargetPackage(self, pkg):
+ # extract multilib from environment script name
+ try:
+ p = re.match(".*(lib.?[36][24]-)linux-?", self.sdk_env).group(1) + pkg
+ except:
+ p = pkg
+
+ # bb.warn("Searching for multilib pkg %s" % (p))
+ return self.hasTargetPackage(p)
+
class OESDKTestContextExecutor(OETestContextExecutor):
_context_class = OESDKTestContext
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 1/1] testsdk: add ability to search for multilib packages
2017-12-19 19:07 [PATCH 1/1] testsdk: add ability to search for multilib packages Joe Slater
@ 2018-01-13 14:14 ` Richard Purdie
0 siblings, 0 replies; 2+ messages in thread
From: Richard Purdie @ 2018-01-13 14:14 UTC (permalink / raw)
To: Joe Slater, openembedded-core
On Tue, 2017-12-19 at 11:07 -0800, Joe Slater wrote:
> We search for packages related to the sdk environment
> being used for a test.
[...]
> @@ -33,6 +34,16 @@ class OESDKTestContext(OETestContextThreaded):
> def hasTargetPackage(self, pkg):
> return self._hasPackage(self.target_pkg_manifest, pkg)
>
> + def hasPrefixedTargetPackage(self, pkg):
> + # extract multilib from environment script name
> + try:
> + p = re.match(".*(lib.?[36][24]-)linux-?",
> self.sdk_env).group(1) + pkg
> + except:
I'm not sure this is correct, many of the prefixes are just "lib32-"
and there is no "linux" in there?
We could really use unit tests on these functions as we're heading into
unmaintainable spaghetti territory :(.
It may also be an option to iterate the configured multilibs and search
for each one, that way we avoid the regexp overhead?
Cheers,
Richard
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-01-13 14:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-19 19:07 [PATCH 1/1] testsdk: add ability to search for multilib packages Joe Slater
2018-01-13 14:14 ` Richard Purdie
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox