summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Vacek <patrickvacek@gmail.com>2017-11-13 13:57:49 +0100
committerPatrick Vacek <patrickvacek@gmail.com>2017-11-13 17:18:52 +0100
commit7e1b40307aa780102796638e06a1284b6e318087 (patch)
treee53a5e8bb903f6e1c299187422ca26fe6c0b2f22
parentd05ef2141f0f707c75e6cafa8f8c49076c141376 (diff)
downloadmeta-updater-7e1b40307aa780102796638e06a1284b6e318087.tar.gz
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.
-rw-r--r--lib/oeqa/selftest/updater.py38
1 files changed, 27 insertions, 11 deletions
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
8from oeqa.selftest.qemucommand import QemuCommand 8from oeqa.selftest.qemucommand import QemuCommand
9import time 9import time
10 10
11class UpdaterTests(oeSelfTest): 11class SotaToolsTests(oeSelfTest):
12 12
13 @classmethod 13 @classmethod
14 def setUpClass(cls): 14 def setUpClass(cls):
15 logger = logging.getLogger("selftest") 15 logger = logging.getLogger("selftest")
16 logger.info('Running bitbake to build aktualizr-native tools and garage-sign-native') 16 logger.info('Running bitbake to build aktualizr-native tools')
17 bitbake('aktualizr-native garage-sign-native') 17 bitbake('aktualizr-native')
18 18
19 def test_help(self): 19 def test_help(self):
20 bb_vars = get_bb_vars(['SYSROOT_DESTDIR', 'bindir'], 'aktualizr-native') 20 bb_vars = get_bb_vars(['SYSROOT_DESTDIR', 'bindir'], 'aktualizr-native')
@@ -23,26 +23,41 @@ class UpdaterTests(oeSelfTest):
23 result = runCmd('%s --help' % p, ignore_status=True) 23 result = runCmd('%s --help' % p, ignore_status=True)
24 self.assertEqual(result.status, 0, "Status not equal to 0. output: %s" % result.output) 24 self.assertEqual(result.status, 0, "Status not equal to 0. output: %s" % result.output)
25 25
26 def test_java(self): 26 def test_push(self):
27 result = runCmd('which java', ignore_status=True) 27 bitbake('core-image-minimal')
28 self.assertEqual(result.status, 0, "Java not found.") 28 self.write_config('IMAGE_INSTALL_append = " man "')
29 bitbake('core-image-minimal')
30
31
32class GarageSignTests(oeSelfTest):
33
34 @classmethod
35 def setUpClass(cls):
36 logger = logging.getLogger("selftest")
37 logger.info('Running bitbake to build garage-sign-native')
38 bitbake('garage-sign-native')
29 39
30 def test_sign(self): 40 def test_help(self):
31 bb_vars = get_bb_vars(['SYSROOT_DESTDIR', 'bindir'], 'garage-sign-native') 41 bb_vars = get_bb_vars(['SYSROOT_DESTDIR', 'bindir'], 'garage-sign-native')
32 p = bb_vars['SYSROOT_DESTDIR'] + bb_vars['bindir'] + "/" + "garage-sign" 42 p = bb_vars['SYSROOT_DESTDIR'] + bb_vars['bindir'] + "/" + "garage-sign"
33 self.assertTrue(os.path.isfile(p), msg = "No garage-sign found (%s)" % p) 43 self.assertTrue(os.path.isfile(p), msg = "No garage-sign found (%s)" % p)
34 result = runCmd('%s --help' % p, ignore_status=True) 44 result = runCmd('%s --help' % p, ignore_status=True)
35 self.assertEqual(result.status, 0, "Status not equal to 0. output: %s" % result.output) 45 self.assertEqual(result.status, 0, "Status not equal to 0. output: %s" % result.output)
36 46
37 def test_push(self): 47
38 bitbake('core-image-minimal') 48class HsmTests(oeSelfTest):
39 self.write_config('IMAGE_INSTALL_append = " man "')
40 bitbake('core-image-minimal')
41 49
42 def test_hsm(self): 50 def test_hsm(self):
43 self.write_config('SOTA_CLIENT_FEATURES="hsm hsm-test"') 51 self.write_config('SOTA_CLIENT_FEATURES="hsm hsm-test"')
44 bitbake('core-image-minimal') 52 bitbake('core-image-minimal')
45 53
54
55class GeneralTests(oeSelfTest):
56
57 def test_java(self):
58 result = runCmd('which java', ignore_status=True)
59 self.assertEqual(result.status, 0, "Java not found.")
60
46 def test_qemu(self): 61 def test_qemu(self):
47 print('') 62 print('')
48 # Create empty object. 63 # Create empty object.
@@ -72,3 +87,4 @@ class UpdaterTests(oeSelfTest):
72 s.terminate() 87 s.terminate()
73 except KeyboardInterrupt: 88 except KeyboardInterrupt:
74 pass 89 pass
90