public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
* [PATCH 00/10] oeqa: some minor fixes and cleanups
@ 2023-03-31 10:26 Enrico Jorns
  2023-03-31 10:26 ` [PATCH 01/10] oeqa/selftest/cases/runqemu: update imports Enrico Jorns
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: Enrico Jorns @ 2023-03-31 10:26 UTC (permalink / raw)
  To: openembedded-core; +Cc: yocto, ejo

This is a collection of minor fixes and cleanups I came across when
digging through oeqa code.

Enrico Jorns (10):
  oeqa/selftest/cases/runqemu: update imports
  oeqa/targetcontrol: fix misspelled RuntimeError
  oeqa/targetcontrol: do not set dump_host_cmds redundantly
  oeqa/targetcontrol: remove unused imports
  oeqa/utils/commands: fix usage of undefined EPIPE
  oeqa/utils/commands: remove unused imports
  oeqa/utils/qemurunner: replace hard-coded user 'root' in debug output
  oeqa/utils/qemurunner: limit precision of timing debugging output
  oeqa/utils/qemurunner: fix undefined TimeoutExpired
  oeqa: whitespace and indentation cleanups

 meta/lib/oeqa/selftest/cases/runqemu.py | 16 ++++++------
 meta/lib/oeqa/targetcontrol.py          | 12 +++------
 meta/lib/oeqa/utils/commands.py         |  8 +++---
 meta/lib/oeqa/utils/qemurunner.py       | 34 ++++++++++++-------------
 4 files changed, 32 insertions(+), 38 deletions(-)

-- 
2.39.2



^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 01/10] oeqa/selftest/cases/runqemu: update imports
  2023-03-31 10:26 [PATCH 00/10] oeqa: some minor fixes and cleanups Enrico Jorns
@ 2023-03-31 10:26 ` Enrico Jorns
  2023-03-31 10:26 ` [PATCH 02/10] oeqa/targetcontrol: fix misspelled RuntimeError Enrico Jorns
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Enrico Jorns @ 2023-03-31 10:26 UTC (permalink / raw)
  To: openembedded-core; +Cc: yocto, ejo

'tempfile' and 'oeqa.utils.command.runCmd' are unused while 'os' is
actually used.

Signed-off-by: Enrico Jorns <ejo@pengutronix.de>
---
 meta/lib/oeqa/selftest/cases/runqemu.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/meta/lib/oeqa/selftest/cases/runqemu.py b/meta/lib/oeqa/selftest/cases/runqemu.py
index e72ff529c4..af45c048a4 100644
--- a/meta/lib/oeqa/selftest/cases/runqemu.py
+++ b/meta/lib/oeqa/selftest/cases/runqemu.py
@@ -4,14 +4,14 @@
 # SPDX-License-Identifier: MIT
 #
 
+import os
 import re
-import tempfile
 import time
 import oe.types
 from oeqa.core.decorator import OETestTag
 from oeqa.core.decorator.data import skipIfNotArch, skipIfNotMachine
 from oeqa.selftest.case import OESelftestTestCase
-from oeqa.utils.commands import bitbake, runqemu, get_bb_var, runCmd
+from oeqa.utils.commands import bitbake, runqemu, get_bb_var
 
 @OETestTag("runqemu")
 class RunqemuTests(OESelftestTestCase):
-- 
2.39.2



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 02/10] oeqa/targetcontrol: fix misspelled RuntimeError
  2023-03-31 10:26 [PATCH 00/10] oeqa: some minor fixes and cleanups Enrico Jorns
  2023-03-31 10:26 ` [PATCH 01/10] oeqa/selftest/cases/runqemu: update imports Enrico Jorns
@ 2023-03-31 10:26 ` Enrico Jorns
  2023-03-31 10:26 ` [PATCH 03/10] oeqa/targetcontrol: do not set dump_host_cmds redundantly Enrico Jorns
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Enrico Jorns @ 2023-03-31 10:26 UTC (permalink / raw)
  To: openembedded-core; +Cc: yocto, ejo

Signed-off-by: Enrico Jorns <ejo@pengutronix.de>
---
 meta/lib/oeqa/targetcontrol.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/lib/oeqa/targetcontrol.py b/meta/lib/oeqa/targetcontrol.py
