summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/lib/oeqa/runtime/decorator/package.py34
1 files changed, 32 insertions, 2 deletions
diff --git a/meta/lib/oeqa/runtime/decorator/package.py b/meta/lib/oeqa/runtime/decorator/package.py
index 4c5ca198b0..57178655cc 100644
--- a/meta/lib/oeqa/runtime/decorator/package.py
+++ b/meta/lib/oeqa/runtime/decorator/package.py
@@ -46,11 +46,41 @@ class OEHasPackage(OETestDecorator):
46 self.logger.debug(msg) 46 self.logger.debug(msg)
47 if not self.case.tc.image_packages.isdisjoint(unneed_pkgs): 47 if not self.case.tc.image_packages.isdisjoint(unneed_pkgs):
48 msg = "Test can't run with %s installed" % ', or'.join(unneed_pkgs) 48 msg = "Test can't run with %s installed" % ', or'.join(unneed_pkgs)
49 self.case.skipTest(msg) 49 self._decorator_fail(msg)
50 50
51 if need_pkgs: 51 if need_pkgs:
52 msg = 'Checking if at least one of %s is installed' % ', '.join(need_pkgs) 52 msg = 'Checking if at least one of %s is installed' % ', '.join(need_pkgs)
53 self.logger.debug(msg) 53 self.logger.debug(msg)
54 if self.case.tc.image_packages.isdisjoint(need_pkgs): 54 if self.case.tc.image_packages.isdisjoint(need_pkgs):
55 msg = "Test requires %s to be installed" % ', or'.join(need_pkgs) 55 msg = "Test requires %s to be installed" % ', or'.join(need_pkgs)
56 self.case.skipTest(msg) 56 self._decorator_fail(msg)
57
58 def _decorator_fail(self, msg):
59 self.case.skipTest(msg)
60
61@registerDecorator
62class OERequirePackage(OEHasPackage):
63 """
64 Checks if image has packages (un)installed.
65 It is almost the same as OEHasPackage, but if dependencies are missing
66 the test case fails.
67
68 The argument must be a string, set, or list of packages that must be
69 installed or not present in the image.
70
71 The way to tell a package must not be in an image is using an
72 exclamation point ('!') before the name of the package.
73
74 If test depends on pkg1 or pkg2 you need to use:
75 @OERequirePackage({'pkg1', 'pkg2'})
76
77 If test depends on pkg1 and pkg2 you need to use:
78 @OERequirePackage('pkg1')
79 @OERequirePackage('pkg2')
80
81 If test depends on pkg1 but pkg2 must not be present use:
82 @OERequirePackage({'pkg1', '!pkg2'})
83 """
84
85 def _decorator_fail(self, msg):
86 self.case.fail(msg)