diff mbox series

testimage/oeqa: remove testimage_dump_host function

Message ID 20230512134549.292759-1-throos@amazon.de
State New
Headers show
Series testimage/oeqa: remove testimage_dump_host function | expand

Commit Message

Roos, Thomas May 12, 2023, 1:45 p.m. UTC
From: Thomas Roos <throos@amazon.de>

This function is not necessary.

[YOCTO #13872]

Signed-off-by: Thomas Roos <throos@amazon.de>
---
 meta/classes-recipe/testexport.bbclass |  3 +--
 meta/classes-recipe/testimage.bbclass  | 13 -------------
 meta/lib/oeqa/targetcontrol.py         |  2 --
 meta/lib/oeqa/utils/qemurunner.py      | 15 +--------------
 4 files changed, 2 insertions(+), 31 deletions(-)

Comments

Alexandre Belloni May 15, 2023, 2:56 a.m. UTC | #1
On 12/05/2023 15:45:49+0200, Thomas Roos via lists.openembedded.org wrote:
> From: Thomas Roos <throos@amazon.de>
> 
> This function is not necessary.
> 
> [YOCTO #13872]
> 

This fails on the AB:

https://autobuilder.yoctoproject.org/typhoon/#/builders/73/builds/7052/steps/13/logs/stdio

The stack trace of python calls that resulted in this exception/failure was:
File: 'exec_func_python() autogenerated', lineno: 2, function: <module>
     0001:
 *** 0002:do_testimage(d)
     0003:
File: '/home/pokybuild/yocto-worker/qemux86-64/build/meta/classes-recipe/testimage.bbclass', lineno: 125, function: do_testimage
     0121:    dump-guest-memory {"paging":false,"protocol":"file:%s.img"}
     0122:}
     0123:
     0124:python do_testimage() {
 *** 0125:    testimage_main(d)
     0126:}
     0127:
     0128:addtask testimage
     0129:do_testimage[nostamp] = "1"
File: '/home/pokybuild/yocto-worker/qemux86-64/build/meta/classes-recipe/testimage.bbclass', lineno: 331, function: testimage_main
     0327:    # runtime use network for download projects for build
     0328:    export_proxies(d)
     0329:
     0330:    # we need the host dumper in test context
 *** 0331:    host_dumper = OERuntimeTestContextExecutor.getHostDumper(
     0332:        d.getVar("TESTIMAGE_DUMP_DIR"))
     0333:
     0334:    # the robot dance
     0335:    target = OERuntimeTestContextExecutor.getTarget(
Exception: TypeError: OERuntimeTestContextExecutor.getHostDumper() missing 1 required positional argument: 'directory'

> Signed-off-by: Thomas Roos <throos@amazon.de>
> ---
>  meta/classes-recipe/testexport.bbclass |  3 +--
>  meta/classes-recipe/testimage.bbclass  | 13 -------------
>  meta/lib/oeqa/targetcontrol.py         |  2 --
>  meta/lib/oeqa/utils/qemurunner.py      | 15 +--------------
>  4 files changed, 2 insertions(+), 31 deletions(-)
> 
> diff --git a/meta/classes-recipe/testexport.bbclass b/meta/classes-recipe/testexport.bbclass
> index 0f0c56107f..9888356158 100644
> --- a/meta/classes-recipe/testexport.bbclass
> +++ b/meta/classes-recipe/testexport.bbclass
> @@ -61,8 +61,7 @@ def testexport_main(d):
>          d.getVar("TEST_TARGET"), None, d.getVar("TEST_TARGET_IP"),
>          d.getVar("TEST_SERVER_IP"))
>  
> -    host_dumper = OERuntimeTestContextExecutor.getHostDumper(
> -        d.getVar("testimage_dump_host"), d.getVar("TESTIMAGE_DUMP_DIR"))
> +    host_dumper = OERuntimeTestContextExecutor.getHostDumper(d.getVar("TESTIMAGE_DUMP_DIR"))
>  
>      image_manifest = "%s.manifest" % image_name
>      image_packages = OERuntimeTestContextExecutor.readPackagesManifest(image_manifest)
> diff --git a/meta/classes-recipe/testimage.bbclass b/meta/classes-recipe/testimage.bbclass
> index b48cd96575..c1836cf20a 100644
> --- a/meta/classes-recipe/testimage.bbclass
> +++ b/meta/classes-recipe/testimage.bbclass
> @@ -115,18 +115,6 @@ testimage_dump_target () {
>      find /var/log/ -type f 2>/dev/null -exec echo "====================" \; -exec echo {} \; -exec echo "====================" \; -exec cat {} \; -exec echo "" \;
>  }
>  
> -testimage_dump_host () {
> -    top -bn1
> -    iostat -x -z -N -d -p ALL 20 2
> -    ps -ef
> -    free
> -    df
> -    memstat
> -    dmesg
> -    ip -s link
> -    netstat -an
> -}
> -
>  testimage_dump_monitor () {
>      query-status
>      query-block
> @@ -341,7 +329,6 @@ def testimage_main(d):
>  
>      # we need the host dumper in test context
>      host_dumper = OERuntimeTestContextExecutor.getHostDumper(
> -        d.getVar("testimage_dump_host"),
>          d.getVar("TESTIMAGE_DUMP_DIR"))
>  
>      # the robot dance
> diff --git a/meta/lib/oeqa/targetcontrol.py b/meta/lib/oeqa/targetcontrol.py
> index d686fe07ec..e21655c979 100644
> --- a/meta/lib/oeqa/targetcontrol.py
> +++ b/meta/lib/oeqa/targetcontrol.py
> @@ -104,7 +104,6 @@ class QemuTarget(BaseTarget):
>              self.kernel = os.path.join(d.getVar("DEPLOY_DIR_IMAGE"), d.getVar("KERNEL_IMAGETYPE", False) + '-' + d.getVar('MACHINE', False) + '.bin')
>          self.qemulog = os.path.join(self.testdir, "qemu_boot_log.%s" % self.datetime)
>          dump_target_cmds = d.getVar("testimage_dump_target")
> -        dump_host_cmds = d.getVar("testimage_dump_host")
>          dump_monitor_cmds = d.getVar("testimage_dump_monitor")
>          dump_dir = d.getVar("TESTIMAGE_DUMP_DIR")
>          if not dump_dir:
> @@ -141,7 +140,6 @@ class QemuTarget(BaseTarget):
>                              boottime = int(d.getVar("TEST_QEMUBOOT_TIMEOUT")),
>                              use_kvm = use_kvm,
>                              dump_dir = dump_dir,
> -                            dump_host_cmds = dump_host_cmds,
>                              logger = logger,
>                              tmpfsdir = d.getVar("RUNQEMU_TMPFS_DIR"),
>                              serial_ports = len(d.getVar("SERIAL_CONSOLES").split()))
> diff --git a/meta/lib/oeqa/utils/qemurunner.py b/meta/lib/oeqa/utils/qemurunner.py
> index 6734cee48d..1f162a4e33 100644
> --- a/meta/lib/oeqa/utils/qemurunner.py
> +++ b/meta/lib/oeqa/utils/qemurunner.py
> @@ -33,7 +33,7 @@ re_control_char = re.compile('[%s]' % re.escape("".join(control_chars)))
>  
>  class QemuRunner:
>  
> -    def __init__(self, machine, rootfs, display, tmpdir, deploy_dir_image, logfile, boottime, dump_dir, dump_host_cmds,
> +    def __init__(self, machine, rootfs, display, tmpdir, deploy_dir_image, logfile, boottime, dump_dir,
>                   use_kvm, logger, use_slirp=False, serial_ports=2, boot_patterns = defaultdict(str), use_ovmf=False, workdir=None, tmpfsdir=None):
>  
>          # Popen object for runqemu
> @@ -69,7 +69,6 @@ class QemuRunner:
>          if not workdir:
>              workdir = os.getcwd()
>          self.qemu_pidfile = workdir + '/pidfile_' + str(os.getpid())
> -        self.host_dumper = HostDumper(dump_host_cmds, dump_dir)
>          self.monitorpipe = None
>  
>          self.logger = logger
> @@ -138,7 +137,6 @@ class QemuRunner:
>                  self.logger.error('runqemu exited with code %d' % self.runqemu.returncode)
>                  self.logger.error('Output from runqemu:\n%s' % self.getOutput(self.runqemu.stdout))
>                  self.stop()
> -                self._dump_host()
>  
>      def start(self, qemuparams = None, get_ip = True, extra_bootparams = None, runqemuparams='', launch_cmd=None, discard_writes=True):
>          env = os.environ.copy()
> @@ -286,7 +284,6 @@ class QemuRunner:
>                  if self.runqemu.returncode:
>                      # No point waiting any longer
>                      self.logger.warning('runqemu exited with code %d' % self.runqemu.returncode)
> -                    self._dump_host()
>                      self.logger.warning("Output from runqemu:\n%s" % self.getOutput(output))
>                      self.stop()
>                      return False
> @@ -314,7 +311,6 @@ class QemuRunner:
>              ps = subprocess.Popen(['ps', 'axww', '-o', 'pid,ppid,pri,ni,command '], stdout=subprocess.PIPE).communicate()[0]
>              processes = ps.decode("utf-8")
>              self.logger.debug("Running processes:\n%s" % processes)
> -            self._dump_host()
>              op = self.getOutput(output)
>              self.stop()
>              if op:
> @@ -430,7 +426,6 @@ class QemuRunner:
>                      self.logger.error("Couldn't get ip from qemu command line and runqemu output! "
>                                   "Here is the qemu command line used:\n%s\n"
>                                   "and output from runqemu:\n%s" % (cmdline, out))
> -                    self._dump_host()
>                      self.stop()
>                      return False
>  
> @@ -507,7 +502,6 @@ class QemuRunner:
>              lines = tail(bootlog if bootlog else self.msg)
>              self.logger.warning("Last 25 lines of text (%d):\n%s" % (len(bootlog), lines))
>              self.logger.warning("Check full boot log: %s" % self.logfile)
> -            self._dump_host()
>              self.stop()
>              return False
>  
> @@ -688,13 +682,6 @@ class QemuRunner:
>                      status = 1
>          return (status, str(data))
>  
> -
> -    def _dump_host(self):
> -        self.host_dumper.create_dir("qemu")
> -        self.logger.warning("Qemu ended unexpectedly, dump data from host"
> -                " is in %s" % self.host_dumper.dump_dir)
> -        self.host_dumper.dump_host()
> -
>  # This class is for reading data from a socket and passing it to logfunc
>  # to be processed. It's completely event driven and has a straightforward
>  # event loop. The mechanism for stopping the thread is a simple pipe which
> -- 
> 2.34.1
> 
> 
> 
> 
> Amazon Web Services EMEA SARL
> 38 avenue John F. Kennedy, L-1855 Luxembourg
> Sitz der Gesellschaft: L-1855 Luxemburg
> eingetragen im Luxemburgischen Handelsregister unter R.C.S. B186284
> 
> Amazon Web Services EMEA SARL, Niederlassung Deutschland
> Marcel-Breuer-Str. 12, D-80807 Muenchen
> Sitz der Zweigniederlassung: Muenchen
> eingetragen im Handelsregister des Amtsgerichts Muenchen unter HRB 242240, USt-ID DE317013094
> 
> 
> 
> 

> 
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#181183): https://lists.openembedded.org/g/openembedded-core/message/181183
> Mute This Topic: https://lists.openembedded.org/mt/98849300/3617179
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [alexandre.belloni@bootlin.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
diff mbox series

Patch

diff --git a/meta/classes-recipe/testexport.bbclass b/meta/classes-recipe/testexport.bbclass
index 0f0c56107f..9888356158 100644
--- a/meta/classes-recipe/testexport.bbclass
+++ b/meta/classes-recipe/testexport.bbclass
@@ -61,8 +61,7 @@  def testexport_main(d):
         d.getVar("TEST_TARGET"), None, d.getVar("TEST_TARGET_IP"),
         d.getVar("TEST_SERVER_IP"))
 
-    host_dumper = OERuntimeTestContextExecutor.getHostDumper(
-        d.getVar("testimage_dump_host"), d.getVar("TESTIMAGE_DUMP_DIR"))
+    host_dumper = OERuntimeTestContextExecutor.getHostDumper(d.getVar("TESTIMAGE_DUMP_DIR"))
 
     image_manifest = "%s.manifest" % image_name
     image_packages = OERuntimeTestContextExecutor.readPackagesManifest(image_manifest)
diff --git a/meta/classes-recipe/testimage.bbclass b/meta/classes-recipe/testimage.bbclass
index b48cd96575..c1836cf20a 100644
--- a/meta/classes-recipe/testimage.bbclass
+++ b/meta/classes-recipe/testimage.bbclass
@@ -115,18 +115,6 @@  testimage_dump_target () {
     find /var/log/ -type f 2>/dev/null -exec echo "====================" \; -exec echo {} \; -exec echo "====================" \; -exec cat {} \; -exec echo "" \;
 }
 
-testimage_dump_host () {
-    top -bn1
-    iostat -x -z -N -d -p ALL 20 2
-    ps -ef
-    free
-    df
-    memstat
-    dmesg
-    ip -s link
-    netstat -an
-}
-
 testimage_dump_monitor () {
     query-status
     query-block
@@ -341,7 +329,6 @@  def testimage_main(d):
 
     # we need the host dumper in test context
     host_dumper = OERuntimeTestContextExecutor.getHostDumper(
-        d.getVar("testimage_dump_host"),
         d.getVar("TESTIMAGE_DUMP_DIR"))
 
     # the robot dance
diff --git a/meta/lib/oeqa/targetcontrol.py b/meta/lib/oeqa/targetcontrol.py
index d686fe07ec..e21655c979 100644
--- a/meta/lib/oeqa/targetcontrol.py
+++ b/meta/lib/oeqa/targetcontrol.py
@@ -104,7 +104,6 @@  class QemuTarget(BaseTarget):
             self.kernel = os.path.join(d.getVar("DEPLOY_DIR_IMAGE"), d.getVar("KERNEL_IMAGETYPE", False) + '-' + d.getVar('MACHINE', False) + '.bin')
         self.qemulog = os.path.join(self.testdir, "qemu_boot_log.%s" % self.datetime)
         dump_target_cmds = d.getVar("testimage_dump_target")
-        dump_host_cmds = d.getVar("testimage_dump_host")
         dump_monitor_cmds = d.getVar("testimage_dump_monitor")
         dump_dir = d.getVar("TESTIMAGE_DUMP_DIR")
         if not dump_dir:
@@ -141,7 +140,6 @@  class QemuTarget(BaseTarget):
                             boottime = int(d.getVar("TEST_QEMUBOOT_TIMEOUT")),
                             use_kvm = use_kvm,
                             dump_dir = dump_dir,
-                            dump_host_cmds = dump_host_cmds,
                             logger = logger,
                             tmpfsdir = d.getVar("RUNQEMU_TMPFS_DIR"),
                             serial_ports = len(d.getVar("SERIAL_CONSOLES").split()))
diff --git a/meta/lib/oeqa/utils/qemurunner.py b/meta/lib/oeqa/utils/qemurunner.py
index 6734cee48d..1f162a4e33 100644
--- a/meta/lib/oeqa/utils/qemurunner.py
+++ b/meta/lib/oeqa/utils/qemurunner.py
@@ -33,7 +33,7 @@  re_control_char = re.compile('[%s]' % re.escape("".join(control_chars)))
 
 class QemuRunner:
 
-    def __init__(self, machine, rootfs, display, tmpdir, deploy_dir_image, logfile, boottime, dump_dir, dump_host_cmds,
+    def __init__(self, machine, rootfs, display, tmpdir, deploy_dir_image, logfile, boottime, dump_dir,
                  use_kvm, logger, use_slirp=False, serial_ports=2, boot_patterns = defaultdict(str), use_ovmf=False, workdir=None, tmpfsdir=None):
 
         # Popen object for runqemu
@@ -69,7 +69,6 @@  class QemuRunner:
         if not workdir:
             workdir = os.getcwd()
         self.qemu_pidfile = workdir + '/pidfile_' + str(os.getpid())
-        self.host_dumper = HostDumper(dump_host_cmds, dump_dir)
         self.monitorpipe = None
 
         self.logger = logger
@@ -138,7 +137,6 @@  class QemuRunner:
                 self.logger.error('runqemu exited with code %d' % self.runqemu.returncode)
                 self.logger.error('Output from runqemu:\n%s' % self.getOutput(self.runqemu.stdout))
                 self.stop()
-                self._dump_host()
 
     def start(self, qemuparams = None, get_ip = True, extra_bootparams = None, runqemuparams='', launch_cmd=None, discard_writes=True):
         env = os.environ.copy()
@@ -286,7 +284,6 @@  class QemuRunner:
                 if self.runqemu.returncode:
                     # No point waiting any longer
                     self.logger.warning('runqemu exited with code %d' % self.runqemu.returncode)
-                    self._dump_host()
                     self.logger.warning("Output from runqemu:\n%s" % self.getOutput(output))
                     self.stop()
                     return False
@@ -314,7 +311,6 @@  class QemuRunner:
             ps = subprocess.Popen(['ps', 'axww', '-o', 'pid,ppid,pri,ni,command '], stdout=subprocess.PIPE).communicate()[0]
             processes = ps.decode("utf-8")
             self.logger.debug("Running processes:\n%s" % processes)
-            self._dump_host()
             op = self.getOutput(output)
             self.stop()
             if op:
@@ -430,7 +426,6 @@  class QemuRunner:
                     self.logger.error("Couldn't get ip from qemu command line and runqemu output! "
                                  "Here is the qemu command line used:\n%s\n"
                                  "and output from runqemu:\n%s" % (cmdline, out))
-                    self._dump_host()
                     self.stop()
                     return False
 
@@ -507,7 +502,6 @@  class QemuRunner:
             lines = tail(bootlog if bootlog else self.msg)
             self.logger.warning("Last 25 lines of text (%d):\n%s" % (len(bootlog), lines))
             self.logger.warning("Check full boot log: %s" % self.logfile)
-            self._dump_host()
             self.stop()
             return False
 
@@ -688,13 +682,6 @@  class QemuRunner:
                     status = 1
         return (status, str(data))
 
-
-    def _dump_host(self):
-        self.host_dumper.create_dir("qemu")
-        self.logger.warning("Qemu ended unexpectedly, dump data from host"
-                " is in %s" % self.host_dumper.dump_dir)
-        self.host_dumper.dump_host()
-
 # This class is for reading data from a socket and passing it to logfunc
 # to be processed. It's completely event driven and has a straightforward
 # event loop. The mechanism for stopping the thread is a simple pipe which