index 1fdff82889..b8d4ea8a70 100644
--- a/meta/lib/oeqa/targetcontrol.py
+++ b/meta/lib/oeqa/targetcontrol.py
@@ -205,7 +205,7 @@ class QemuTarget(BaseTarget):
             self.server_ip = self.runner.server_ip
             self.connection = SSHControl(ip=self.ip, logfile=self.sshlog)
         else:
-            raise RuntimError("%s - FAILED to re-start qemu - check the task log and the boot log" % self.pn)
+            raise RuntimeError("%s - FAILED to re-start qemu - check the task log and the boot log" % self.pn)
 
     def run_serial(self, command, timeout=60):
         return self.runner.run_serial(command, timeout=timeout)
-- 
2.39.2



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 03/10] oeqa/targetcontrol: do not set dump_host_cmds redundantly
  2023-03-31 10:26 [PATCH 00/10] oeqa: some minor fixes and cleanups Enrico Jorns
  2023-03-31 10:26 ` [PATCH 01/10] oeqa/selftest/cases/runqemu: update imports Enrico Jorns
  2023-03-31 10:26 ` [PATCH 02/10] oeqa/targetcontrol: fix misspelled RuntimeError Enrico Jorns
@ 2023-03-31 10:26 ` Enrico Jorns
  2023-03-31 10:26 ` [PATCH 04/10] oeqa/targetcontrol: remove unused imports Enrico Jorns
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Enrico Jorns @ 2023-03-31 10:26 UTC (permalink / raw)
  To: openembedded-core; +Cc: yocto, ejo

This is already set above, thus simply use the set value from there.

Signed-off-by: Enrico Jorns <ejo@pengutronix.de>
---
 meta/lib/oeqa/targetcontrol.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/lib/oeqa/targetcontrol.py b/meta/lib/oeqa/targetcontrol.py
index b8d4ea8a70..bc6b91e994 100644
--- a/meta/lib/oeqa/targetcontrol.py
+++ b/meta/lib/oeqa/targetcontrol.py
@@ -145,7 +145,7 @@ class QemuTarget(BaseTarget):
                             boottime = int(d.getVar("TEST_QEMUBOOT_TIMEOUT")),
                             use_kvm = use_kvm,
                             dump_dir = dump_dir,
-                            dump_host_cmds = d.getVar("testimage_dump_host"),
+                            dump_host_cmds = dump_host_cmds,
                             logger = logger,
                             tmpfsdir = d.getVar("RUNQEMU_TMPFS_DIR"),
                             serial_ports = len(d.getVar("SERIAL_CONSOLES").split()))
-- 
2.39.2



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 04/10] oeqa/targetcontrol: remove unused imports
  2023-03-31 10:26 [PATCH 00/10] oeqa: some minor fixes and cleanups Enrico Jorns
                   ` (2 preceding siblings ...)
  2023-03-31 10:26 ` [PATCH 03/10] oeqa/targetcontrol: do not set dump_host_cmds redundantly Enrico Jorns
@ 2023-03-31 10:26 ` Enrico Jorns
  2023-03-31 10:26 ` [PATCH 05/10] oeqa/utils/commands: fix usage of undefined EPIPE Enrico Jorns
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Enrico Jorns @ 2023-03-31 10:26 UTC (permalink / raw)
  To: openembedded-core; +Cc: yocto, ejo

Signed-off-by: Enrico Jorns <ejo@pengutronix.de>
---
 meta/lib/oeqa/targetcontrol.py | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/meta/lib/oeqa/targetcontrol.py b/meta/lib/oeqa/targetcontrol.py
index bc6b91e994..f5f2ce2f12 100644
--- a/meta/lib/oeqa/targetcontrol.py
+++ b/meta/lib/oeqa/targetcontrol.py
@@ -7,18 +7,14 @@
 # This module is used by testimage.bbclass for setting up and controlling a target machine.
 
 import os
-import shutil
 import subprocess
 import bb
-import traceback
-import sys
 import logging
 from oeqa.utils.sshcontrol import SSHControl
 from oeqa.utils.qemurunner import QemuRunner
 from oeqa.utils.qemutinyrunner import QemuTinyRunner
 from oeqa.utils.dump import TargetDumper
 from oeqa.utils.dump import MonitorDumper
-from oeqa.controllers.testtargetloader import TestTargetLoader
 from abc import ABCMeta, abstractmethod
 
 class BaseTarget(object, metaclass=ABCMeta):
