diff options
-rw-r--r-- | lib/oeqa/selftest/updater.py | 43 |
1 files changed, 35 insertions, 8 deletions
diff --git a/lib/oeqa/selftest/updater.py b/lib/oeqa/selftest/updater.py index ea57f9d..adae081 100644 --- a/lib/oeqa/selftest/updater.py +++ b/lib/oeqa/selftest/updater.py | |||
@@ -1,12 +1,15 @@ | |||
1 | import unittest | 1 | import unittest |
2 | import os | 2 | import os |
3 | import logging | 3 | import logging |
4 | import subprocess | ||
5 | import time | ||
4 | 6 | ||
5 | from oeqa.selftest.base import oeSelfTest | 7 | from oeqa.selftest.base import oeSelfTest |
6 | from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_bb_vars | 8 | from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_bb_vars |
7 | import subprocess | ||
8 | from oeqa.selftest.qemucommand import QemuCommand | 9 | from oeqa.selftest.qemucommand import QemuCommand |
9 | import time | 10 | |
11 | DEFAULT_DIR = 'tmp/deploy/images' | ||
12 | |||
10 | 13 | ||
11 | class SotaToolsTests(oeSelfTest): | 14 | class SotaToolsTests(oeSelfTest): |
12 | 15 | ||
@@ -23,11 +26,6 @@ class SotaToolsTests(oeSelfTest): | |||
23 | result = runCmd('%s --help' % p, ignore_status=True) | 26 | result = runCmd('%s --help' % p, ignore_status=True) |
24 | self.assertEqual(result.status, 0, "Status not equal to 0. output: %s" % result.output) | 27 | self.assertEqual(result.status, 0, "Status not equal to 0. output: %s" % result.output) |
25 | 28 | ||
26 | def test_push(self): | ||
27 | bitbake('core-image-minimal') | ||
28 | self.write_config('IMAGE_INSTALL_append = " man "') | ||
29 | bitbake('core-image-minimal') | ||
30 | |||
31 | 29 | ||
32 | class GarageSignTests(oeSelfTest): | 30 | class GarageSignTests(oeSelfTest): |
33 | 31 | ||
@@ -58,13 +56,42 @@ class GeneralTests(oeSelfTest): | |||
58 | result = runCmd('which java', ignore_status=True) | 56 | result = runCmd('which java', ignore_status=True) |
59 | self.assertEqual(result.status, 0, "Java not found.") | 57 | self.assertEqual(result.status, 0, "Java not found.") |
60 | 58 | ||
59 | def test_add_package(self): | ||
60 | print('') | ||
61 | machine = get_bb_var('MACHINE', 'core-image-minimal') | ||
62 | image_path = DEFAULT_DIR + '/' + machine + '/core-image-minimal-' + machine + '.otaimg' | ||
63 | logger = logging.getLogger("selftest") | ||
64 | |||
65 | logger.info('Running bitbake with man in the image package list') | ||
66 | self.write_config('IMAGE_INSTALL_append = " man "') | ||
67 | bitbake('-c cleanall man') | ||
68 | bitbake('core-image-minimal') | ||
69 | result = runCmd('oe-pkgdata-util find-path /usr/bin/man') | ||
70 | self.assertEqual(result.output, 'man: /usr/bin/man') | ||
71 | path1 = os.path.realpath(image_path) | ||
72 | size1 = os.path.getsize(path1) | ||
73 | logger.info('First image %s has size %i' % (path1, size1)) | ||
74 | |||
75 | logger.info('Running bitbake without man in the image package list') | ||
76 | self.write_config('IMAGE_INSTALL_remove = " man "') | ||
77 | bitbake('-c cleanall man') | ||
78 | bitbake('core-image-minimal') | ||
79 | result = runCmd('oe-pkgdata-util find-path /usr/bin/man', ignore_status=True) | ||
80 | self.assertEqual(result.status, 1, "Status different than 1. output: %s" % result.output) | ||
81 | self.assertEqual(result.output, 'ERROR: Unable to find any package producing path /usr/bin/man') | ||
82 | path2 = os.path.realpath(image_path) | ||
83 | size2 = os.path.getsize(path2) | ||
84 | logger.info('Second image %s has size %i' % (path2, size2)) | ||
85 | self.assertNotEqual(path1, path2, "Image paths are identical; image was not rebuilt.") | ||
86 | self.assertNotEqual(size1, size2, "Image sizes are identical; image was not rebuilt.") | ||
87 | |||
61 | def test_qemu(self): | 88 | def test_qemu(self): |
62 | print('') | 89 | print('') |
63 | # Create empty object. | 90 | # Create empty object. |
64 | args = type('', (), {})() | 91 | args = type('', (), {})() |
65 | args.imagename = 'core-image-minimal' | 92 | args.imagename = 'core-image-minimal' |
66 | args.mac = None | 93 | args.mac = None |
67 | args.dir = 'tmp/deploy/images' | 94 | args.dir = DEFAULT_DIR |
68 | args.efi = False | 95 | args.efi = False |
69 | args.machine = None | 96 | args.machine = None |
70 | args.no_kvm = False | 97 | args.no_kvm = False |