From f47d2d8deeccb56f839035c383c68da6558c5d9c Mon Sep 17 00:00:00 2001 From: Laurent Bonnans Date: Thu, 21 Mar 2019 17:30:55 +0100 Subject: Add oe-selftest for aktualizr ptest run on qemu Signed-off-by: Laurent Bonnans --- lib/oeqa/selftest/cases/testutils.py | 4 +- .../selftest/cases/updater_qemux86_64_ptest.py | 52 ++++++++++++++++++++++ 2 files changed, 54 insertions(+), 2 deletions(-) create mode 100644 lib/oeqa/selftest/cases/updater_qemux86_64_ptest.py diff --git a/lib/oeqa/selftest/cases/testutils.py b/lib/oeqa/selftest/cases/testutils.py index 90ba653..2ad99ad 100644 --- a/lib/oeqa/selftest/cases/testutils.py +++ b/lib/oeqa/selftest/cases/testutils.py @@ -52,11 +52,11 @@ def qemu_terminate(s): pass -def qemu_send_command(port, command): +def qemu_send_command(port, command, timeout=60): command = ['ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no root@localhost -p ' + str(port) + ' "' + command + '"'] s2 = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - stdout, stderr = s2.communicate(timeout=60) + stdout, stderr = s2.communicate(timeout=timeout) return stdout, stderr, s2.returncode diff --git a/lib/oeqa/selftest/cases/updater_qemux86_64_ptest.py b/lib/oeqa/selftest/cases/updater_qemux86_64_ptest.py new file mode 100644 index 0000000..8ac6443 --- /dev/null +++ b/lib/oeqa/selftest/cases/updater_qemux86_64_ptest.py @@ -0,0 +1,52 @@ +# pylint: disable=C0111,C0325 +import os +import re + +from oeqa.selftest.case import OESelftestTestCase +from oeqa.utils.commands import runCmd +from testutils import qemu_launch, qemu_send_command, qemu_terminate + + +class PtestTests(OESelftestTestCase): + + def setUpLocal(self): + layer = "meta-updater-qemux86-64" + result = runCmd('bitbake-layers show-layers') + if re.search(layer, result.output) is None: + # Assume the directory layout for finding other layers. We could also + # make assumptions by using 'show-layers', but either way, if the + # layers we need aren't where we expect them, we are out of like. + path = os.path.abspath(os.path.dirname(__file__)) + metadir = path + "/../../../../../" + self.meta_qemu = metadir + layer + runCmd('bitbake-layers add-layer "%s"' % self.meta_qemu) + else: + self.meta_qemu = None + self.append_config('MACHINE = "qemux86-64"') + self.append_config('SYSTEMD_AUTO_ENABLE_aktualizr = "disable"') + self.append_config('PTEST_ENABLED_pn-aktualizr = "1"') + self.append_config('IMAGE_INSTALL_append += "aktualizr-ptest ptest-runner "') + self.qemu, self.s = qemu_launch(machine='qemux86-64') + + def tearDownLocal(self): + qemu_terminate(self.s) + if self.meta_qemu: + runCmd('bitbake-layers remove-layer "%s"' % self.meta_qemu, ignore_status=True) + + def qemu_command(self, command, timeout=60): + return qemu_send_command(self.qemu.ssh_port, command, timeout=timeout) + + def test_run_ptests(self): + # logger = logging.getLogger("selftest") + stdout, stderr, retcode = self.qemu_command('ptest-runner', timeout=None) + output = stdout.decode() + print(output) + self.assertEqual(retcode, 0) + + has_failure = re.search('^FAIL', output, flags=re.MULTILINE) is not None + if has_failure: + print("Full test suite log:") + stdout, stderr, retcode = self.qemu_command('cat /tmp/aktualizr-ptest.log', timeout=None) + print(stdout.decode()) + + self.assertFalse(has_failure) -- cgit v1.2.3-54-g00ecf From ca62e64dd6f379cfe2e04c7240eec418df14c27c Mon Sep 17 00:00:00 2001 From: Laurent Bonnans Date: Wed, 10 Apr 2019 10:23:06 +0200 Subject: Fix problem with lshw for aktualizr ptest lshw is installed in `/usr/sbin` which does not appear when a command is launched outside a non-login shell. Signed-off-by: Laurent Bonnans --- lib/oeqa/selftest/cases/updater_qemux86_64_ptest.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/oeqa/selftest/cases/updater_qemux86_64_ptest.py b/lib/oeqa/selftest/cases/updater_qemux86_64_ptest.py index 8ac6443..a04032c 100644 --- a/lib/oeqa/selftest/cases/updater_qemux86_64_ptest.py +++ b/lib/oeqa/selftest/cases/updater_qemux86_64_ptest.py @@ -37,8 +37,8 @@ class PtestTests(OESelftestTestCase): return qemu_send_command(self.qemu.ssh_port, command, timeout=timeout) def test_run_ptests(self): - # logger = logging.getLogger("selftest") - stdout, stderr, retcode = self.qemu_command('ptest-runner', timeout=None) + # simulate a login shell, so that /usr/sbin is in $PATH (from /etc/profile) + stdout, stderr, retcode = self.qemu_command('sh -l -c ptest-runner', timeout=None) output = stdout.decode() print(output) self.assertEqual(retcode, 0) -- cgit v1.2.3-54-g00ecf From a6ac2a02ff672986a5f49d8b2405c7ababbab4a2 Mon Sep 17 00:00:00 2001 From: Laurent Bonnans Date: Wed, 10 Apr 2019 10:14:45 +0200 Subject: Add openssl-bin as a aktualizr-ptest requirement Signed-off-by: Laurent Bonnans --- recipes-sota/aktualizr/aktualizr_git.bb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes-sota/aktualizr/aktualizr_git.bb b/recipes-sota/aktualizr/aktualizr_git.bb index f2f62b5..9053462 100755 --- a/recipes-sota/aktualizr/aktualizr_git.bb +++ b/recipes-sota/aktualizr/aktualizr_git.bb @@ -11,7 +11,7 @@ RDEPENDS_${PN}_class-target = "aktualizr-check-discovery aktualizr-configs lshw" RDEPENDS_${PN}-secondary = "aktualizr-check-discovery" RDEPENDS_${PN}-host-tools = "aktualizr aktualizr-repo aktualizr-cert-provider ${@bb.utils.contains('PACKAGECONFIG', 'sota-tools', 'garage-deploy garage-push', '', d)}" -RDEPENDS_${PN}-ptest += "bash cmake curl python3-modules sqlite3 valgrind" +RDEPENDS_${PN}-ptest += "bash cmake curl python3-modules openssl-bin sqlite3 valgrind" PV = "1.0+git${SRCPV}" PR = "7" -- cgit v1.2.3-54-g00ecf From f501bb9ec8a57bc0f223c6e132041666c96e74f3 Mon Sep 17 00:00:00 2001 From: Laurent Bonnans Date: Wed, 10 Apr 2019 10:15:08 +0200 Subject: Parametrizable AKTUALIZR_PTEST_PARALLEL_LEVEL Signed-off-by: Laurent Bonnans --- recipes-sota/aktualizr/files/run-ptest | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/recipes-sota/aktualizr/files/run-ptest b/recipes-sota/aktualizr/files/run-ptest index e5f0d56..ff441f9 100755 --- a/recipes-sota/aktualizr/files/run-ptest +++ b/recipes-sota/aktualizr/files/run-ptest @@ -1,6 +1,8 @@ #!/bin/sh -set -e +set -eu + +AKTUALIZR_PTEST_PARALLEL_LEVEL=${AKTUALIZR_PTEST_PARALLEL_LEVEL:-2} filter_logs() { awk '/^.*Test[[:space:]]*#[[:digit:]]+:/ { @@ -13,4 +15,4 @@ filter_logs() { } cd build -ctest -j 8 -O /tmp/aktualizr-ptest.log --output-on-failure -LE 'noptest' 2> /dev/null | filter_logs +ctest -j "$AKTUALIZR_PTEST_PARALLEL_LEVEL" -O /tmp/aktualizr-ptest.log --output-on-failure -LE 'noptest' 2> /dev/null | filter_logs -- cgit v1.2.3-54-g00ecf From 0fc4b230a30da1cb16dac2fb66eb132159a4598b Mon Sep 17 00:00:00 2001 From: Laurent Bonnans Date: Wed, 10 Apr 2019 14:42:13 +0200 Subject: Use PARALLEL_MAKE when building aktualizr-ptest The trick to add it in do_compile from cmake.bbclass does not work with do_compile_ptest_base Signed-off-by: Laurent Bonnans --- recipes-sota/aktualizr/aktualizr_git.bb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes-sota/aktualizr/aktualizr_git.bb b/recipes-sota/aktualizr/aktualizr_git.bb index 9053462..89ce052 100755 --- a/recipes-sota/aktualizr/aktualizr_git.bb +++ b/recipes-sota/aktualizr/aktualizr_git.bb @@ -73,7 +73,7 @@ RESOURCE_MEMORY_HIGH = "100M" RESOURCE_MEMORY_MAX = "80%" do_compile_ptest() { - cmake_runcmake_build --target build_tests + cmake_runcmake_build --target build_tests "${PARALLEL_MAKE}" } do_install_ptest() { -- cgit v1.2.3-54-g00ecf From ff4ef176490bb9f6234a4ed475f1daaf8587c7f9 Mon Sep 17 00:00:00 2001 From: Laurent Bonnans Date: Mon, 15 Apr 2019 12:09:49 +0200 Subject: Bump aktualizr and garage tools Signed-off-by: Laurent Bonnans --- recipes-sota/aktualizr/aktualizr_git.bb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/recipes-sota/aktualizr/aktualizr_git.bb b/recipes-sota/aktualizr/aktualizr_git.bb index 89ce052..64382d8 100755 --- a/recipes-sota/aktualizr/aktualizr_git.bb +++ b/recipes-sota/aktualizr/aktualizr_git.bb @@ -16,7 +16,7 @@ RDEPENDS_${PN}-ptest += "bash cmake curl python3-modules openssl-bin sqlite3 val PV = "1.0+git${SRCPV}" PR = "7" -GARAGE_SIGN_PV = "0.6.0-3-gc38b9f3" +GARAGE_SIGN_PV = "0.6.0-18-g5b8b259" SRC_URI = " \ gitsm://github.com/advancedtelematic/aktualizr;branch=${BRANCH} \ @@ -30,10 +30,10 @@ SRC_URI = " \ " # for garage-sign archive -SRC_URI[md5sum] = "30d7f0931e2236954679e75d1bae174f" -SRC_URI[sha256sum] = "46d8c6448ce14cbb9af6a93eba7e29d38579e566dcd6518d22f723a8da16cad5" +SRC_URI[md5sum] = "c5e9968dfe78a7264ab9a8338c11725d" +SRC_URI[sha256sum] = "3a19258d7a1825a308aca0da82f7a337985bec05e8951355c4c95f0fcf2444f4" -SRCREV = "2e3ccbbdd43fdf70eb815454ea64f0bd8085856c" +SRCREV = "9c5ef10b7b91cc7d51cd22fc60446e734cf84690" BRANCH ?= "master" S = "${WORKDIR}/git" -- cgit v1.2.3-54-g00ecf