-- 
2.39.2



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 05/10] oeqa/utils/commands: fix usage of undefined EPIPE
  2023-03-31 10:26 [PATCH 00/10] oeqa: some minor fixes and cleanups Enrico Jorns
                   ` (3 preceding siblings ...)
  2023-03-31 10:26 ` [PATCH 04/10] oeqa/targetcontrol: remove unused imports Enrico Jorns
@ 2023-03-31 10:26 ` Enrico Jorns
  2023-03-31 10:26 ` [PATCH 06/10] oeqa/utils/commands: remove unused imports Enrico Jorns
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Enrico Jorns @ 2023-03-31 10:26 UTC (permalink / raw)
  To: openembedded-core; +Cc: yocto, ejo

Signed-off-by: Enrico Jorns <ejo@pengutronix.de>
---
 meta/lib/oeqa/utils/commands.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/meta/lib/oeqa/utils/commands.py b/meta/lib/oeqa/utils/commands.py
index f4daea2507..84c463328f 100644
--- a/meta/lib/oeqa/utils/commands.py
+++ b/meta/lib/oeqa/utils/commands.py
@@ -21,6 +21,7 @@ from oeqa.utils import CommandError
 from oeqa.utils import ftools
 import re
 import contextlib
+import errno
 # Export test doesn't require bb
 try:
     import bb
@@ -85,7 +86,7 @@ class Command(object):
             except OSError as ex:
                 # It's not an error when the command does not consume all
                 # of our data. subprocess.communicate() also ignores that.
-                if ex.errno != EPIPE:
+                if ex.errno != errno.EPIPE:
                     raise
 
         # We write in a separate thread because then we can read
-- 
2.39.2



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 06/10] oeqa/utils/commands: remove unused imports
  2023-03-31 10:26 [PATCH 00/10] oeqa: some minor fixes and cleanups Enrico Jorns
                   ` (4 preceding siblings ...)
  2023-03-31 10:26 ` [PATCH 05/10] oeqa/utils/commands: fix usage of undefined EPIPE Enrico Jorns
@ 2023-03-31 10:26 ` Enrico Jorns
  2023-03-31 10:26 ` [PATCH 07/10] oeqa/utils/qemurunner: replace hard-coded user 'root' in debug output Enrico Jorns
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Enrico Jorns @ 2023-03-31 10:26 UTC (permalink / raw)
  To: openembedded-core; +Cc: yocto, ejo

Signed-off-by: Enrico Jorns <ejo@pengutronix.de>
---
 meta/lib/oeqa/utils/commands.py | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/meta/lib/oeqa/utils/commands.py b/meta/lib/oeqa/utils/commands.py
index 84c463328f..9b07227f12 100644
--- a/meta/lib/oeqa/utils/commands.py
+++ b/meta/lib/oeqa/utils/commands.py
@@ -8,11 +8,8 @@
 # This module is mainly used by scripts/oe-selftest and modules under meta/oeqa/selftest
 # It provides a class and methods for running commands on the host in a convienent way for tests.
 
-
-
 import os
 import sys
-import signal
 import subprocess
 import threading
 import time
-- 
2.39.2



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 07/10] oeqa/utils/qemurunner: replace hard-coded user 'root' in debug output
  2023-03-31 10:26 [PATCH 00/10] oeqa: some minor fixes and cleanups Enrico Jorns
                   ` (5 preceding siblings ...)
  2023-03-31 10:26 ` [PATCH 06/10] oeqa/utils/commands: remove unused imports Enrico Jorns
@ 2023-03-31 10:26 ` Enrico Jorns
  2023-03-31 10:26 ` [PATCH 08/10] oeqa/utils/qemurunner: limit precision of timing debugging output Enrico Jorns
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Enrico Jorns @ 2023-03-31 10:26 UTC (permalink / raw)
  To: openembedded-core; +Cc: yocto, ejo

Since login user is configurable with boot_patterns['send_login_user'],
unconditionally using 'root' in the debug message can be confusing.

Also fix the debug message to say 'Logged in' instead of 'Logged'.

Signed-off-by: Enrico Jorns <ejo@pengutronix.de>
---
 meta/lib/oeqa/utils/qemurunner.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/meta/lib/oeqa/utils/qemurunner.py b/meta/lib/oeqa/utils/qemurunner.py
