From 7e1b40307aa780102796638e06a1284b6e318087 Mon Sep 17 00:00:00 2001 From: Patrick Vacek Date: Mon, 13 Nov 2017 13:57:49 +0100 Subject: Split tests into independent classes. This reduces unnecessary time spent on setUpClass calls that may not be necessary for individual tests. It also organizes things a bit better. --- lib/oeqa/selftest/updater.py | 38 +++++++++++++++++++++++++++----------- 1 file changed, 27 insertions(+), 11 deletions(-) (limited to 'lib/oeqa/selftest') diff --git a/lib/oeqa/selftest/updater.py b/lib/oeqa/selftest/updater.py index e3542be..ea57f9d 100644 --- a/lib/oeqa/selftest/updater.py +++ b/lib/oeqa/selftest/updater.py @@ -8,13 +8,13 @@ import subprocess from oeqa.selftest.qemucommand import QemuCommand import time -class UpdaterTests(oeSelfTest): +class SotaToolsTests(oeSelfTest): @classmethod def setUpClass(cls): logger = logging.getLogger("selftest") - logger.info('Running bitbake to build aktualizr-native tools and garage-sign-native') - bitbake('aktualizr-native garage-sign-native') + logger.info('Running bitbake to build aktualizr-native tools') + bitbake('aktualizr-native') def test_help(self): bb_vars = get_bb_vars(['SYSROOT_DESTDIR', 'bindir'], 'aktualizr-native') @@ -23,26 +23,41 @@ class UpdaterTests(oeSelfTest): result = runCmd('%s --help' % p, ignore_status=True) self.assertEqual(result.status, 0, "Status not equal to 0. output: %s" % result.output) - def test_java(self): - result = runCmd('which java', ignore_status=True) - self.assertEqual(result.status, 0, "Java not found.") + def test_push(self): + bitbake('core-image-minimal') + self.write_config('IMAGE_INSTALL_append = " man "') + bitbake('core-image-minimal') + + +class GarageSignTests(oeSelfTest): + + @classmethod + def setUpClass(cls): + logger = logging.getLogger("selftest") + logger.info('Running bitbake to build garage-sign-native') + bitbake('garage-sign-native') - def test_sign(self): + def test_help(self): bb_vars = get_bb_vars(['SYSROOT_DESTDIR', 'bindir'], 'garage-sign-native') p = bb_vars['SYSROOT_DESTDIR'] + bb_vars['bindir'] + "/" + "garage-sign" self.assertTrue(os.path.isfile(p), msg = "No garage-sign found (%s)" % p) result = runCmd('%s --help' % p, ignore_status=True) self.assertEqual(result.status, 0, "Status not equal to 0. output: %s" % result.output) - def test_push(self): - bitbake('core-image-minimal') - self.write_config('IMAGE_INSTALL_append = " man "') - bitbake('core-image-minimal') + +class HsmTests(oeSelfTest): def test_hsm(self): self.write_config('SOTA_CLIENT_FEATURES="hsm hsm-test"') bitbake('core-image-minimal') + +class GeneralTests(oeSelfTest): + + def test_java(self): + result = runCmd('which java', ignore_status=True) + self.assertEqual(result.status, 0, "Java not found.") + def test_qemu(self): print('') # Create empty object. @@ -72,3 +87,4 @@ class UpdaterTests(oeSelfTest): s.terminate() except KeyboardInterrupt: pass + -- cgit v1.2.3-54-g00ecf