summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Vacek <patrickvacek@gmail.com>2018-02-14 17:08:52 +0100
committerPatrick Vacek <patrickvacek@gmail.com>2018-02-20 11:01:34 +0100
commit7bcbb8046672ff66ca7aa0bdf48460d1a11000c3 (patch)
tree4eee56ef7b41024a1cbdd79647bcdba72ef6de2c
parent9a404b4e60c3a9166d98491fed778c64a67150bc (diff)
downloadmeta-updater-7bcbb8046672ff66ca7aa0bdf48460d1a11000c3.tar.gz
Test that implicit_writer and cert_provider work.
This required setting the LD_LIBRARY_PATH to get some dependencies that are liable to conflict with the host's normal installation. I adapted that for the sota_tools tests as well for good measure. Also, we now actually install cert_provider in the native build.
-rw-r--r--lib/oeqa/selftest/updater.py42
-rw-r--r--recipes-sota/aktualizr/aktualizr_git.bb3
2 files changed, 32 insertions, 13 deletions
diff --git a/lib/oeqa/selftest/updater.py b/lib/oeqa/selftest/updater.py
index 7e8a615..9a3efee 100644
--- a/lib/oeqa/selftest/updater.py
+++ b/lib/oeqa/selftest/updater.py
@@ -19,24 +19,27 @@ class SotaToolsTests(oeSelfTest):
19 bitbake('aktualizr-native') 19 bitbake('aktualizr-native')
20 20
21 def test_push_help(self): 21 def test_push_help(self):
22 bb_vars = get_bb_vars(['SYSROOT_DESTDIR', 'bindir'], 'aktualizr-native') 22 bb_vars = get_bb_vars(['SYSROOT_DESTDIR', 'bindir', 'libdir'], 'aktualizr-native')
23 p = bb_vars['SYSROOT_DESTDIR'] + bb_vars['bindir'] + "/" + "garage-push" 23 l = bb_vars['libdir']
24 p = bb_vars['SYSROOT_DESTDIR'] + bb_vars['bindir'] + "/garage-push"
24 self.assertTrue(os.path.isfile(p), msg = "No garage-push found (%s)" % p) 25 self.assertTrue(os.path.isfile(p), msg = "No garage-push found (%s)" % p)
25 result = runCmd('%s --help' % p, ignore_status=True) 26 result = runCmd('LD_LIBRARY_PATH=%s %s --help' % (l, p), ignore_status=True)
26 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)
27 28
28 def test_deploy_help(self): 29 def test_deploy_help(self):
29 bb_vars = get_bb_vars(['SYSROOT_DESTDIR', 'bindir'], 'aktualizr-native') 30 bb_vars = get_bb_vars(['SYSROOT_DESTDIR', 'bindir', 'libdir'], 'aktualizr-native')
30 p = bb_vars['SYSROOT_DESTDIR'] + bb_vars['bindir'] + "/" + "garage-deploy" 31 l = bb_vars['libdir']
32 p = bb_vars['SYSROOT_DESTDIR'] + bb_vars['bindir'] + "/garage-deploy"
31 self.assertTrue(os.path.isfile(p), msg = "No garage-deploy found (%s)" % p) 33 self.assertTrue(os.path.isfile(p), msg = "No garage-deploy found (%s)" % p)
32 result = runCmd('%s --help' % p, ignore_status=True) 34 result = runCmd('LD_LIBRARY_PATH=%s %s --help' % (l, p), ignore_status=True)
33 self.assertEqual(result.status, 0, "Status not equal to 0. output: %s" % result.output) 35 self.assertEqual(result.status, 0, "Status not equal to 0. output: %s" % result.output)
34 36
35 def test_garagesign_help(self): 37 def test_garagesign_help(self):
36 bb_vars = get_bb_vars(['SYSROOT_DESTDIR', 'bindir'], 'aktualizr-native') 38 bb_vars = get_bb_vars(['SYSROOT_DESTDIR', 'bindir', 'libdir'], 'aktualizr-native')
37 p = bb_vars['SYSROOT_DESTDIR'] + bb_vars['bindir'] + "/" + "garage-sign" 39 l = bb_vars['libdir']
40 p = bb_vars['SYSROOT_DESTDIR'] + bb_vars['bindir'] + "/garage-sign"
38 self.assertTrue(os.path.isfile(p), msg = "No garage-sign found (%s)" % p) 41 self.assertTrue(os.path.isfile(p), msg = "No garage-sign found (%s)" % p)
39 result = runCmd('%s --help' % p, ignore_status=True) 42 result = runCmd('LD_LIBRARY_PATH=%s %s --help' % (l, p), ignore_status=True)
40 self.assertEqual(result.status, 0, "Status not equal to 0. output: %s" % result.output) 43 self.assertEqual(result.status, 0, "Status not equal to 0. output: %s" % result.output)
41 44
42class HsmTests(oeSelfTest): 45class HsmTests(oeSelfTest):
@@ -76,6 +79,22 @@ class GeneralTests(oeSelfTest):
76 result = runCmd('which java', ignore_status=True) 79 result = runCmd('which java', ignore_status=True)
77 self.assertEqual(result.status, 0, "Java not found.") 80 self.assertEqual(result.status, 0, "Java not found.")
78 81
82 def test_implicit_writer_help(self):
83 bb_vars = get_bb_vars(['SYSROOT_DESTDIR', 'bindir', 'libdir'], 'aktualizr-native')
84 l = bb_vars['libdir']
85 p = bb_vars['SYSROOT_DESTDIR'] + bb_vars['bindir'] + "/aktualizr_implicit_writer"
86 self.assertTrue(os.path.isfile(p), msg = "No aktualizr_implicit_writer found (%s)" % p)
87 result = runCmd('LD_LIBRARY_PATH=%s %s --help' % (l, p), ignore_status=True)
88 self.assertEqual(result.status, 0, "Status not equal to 0. output: %s" % result.output)
89
90 def test_cert_provider_help(self):
91 bb_vars = get_bb_vars(['SYSROOT_DESTDIR', 'bindir', 'libdir'], 'aktualizr-native')
92 l = bb_vars['libdir']
93 p = bb_vars['SYSROOT_DESTDIR'] + bb_vars['bindir'] + "/aktualizr_cert_provider"
94 self.assertTrue(os.path.isfile(p), msg = "No aktualizr_cert_provider found (%s)" % p)
95 result = runCmd('LD_LIBRARY_PATH=%s %s --help' % (l, p), ignore_status=True)
96 self.assertEqual(result.status, 0, "Status not equal to 0. output: %s" % result.output)
97
79 def test_add_package(self): 98 def test_add_package(self):
80 print('') 99 print('')
81 deploydir = get_bb_var('DEPLOY_DIR_IMAGE') 100 deploydir = get_bb_var('DEPLOY_DIR_IMAGE')
@@ -152,9 +171,8 @@ class QemuTests(oeSelfTest):
152 break 171 break
153 except IOError as e: 172 except IOError as e:
154 print(e) 173 print(e)
155 if not ran_ok: 174 self.assertTrue(ran_ok, 'aktualizr-info failed: ' + stdout.decode() + stderr.decode())
156 print(stdout.decode()) 175
157 print(stderr.decode())
158 176
159class GrubTests(oeSelfTest): 177class GrubTests(oeSelfTest):
160 178
diff --git a/recipes-sota/aktualizr/aktualizr_git.bb b/recipes-sota/aktualizr/aktualizr_git.bb
index 0194dbb..bcc1438 100644
--- a/recipes-sota/aktualizr/aktualizr_git.bb
+++ b/recipes-sota/aktualizr/aktualizr_git.bb
@@ -37,10 +37,10 @@ EXTRA_OECMAKE_append_class-target = " -DBUILD_OSTREE=ON -DBUILD_ISOTP=ON ${@bb.u
37EXTRA_OECMAKE_append_class-native = " -DBUILD_SOTA_TOOLS=ON -DBUILD_OSTREE=OFF " 37EXTRA_OECMAKE_append_class-native = " -DBUILD_SOTA_TOOLS=ON -DBUILD_OSTREE=OFF "
38 38
39do_install_append () { 39do_install_append () {
40 rm -f ${D}${bindir}/aktualizr_cert_provider
41 rm -fr ${D}${libdir}/systemd 40 rm -fr ${D}${libdir}/systemd
42} 41}
43do_install_append_class-target () { 42do_install_append_class-target () {
43 rm -f ${D}${bindir}/aktualizr_cert_provider
44 rm -f ${D}${bindir}/aktualizr_implicit_writer 44 rm -f ${D}${bindir}/aktualizr_implicit_writer
45 rm -f ${D}${libdir}/sota/sota.toml 45 rm -f ${D}${libdir}/sota/sota.toml
46 ${@bb.utils.contains('SOTA_CLIENT_FEATURES', 'secondary-example', '', 'rm -f ${D}${bindir}/example-interface', d)} 46 ${@bb.utils.contains('SOTA_CLIENT_FEATURES', 'secondary-example', '', 'rm -f ${D}${bindir}/example-interface', d)}
@@ -76,6 +76,7 @@ FILES_${PN}_class-target = " \
76FILES_${PN}_append_class-target = " ${@bb.utils.contains('SOTA_CLIENT_FEATURES', 'secondary-example', ' ${bindir}/example-interface', '', d)} " 76FILES_${PN}_append_class-target = " ${@bb.utils.contains('SOTA_CLIENT_FEATURES', 'secondary-example', ' ${bindir}/example-interface', '', d)} "
77FILES_${PN}_append_class-target = " ${@bb.utils.contains('SOTA_CLIENT_FEATURES', 'secondary-isotp-example', ' ${bindir}/isotp-test-interface', '', d)} " 77FILES_${PN}_append_class-target = " ${@bb.utils.contains('SOTA_CLIENT_FEATURES', 'secondary-isotp-example', ' ${bindir}/isotp-test-interface', '', d)} "
78FILES_${PN}_class-native = " \ 78FILES_${PN}_class-native = " \
79 ${bindir}/aktualizr_cert_provider \
79 ${bindir}/aktualizr_implicit_writer \ 80 ${bindir}/aktualizr_implicit_writer \
80 ${bindir}/garage-deploy \ 81 ${bindir}/garage-deploy \
81 ${bindir}/garage-push \ 82 ${bindir}/garage-push \