index 05385763ac..9d6fe4fe59 100644
--- a/meta/lib/oeqa/utils/qemurunner.py
+++ b/meta/lib/oeqa/utils/qemurunner.py
@@ -516,7 +516,7 @@ class QemuRunner:
             (status, output) = self.run_serial(self.boot_patterns['send_login_user'], raw=True, timeout=120)
             if re.search(self.boot_patterns['search_login_succeeded'], output):
                 self.logged = True
-                self.logger.debug("Logged as root in serial console")
+                self.logger.debug("Logged in as %s in serial console" % self.boot_patterns['send_login_user'].replace("\n", ""))
                 if netconf:
                     # configure guest networking
                     cmd = "ifconfig eth0 %s netmask %s up\n" % (self.ip, self.netmask)
@@ -527,7 +527,7 @@ class QemuRunner:
                         self.logger.debug("Couldn't configure guest networking")
             else:
                 self.logger.warning("Couldn't login into serial console"
-                            " as root using blank password")
+                            " as %s using blank password" % self.boot_patterns['send_login_user'].replace("\n", ""))
                 self.logger.warning("The output:\n%s" % output)
         except:
             self.logger.warning("Serial console failed while trying to login")
-- 
2.39.2



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 08/10] oeqa/utils/qemurunner: limit precision of timing debugging output
  2023-03-31 10:26 [PATCH 00/10] oeqa: some minor fixes and cleanups Enrico Jorns
                   ` (6 preceding siblings ...)
  2023-03-31 10:26 ` [PATCH 07/10] oeqa/utils/qemurunner: replace hard-coded user 'root' in debug output Enrico Jorns
