summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorPatrick Vacek <patrickvacek@gmail.com>2017-11-13 15:12:14 +0100
committerPatrick Vacek <patrickvacek@gmail.com>2017-11-13 17:52:36 +0100
commit9178f7116aad6722121d3170ed76cf47c4d22cc4 (patch)
tree230f20f4daf64cd33bea01a043ddb830f0fee766 /lib
parent7e1b40307aa780102796638e06a1284b6e318087 (diff)
downloadmeta-updater-9178f7116aad6722121d3170ed76cf47c4d22cc4.tar.gz
Make double-bitbake test actually useful.
* Make sure to remove man package before bitbaking. * Test that the package exists or not. * Check the image name and size to make sure it changes. * Move to appropriate class and rename.
Diffstat (limited to 'lib')
-rw-r--r--lib/oeqa/selftest/updater.py43
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 @@
1import unittest 1import unittest
2import os 2import os
3import logging 3import logging
4import subprocess
5import time
4 6
5from oeqa.selftest.base import oeSelfTest 7from oeqa.selftest.base import oeSelfTest
6from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_bb_vars 8from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_bb_vars
7import subprocess
8from oeqa.selftest.qemucommand import QemuCommand 9from oeqa.selftest.qemucommand import QemuCommand
9import time 10
11DEFAULT_DIR = 'tmp/deploy/images'
12
10 13
11class SotaToolsTests(oeSelfTest): 14class 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
32class GarageSignTests(oeSelfTest): 30class 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