diff options
-rw-r--r-- | classes/sota_raspberrypi.bbclass | 1 | ||||
-rw-r--r-- | lib/oeqa/selftest/updater.py | 112 | ||||
-rw-r--r-- | recipes-sota/aktualizr/aktualizr_git.bb | 4 |
3 files changed, 79 insertions, 38 deletions
diff --git a/classes/sota_raspberrypi.bbclass b/classes/sota_raspberrypi.bbclass index 51d07b2..f8e7347 100644 --- a/classes/sota_raspberrypi.bbclass +++ b/classes/sota_raspberrypi.bbclass | |||
@@ -3,6 +3,7 @@ PREFERRED_PROVIDER_virtual/bootloader_sota ?= "u-boot" | |||
3 | UBOOT_MACHINE_raspberrypi2_sota ?= "rpi_2_defconfig" | 3 | UBOOT_MACHINE_raspberrypi2_sota ?= "rpi_2_defconfig" |
4 | UBOOT_MACHINE_raspberrypi3_sota ?= "rpi_3_32b_defconfig" | 4 | UBOOT_MACHINE_raspberrypi3_sota ?= "rpi_3_32b_defconfig" |
5 | 5 | ||
6 | IMAGE_FSTYPES_remove_sota = "rpi-sdimg" | ||
6 | OSTREE_BOOTLOADER ?= "u-boot" | 7 | OSTREE_BOOTLOADER ?= "u-boot" |
7 | 8 | ||
8 | # OSTree puts its own boot.scr to bcm2835-bootfiles | 9 | # OSTree puts its own boot.scr to bcm2835-bootfiles |
diff --git a/lib/oeqa/selftest/updater.py b/lib/oeqa/selftest/updater.py index ad99964..e3d4fc3 100644 --- a/lib/oeqa/selftest/updater.py +++ b/lib/oeqa/selftest/updater.py | |||
@@ -118,49 +118,16 @@ class QemuTests(oeSelfTest): | |||
118 | 118 | ||
119 | @classmethod | 119 | @classmethod |
120 | def setUpClass(cls): | 120 | def setUpClass(cls): |
121 | logger = logging.getLogger("selftest") | 121 | cls.qemu, cls.s = qemu_launch(machine='qemux86-64') |
122 | logger.info('Running bitbake to build core-image-minimal') | ||
123 | bitbake('core-image-minimal') | ||
124 | # Create empty object. | ||
125 | args = type('', (), {})() | ||
126 | args.imagename = 'core-image-minimal' | ||
127 | args.mac = None | ||
128 | # Could use DEPLOY_DIR_IMAGE here but it's already in the machine | ||
129 | # subdirectory. | ||
130 | args.dir = 'tmp/deploy/images' | ||
131 | args.efi = False | ||
132 | args.machine = None | ||
133 | args.kvm = None # Autodetect | ||
134 | args.no_gui = True | ||
135 | args.gdb = False | ||
136 | args.pcap = None | ||
137 | args.overlay = None | ||
138 | args.dry_run = False | ||
139 | |||
140 | cls.qemu = QemuCommand(args) | ||
141 | cmdline = cls.qemu.command_line() | ||
142 | print('Booting image with run-qemu-ota...') | ||
143 | cls.s = subprocess.Popen(cmdline) | ||
144 | time.sleep(10) | ||
145 | 122 | ||
146 | @classmethod | 123 | @classmethod |
147 | def tearDownClass(cls): | 124 | def tearDownClass(cls): |
148 | try: | 125 | qemu_terminate(cls.s) |
149 | cls.s.terminate() | ||
150 | except KeyboardInterrupt: | ||
151 | pass | ||
152 | |||
153 | def run_test_qemu(self, command): | ||
154 | command = ['ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no root@localhost -p ' + | ||
155 | str(self.qemu.ssh_port) + ' "' + command + '"'] | ||
156 | s2 = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) | ||
157 | value, err = s2.communicate() | ||
158 | return value, err | ||
159 | 126 | ||
160 | def test_hostname(self): | 127 | def test_hostname(self): |
161 | print('') | 128 | print('') |
162 | print('Checking machine name (hostname) of device:') | 129 | print('Checking machine name (hostname) of device:') |
163 | value, err = self.run_test_qemu('hostname') | 130 | value, err = qemu_send_command(self.qemu.ssh_port, 'hostname') |
164 | machine = get_bb_var('MACHINE', 'core-image-minimal') | 131 | machine = get_bb_var('MACHINE', 'core-image-minimal') |
165 | self.assertEqual(err, b'', 'Error: ' + err.decode()) | 132 | self.assertEqual(err, b'', 'Error: ' + err.decode()) |
166 | # Strip off line ending. | 133 | # Strip off line ending. |
@@ -172,8 +139,79 @@ class QemuTests(oeSelfTest): | |||
172 | def test_var_sota(self): | 139 | def test_var_sota(self): |
173 | print('') | 140 | print('') |
174 | print('Checking contents of /var/sota:') | 141 | print('Checking contents of /var/sota:') |
175 | value, err = self.run_test_qemu('ls /var/sota') | 142 | value, err = qemu_send_command(self.qemu.ssh_port, 'ls /var/sota') |
176 | self.assertEqual(err, b'', 'Error: ' + err.decode()) | 143 | self.assertEqual(err, b'', 'Error: ' + err.decode()) |
177 | print(value.decode()) | 144 | print(value.decode()) |
178 | 145 | ||
146 | class GrubTests(oeSelfTest): | ||
147 | |||
148 | def setUpLocal(self): | ||
149 | # This is a bit of a hack but I can't see a better option. | ||
150 | path = os.path.abspath(os.path.dirname(__file__)) | ||
151 | metadir = path + "/../../../../" | ||
152 | grub_config = 'OSTREE_BOOTLOADER = "grub"\nMACHINE = "intel-corei7-64"' | ||
153 | self.append_config(grub_config) | ||
154 | self.meta_intel = metadir + "meta-intel" | ||
155 | self.meta_minnow = metadir + "meta-updater-minnowboard" | ||
156 | runCmd('bitbake-layers add-layer "%s"' % self.meta_intel) | ||
157 | runCmd('bitbake-layers add-layer "%s"' % self.meta_minnow) | ||
158 | self.qemu, self.s = qemu_launch(efi=True, machine='intel-corei7-64') | ||
159 | |||
160 | def tearDownLocal(self): | ||
161 | qemu_terminate(self.s) | ||
162 | runCmd('bitbake-layers remove-layer "%s"' % self.meta_intel, ignore_status=True) | ||
163 | runCmd('bitbake-layers remove-layer "%s"' % self.meta_minnow, ignore_status=True) | ||
164 | |||
165 | def test_grub(self): | ||
166 | print('') | ||
167 | print('Checking machine name (hostname) of device:') | ||
168 | value, err = qemu_send_command(self.qemu.ssh_port, 'hostname') | ||
169 | machine = get_bb_var('MACHINE', 'core-image-minimal') | ||
170 | self.assertEqual(err, b'', 'Error: ' + err.decode()) | ||
171 | # Strip off line ending. | ||
172 | value_str = value.decode()[:-1] | ||
173 | self.assertEqual(value_str, machine, | ||
174 | 'MACHINE does not match hostname: ' + machine + ', ' + value_str) | ||
175 | print(value_str) | ||
176 | |||
177 | |||
178 | def qemu_launch(efi=False, machine=None): | ||
179 | logger = logging.getLogger("selftest") | ||
180 | logger.info('Running bitbake to build core-image-minimal') | ||
181 | bitbake('core-image-minimal') | ||
182 | # Create empty object. | ||
183 | args = type('', (), {})() | ||
184 | args.imagename = 'core-image-minimal' | ||
185 | args.mac = None | ||
186 | # Could use DEPLOY_DIR_IMAGE here but it's already in the machine | ||
187 | # subdirectory. | ||
188 | args.dir = 'tmp/deploy/images' | ||
189 | args.efi = efi | ||
190 | args.machine = machine | ||
191 | args.kvm = None # Autodetect | ||
192 | args.no_gui = True | ||
193 | args.gdb = False | ||
194 | args.pcap = None | ||
195 | args.overlay = None | ||
196 | args.dry_run = False | ||
197 | |||
198 | qemu = QemuCommand(args) | ||
199 | cmdline = qemu.command_line() | ||
200 | print('Booting image with run-qemu-ota...') | ||
201 | s = subprocess.Popen(cmdline) | ||
202 | time.sleep(10) | ||
203 | return qemu, s | ||
204 | |||
205 | def qemu_terminate(s): | ||
206 | try: | ||
207 | s.terminate() | ||
208 | except KeyboardInterrupt: | ||
209 | pass | ||
210 | |||
211 | def qemu_send_command(port, command): | ||
212 | command = ['ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no root@localhost -p ' + | ||
213 | str(port) + ' "' + command + '"'] | ||
214 | s2 = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) | ||
215 | value, err = s2.communicate() | ||
216 | return value, err | ||
179 | 217 | ||
diff --git a/recipes-sota/aktualizr/aktualizr_git.bb b/recipes-sota/aktualizr/aktualizr_git.bb index 6c4b57c..140a670 100644 --- a/recipes-sota/aktualizr/aktualizr_git.bb +++ b/recipes-sota/aktualizr/aktualizr_git.bb | |||
@@ -18,7 +18,7 @@ PR = "7" | |||
18 | SRC_URI = " \ | 18 | SRC_URI = " \ |
19 | git://github.com/advancedtelematic/aktualizr;branch=${BRANCH} \ | 19 | git://github.com/advancedtelematic/aktualizr;branch=${BRANCH} \ |
20 | " | 20 | " |
21 | SRCREV = "5c871180bc3c1f845d0e95e6f4876a581ed0f919" | 21 | SRCREV = "860553a1c98513bf43f6ce98491bf65addcf7e48" |
22 | BRANCH ?= "master" | 22 | BRANCH ?= "master" |
23 | 23 | ||
24 | S = "${WORKDIR}/git" | 24 | S = "${WORKDIR}/git" |
@@ -39,10 +39,12 @@ do_install_append_class-target () { | |||
39 | } | 39 | } |
40 | do_install_append_class-native () { | 40 | do_install_append_class-native () { |
41 | rm -f ${D}${bindir}/aktualizr | 41 | rm -f ${D}${bindir}/aktualizr |
42 | rm -f ${D}${bindir}/aktualizr-info | ||
42 | } | 43 | } |
43 | 44 | ||
44 | FILES_${PN}_class-target = " \ | 45 | FILES_${PN}_class-target = " \ |
45 | ${bindir}/aktualizr \ | 46 | ${bindir}/aktualizr \ |
47 | ${bindir}/aktualizr-info \ | ||
46 | " | 48 | " |
47 | FILES_${PN}_class-native = " \ | 49 | FILES_${PN}_class-native = " \ |
48 | ${bindir}/aktualizr_implicit_writer \ | 50 | ${bindir}/aktualizr_implicit_writer \ |