@ 2023-03-31 10:26 ` Enrico Jorns
  2023-03-31 10:26 ` [PATCH 09/10] oeqa/utils/qemurunner: fix undefined TimeoutExpired Enrico Jorns
  2023-03-31 10:26 ` [PATCH 10/10] oeqa: whitespace and indentation cleanups Enrico Jorns
  9 siblings, 0 replies; 11+ messages in thread
From: Enrico Jorns @ 2023-03-31 10:26 UTC (permalink / raw)
  To: openembedded-core; +Cc: yocto, ejo

* There is no need to be that precise. It just irritates in the logs.
* There is also no point in printing plain time.time() value a single
  time while only using formatted printout everywhere else, thus remove
  it.
* Use %d for printing integer times

Signed-off-by: Enrico Jorns <ejo@pengutronix.de>
---
 meta/lib/oeqa/utils/qemurunner.py | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/meta/lib/oeqa/utils/qemurunner.py b/meta/lib/oeqa/utils/qemurunner.py
index 9d6fe4fe59..623d45010a 100644
--- a/meta/lib/oeqa/utils/qemurunner.py
+++ b/meta/lib/oeqa/utils/qemurunner.py
@@ -275,7 +275,7 @@ class QemuRunner:
             os._exit(0)
 
         self.logger.debug("runqemu started, pid is %s" % self.runqemu.pid)
-        self.logger.debug("waiting at most %s seconds for qemu pid (%s)" %
+        self.logger.debug("waiting at most %d seconds for qemu pid (%s)" %
                           (self.runqemutime, time.strftime("%D %H:%M:%S")))
         endtime = time.time() + self.runqemutime
         while not self.is_alive() and time.time() < endtime:
@@ -299,7 +299,7 @@ class QemuRunner:
             self.logger.warning('runqemu exited with code %d' % self.runqemu.returncode)
 
         if not self.is_alive():
-            self.logger.error("Qemu pid didn't appear in %s seconds (%s)" %
+            self.logger.error("Qemu pid didn't appear in %d seconds (%s)" %
                               (self.runqemutime, time.strftime("%D %H:%M:%S")))
 
             qemu_pid = None
@@ -354,7 +354,7 @@ class QemuRunner:
                 self.qmp.settimeout(self.runqemutime)
                 self.qmp.connect()
                 connect_time = time.time()
-                self.logger.info("QMP connected to QEMU at %s and took %s seconds" %
+                self.logger.info("QMP connected to QEMU at %s and took %.2f seconds" %
                                   (time.strftime("%D %H:%M:%S"),
                                    time.time() - launch_time))
             except OSError as msg:
@@ -388,14 +388,14 @@ class QemuRunner:
 
         # Release the qemu process to continue running
         self.run_monitor('cont')
-        self.logger.info("QMP released QEMU at %s and took %s seconds from connect" %
+        self.logger.info("QMP released QEMU at %s and took %.2f seconds from connect" %
                           (time.strftime("%D %H:%M:%S"),
                            time.time() - connect_time))
 
         # We are alive: qemu is running
         out = self.getOutput(output)
         netconf = False # network configuration is not required by default
-        self.logger.debug("qemu started in %s seconds - qemu procces pid is %s (%s)" %
+        self.logger.debug("qemu started in %.2f seconds - qemu procces pid is %s (%s)" %
                           (time.time() - (endtime - self.runqemutime),
                            self.qemupid, time.strftime("%D %H:%M:%S")))
         cmdline = ''
@@ -486,9 +486,9 @@ class QemuRunner:
                             self.server_socket = qemusock
                             stopread = True
                             reachedlogin = True
-                            self.logger.debug("Reached login banner in %s seconds (%s, %s)" %
+                            self.logger.debug("Reached login banner in %.2f seconds (%s)" %
                                               (time.time() - (endtime - self.boottime),
-                                              time.strftime("%D %H:%M:%S"), time.time()))
+                                              time.strftime("%D %H:%M:%S")))
                     else:
                         # no need to check if reachedlogin unless we support multiple connections
                         self.logger.debug("QEMU socket disconnected before login banner reached. (%s)" %
-- 
2.39.2



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 09/10] oeqa/utils/qemurunner: fix undefined TimeoutExpired
  2023-03-31 10:26 [PATCH 00/10] oeqa: some minor fixes and cleanups Enrico Jorns
                   ` (7 preceding siblings ...)
  2023-03-31 10:26 ` [PATCH 08/10] oeqa/utils/qemurunner: limit precision of timing debugging output Enrico Jorns
@ 2023-03-31 10:26 ` Enrico Jorns
  2023-03-31 10:26 ` [PATCH 10/10] oeqa: whitespace and indentation cleanups Enrico Jorns
  9 siblings, 0 replies; 11+ messages in thread
From: Enrico Jorns @ 2023-03-31 10:26 UTC (permalink / raw)
  To: openembedded-core; +Cc: yocto, ejo

Signed-off-by: Enrico Jorns <ejo@pengutronix.de>
---
 meta/lib/oeqa/utils/qemurunner.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/lib/oeqa/utils/qemurunner.py b/meta/lib/oeqa/utils/qemurunner.py
index 623d45010a..c6e4a34bce 100644
--- a/meta/lib/oeqa/utils/qemurunner.py
+++ b/meta/lib/oeqa/utils/qemurunner.py
@@ -553,7 +553,7 @@ class QemuRunner:
                     self.logger.info("Output from runqemu:\n%s", outs.decode("utf-8"))
                 if errs:
                     self.logger.info("Stderr from runqemu:\n%s", errs.decode("utf-8"))
-            except TimeoutExpired:
+            except subprocess.TimeoutExpired:
                 self.logger.debug("Sending SIGKILL to runqemu")
                 os.killpg(os.getpgid(self.runqemu.pid), signal.SIGKILL)
             if not self.runqemu.stdout.closed:
-- 
2.39.2



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 10/10] oeqa: whitespace and indentation cleanups
  2023-03-31 10:26 [PATCH 00/10] oeqa: some minor fixes and cleanups Enrico Jorns
                   ` (8 preceding siblings ...)
  2023-03-31 10:26 ` [PATCH 09/10] oeqa/utils/qemurunner: fix undefined TimeoutExpired Enrico Jorns
@ 2023-03-31 10:26 ` Enrico Jorns
  9 siblings, 0 replies; 11+ messages in thread
From: Enrico Jorns @ 2023-03-31 10:26 UTC (permalink / raw)
  To: openembedded-core; +Cc: yocto, ejo

Signed-off-by: Enrico Jorns <ejo@pengutronix.de>
---
 meta/lib/oeqa/selftest/cases/runqemu.py | 12 ++++++------
 meta/lib/oeqa/targetcontrol.py          |  4 ++--
 meta/lib/oeqa/utils/commands.py         |  2 +-
 meta/lib/oeqa/utils/qemurunner.py       | 14 +++++++-------
 4 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/meta/lib/oeqa/selftest/cases/runqemu.py b/meta/lib/oeqa/selftest/cases/runqemu.py
