From 20f557beb31d5a9d3065b4fe980e9ca2b5bfa312 Mon Sep 17 00:00:00 2001 From: Laurent Bonnans Date: Tue, 9 Jul 2019 12:06:22 +0200 Subject: Fix some oe-selftest timeouts issues Was causing problems on CI Signed-off-by: Laurent Bonnans --- lib/oeqa/selftest/cases/testutils.py | 2 +- lib/oeqa/selftest/cases/updater_qemux86_64.py | 18 +++++++++++------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/lib/oeqa/selftest/cases/testutils.py b/lib/oeqa/selftest/cases/testutils.py index e67f30c..208f822 100644 --- a/lib/oeqa/selftest/cases/testutils.py +++ b/lib/oeqa/selftest/cases/testutils.py @@ -61,7 +61,7 @@ def qemu_bake_image(imagename): bitbake(imagename) -def qemu_send_command(port, command, timeout=60): +def qemu_send_command(port, command, timeout=120): 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) diff --git a/lib/oeqa/selftest/cases/updater_qemux86_64.py b/lib/oeqa/selftest/cases/updater_qemux86_64.py index 7228529..033b224 100644 --- a/lib/oeqa/selftest/cases/updater_qemux86_64.py +++ b/lib/oeqa/selftest/cases/updater_qemux86_64.py @@ -2,6 +2,7 @@ import os import logging import re +import subprocess import unittest from time import sleep from uuid import uuid4 @@ -307,8 +308,8 @@ class IpSecondaryTests(OESelftestTestCase): self.configure() qemu_bake_image(self.imagename) - def send_command(self, cmd): - stdout, stderr, retcode = qemu_send_command(self.qemu.ssh_port, cmd, timeout=60) + def send_command(self, cmd, timeout=60): + stdout, stderr, retcode = qemu_send_command(self.qemu.ssh_port, cmd, timeout=timeout) return str(stdout), str(stderr), retcode def __enter__(self): @@ -323,7 +324,7 @@ class IpSecondaryTests(OESelftestTestCase): def wait_till_sshable(self): # qemu_send_command tries to ssh into the qemu VM and blocks until it gets there or timeout happens # so it helps us to block q control flow until the VM is booted and a target binary/daemon is running there - self.stdout, self.stderr, self.retcode = self.send_command(self.binaryname + ' --help') + self.stdout, self.stderr, self.retcode = self.send_command(self.binaryname + ' --help', timeout=300) def was_successfully_booted(self): return self.retcode == 0 @@ -445,10 +446,13 @@ class ResourceControlTests(OESelftestTestCase): ran_ok = False for delay in [5, 5, 5, 5]: sleep(delay) - stdout, stderr, retcode = self.qemu_command('systemctl --no-pager show aktualizr') - if retcode == 0 and b'ExecMainStatus=9' in stdout: - ran_ok = True - break + try: + stdout, stderr, retcode = self.qemu_command('systemctl --no-pager show aktualizr') + if retcode == 0 and b'ExecMainStatus=9' in stdout: + ran_ok = True + break + except subprocess.TimeoutExpired: + pass self.assertTrue(ran_ok, 'Aktualizr was not killed') self.assertIn(b'CPUWeight=1000', stdout, 'CPUWeight was not set correctly') -- cgit v1.2.3-54-g00ecf