aboutsummaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/selftest
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2018-11-24 17:56:06 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-12-06 10:28:57 +0000
commit65403bb556f7e3132722288a62ef36631af0b557 (patch)
tree30f924dc0539081b1b93ebd57bc6c90c0e1634e5 /meta/lib/oeqa/selftest
parentd3b3c55ddc312039380ce8e23e68dd8bb2439388 (diff)
downloadopenembedded-core-contrib-65403bb556f7e3132722288a62ef36631af0b557.tar.gz
oeqa/selftest/signing: Skip tests if gpg isn't found
Raising an assertionError in the class setup isn't a particuarly good way to indicate gpg isn't installed. Instead skip the tests if the required binary isn't present. For the signing tests we do require it to be present and can't use a prebuilt one. (From OE-Core rev: 2d486af97e51b9daa9c40482c31d637c9ab4ae79) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/selftest')
-rw-r--r--meta/lib/oeqa/selftest/cases/signing.py23
1 files changed, 11 insertions, 12 deletions
diff --git a/meta/lib/oeqa/selftest/cases/signing.py b/meta/lib/oeqa/selftest/cases/signing.py
index a750cfc7b2..28afcdccb4 100644
--- a/meta/lib/oeqa/selftest/cases/signing.py
+++ b/meta/lib/oeqa/selftest/cases/signing.py
@@ -15,23 +15,18 @@ class Signing(OESelftestTestCase):
pub_key_path = ""
secret_key_path = ""
- @classmethod
- def setUpClass(cls):
- super(Signing, cls).setUpClass()
+ def setup_gpg(self):
# Check that we can find the gpg binary and fail early if we can't
if not shutil.which("gpg"):
- raise AssertionError("This test needs GnuPG")
+ self.skipTest('gpg binary not found')
- cls.gpg_dir = tempfile.mkdtemp(prefix="oeqa-signing-")
+ self.gpg_dir = tempfile.mkdtemp(prefix="oeqa-signing-")
+ self.track_for_cleanup(self.gpg_dir)
- cls.pub_key_path = os.path.join(cls.testlayer_path, 'files', 'signing', "key.pub")
- cls.secret_key_path = os.path.join(cls.testlayer_path, 'files', 'signing', "key.secret")
+ self.pub_key_path = os.path.join(self.testlayer_path, 'files', 'signing', "key.pub")
+ self.secret_key_path = os.path.join(self.testlayer_path, 'files', 'signing', "key.secret")
- runCmd('gpg --batch --homedir %s --import %s %s' % (cls.gpg_dir, cls.pub_key_path, cls.secret_key_path))
-
- @classmethod
- def tearDownClass(cls):
- shutil.rmtree(cls.gpg_dir, ignore_errors=True)
+ runCmd('gpg --batch --homedir %s --import %s %s' % (self.gpg_dir, self.pub_key_path, self.secret_key_path))
@OETestID(1362)
def test_signing_packages(self):
@@ -46,6 +41,8 @@ class Signing(OESelftestTestCase):
"""
import oe.packagedata
+ self.setup_gpg()
+
package_classes = get_bb_var('PACKAGE_CLASSES')
if 'package_rpm' not in package_classes:
self.skipTest('This test requires RPM Packaging.')
@@ -111,6 +108,8 @@ class Signing(OESelftestTestCase):
builddir = os.environ.get('BUILDDIR')
sstatedir = os.path.join(builddir, 'test-sstate')
+ self.setup_gpg()
+
self.add_command_to_tearDown('bitbake -c clean %s' % test_recipe)
self.add_command_to_tearDown('rm -rf %s' % sstatedir)