index af45c048a4..e1093c67c7 100644
--- a/meta/lib/oeqa/selftest/cases/runqemu.py
+++ b/meta/lib/oeqa/selftest/cases/runqemu.py
@@ -13,6 +13,7 @@ from oeqa.core.decorator.data import skipIfNotArch, skipIfNotMachine
 from oeqa.selftest.case import OESelftestTestCase
 from oeqa.utils.commands import bitbake, runqemu, get_bb_var
 
+
 @OETestTag("runqemu")
 class RunqemuTests(OESelftestTestCase):
     """Runqemu test class"""
@@ -23,8 +24,8 @@ class RunqemuTests(OESelftestTestCase):
     def setUpLocal(self):
         super(RunqemuTests, self).setUpLocal()
         self.recipe = 'core-image-minimal'
-        self.machine =  self.td['MACHINE']
-        self.image_link_name =  get_bb_var('IMAGE_LINK_NAME', self.recipe)
+        self.machine = self.td['MACHINE']
+        self.image_link_name = get_bb_var('IMAGE_LINK_NAME', self.recipe)
 
         self.fstypes = "ext4"
         if self.td["HOST_ARCH"] in ('i586', 'i686', 'x86_64'):
@@ -102,7 +103,6 @@ SYSLINUX_TIMEOUT = "10"
             with open(qemu.qemurunnerlog) as f:
                 self.assertTrue(qemu.runner.logged, "Failed: %s, %s" % (cmd, f.read()))
 
-
     @skipIfNotArch(['i586', 'i686', 'x86_64'])
     def test_boot_deploy_hddimg(self):
         """Test runqemu deploy_dir_image hddimg"""
@@ -166,9 +166,9 @@ class QemuTest(OESelftestTestCase):
     def setUpClass(cls):
         super(QemuTest, cls).setUpClass()
         cls.recipe = 'core-image-minimal'
-        cls.machine =  get_bb_var('MACHINE')
-        cls.deploy_dir_image =  get_bb_var('DEPLOY_DIR_IMAGE')
-        cls.image_link_name =  get_bb_var('IMAGE_LINK_NAME', cls.recipe)
+        cls.machine = get_bb_var('MACHINE')
+        cls.deploy_dir_image = get_bb_var('DEPLOY_DIR_IMAGE')
+        cls.image_link_name = get_bb_var('IMAGE_LINK_NAME', cls.recipe)
         cls.cmd_common = "runqemu nographic"
         cls.qemuboot_conf = "%s.qemuboot.conf" % (cls.image_link_name)
         cls.qemuboot_conf = os.path.join(cls.deploy_dir_image, cls.qemuboot_conf)
diff --git a/meta/lib/oeqa/targetcontrol.py b/meta/lib/oeqa/targetcontrol.py
index f5f2ce2f12..d686fe07ec 100644
--- a/meta/lib/oeqa/targetcontrol.py
+++ b/meta/lib/oeqa/targetcontrol.py
@@ -38,7 +38,7 @@ class BaseTarget(object, metaclass=ABCMeta):
         if os.path.islink(sshloglink):
             os.unlink(sshloglink)
         os.symlink(self.sshlog, sshloglink)
-        self.logger.info("SSH log file: %s" %  self.sshlog)
+        self.logger.info("SSH log file: %s" % self.sshlog)
 
     @abstractmethod
     def start(self, params=None, ssh=True, extra_bootparams=None):
@@ -159,7 +159,7 @@ class QemuTarget(BaseTarget):
             os.unlink(qemuloglink)
         os.symlink(self.qemulog, qemuloglink)
 
-        self.logger.info("rootfs file: %s" %  self.rootfs)
+        self.logger.info("rootfs file: %s" % self.rootfs)
         self.logger.info("Qemu log file: %s" % self.qemulog)
         super(QemuTarget, self).deploy()
 
diff --git a/meta/lib/oeqa/utils/commands.py b/meta/lib/oeqa/utils/commands.py
index 9b07227f12..c1f533802e 100644
--- a/meta/lib/oeqa/utils/commands.py
+++ b/meta/lib/oeqa/utils/commands.py
@@ -115,7 +115,7 @@ class Command(object):
             else:
                 deadline = time.time() + self.timeout
                 for thread in self.threads:
-                    timeout = deadline - time.time() 
+                    timeout = deadline - time.time()
                     if timeout < 0:
                         timeout = 0
                     thread.join(timeout)
diff --git a/meta/lib/oeqa/utils/qemurunner.py b/meta/lib/oeqa/utils/qemurunner.py
index c6e4a34bce..6734cee48d 100644
--- a/meta/lib/oeqa/utils/qemurunner.py
+++ b/meta/lib/oeqa/utils/qemurunner.py
@@ -238,7 +238,7 @@ class QemuRunner:
         self.origchldhandler = signal.getsignal(signal.SIGCHLD)
         signal.signal(signal.SIGCHLD, self.handleSIGCHLD)
 
-        self.logger.debug('launchcmd=%s'%(launch_cmd))
+        self.logger.debug('launchcmd=%s' % (launch_cmd))
 
         # FIXME: We pass in stdin=subprocess.PIPE here to work around stty
         # blocking at the end of the runqemu script when using this within
@@ -332,8 +332,8 @@ class QemuRunner:
         try:
             os.chdir(os.path.dirname(qmp_port))
             try:
-               from qmp.legacy import QEMUMonitorProtocol
-               self.qmp = QEMUMonitorProtocol(os.path.basename(qmp_port))
+                from qmp.legacy import QEMUMonitorProtocol
+                self.qmp = QEMUMonitorProtocol(os.path.basename(qmp_port))
             except OSError as msg:
                 self.logger.warning("Failed to initialize qemu monitor socket: %s File: %s" % (msg, msg.filename))
                 return False
@@ -343,8 +343,8 @@ class QemuRunner:
                 self.logger.debug("QMP Port does not exist waiting for it to be created")
                 endtime = time.time() + self.runqemutime
                 while not os.path.exists(qmp_port) and self.is_alive() and time.time() < endtime:
-                   self.logger.info("QMP port does not exist yet!")
-                   time.sleep(0.5)
+                    self.logger.info("QMP port does not exist yet!")
+                    time.sleep(0.5)
                 if not os.path.exists(qmp_port) and self.is_alive():
                     self.logger.warning("QMP Port still does not exist but QEMU is alive")
                     return False
@@ -419,7 +419,7 @@ class QemuRunner:
             except (IndexError, ValueError):
                 # Try to get network configuration from runqemu output
                 match = re.match(r'.*Network configuration: (?:ip=)*([0-9.]+)::([0-9.]+):([0-9.]+).*',
-                                 out, re.MULTILINE|re.DOTALL)
+                                 out, re.MULTILINE | re.DOTALL)
                 if match:
                     self.ip, self.server_ip, self.netmask = match.groups()
                     # network configuration is required as we couldn't get it
@@ -548,7 +548,7 @@ class QemuRunner:
                     if e.errno != errno.ESRCH:
                         raise
             try:
-                outs, errs = self.runqemu.communicate(timeout = self.runqemutime)
+                outs, errs = self.runqemu.communicate(timeout=self.runqemutime)
                 if outs:
                     self.logger.info("Output from runqemu:\n%s", outs.decode("utf-8"))
                 if errs:
-- 
2.39.2



^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2023-03-31 10:26 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-31 10:26 [PATCH 00/10] oeqa: some minor fixes and cleanups Enrico Jorns
2023-03-31 10:26 ` [PATCH 01/10] oeqa/selftest/cases/runqemu: update imports Enrico Jorns
2023-03-31 10:26 ` [PATCH 02/10] oeqa/targetcontrol: fix misspelled RuntimeError Enrico Jorns
2023-03-31 10:26 ` [PATCH 03/10] oeqa/targetcontrol: do not set dump_host_cmds redundantly Enrico Jorns
2023-03-31 10:26 ` [PATCH 04/10] oeqa/targetcontrol: remove unused imports Enrico Jorns
2023-03-31 10:26 ` [PATCH 05/10] oeqa/utils/commands: fix usage of undefined EPIPE Enrico Jorns
2023-03-31 10:26 ` [PATCH 06/10] oeqa/utils/commands: remove unused imports Enrico Jorns
2023-03-31 10:26 ` [PATCH 07/10] oeqa/utils/qemurunner: replace hard-coded user 'root' in debug output Enrico Jorns
2023-03-31 10:26 ` [PATCH 08/10] oeqa/utils/qemurunner: limit precision of timing debugging output Enrico Jorns
2023-03-31 10:26 ` [PATCH 09/10] oeqa/utils/qemurunner: fix undefined TimeoutExpired Enrico Jorns
2023-03-31 10:26 ` [PATCH 10/10] oeqa: whitespace and indentation cleanups Enrico Jorns

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox