All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ross Burton" <ross@burtonini.com>
To: openembedded-core@lists.openembedded.org
Subject: [PATCH 6/7] oeqa/core/target: add target_ip to superclass
Date: Fri, 10 Sep 2021 11:20:49 +0100	[thread overview]
Message-ID: <20210910102050.1266413-6-ross.burton@arm.com> (raw)
In-Reply-To: <20210910102050.1266413-1-ross.burton@arm.com>

Move towards a consistent interface across OETarget subclasses by
moving target_ip to the superclass.

QemuTarget automatically determines the target IP on startup, so default
that to None.

Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 meta/lib/oeqa/core/target/__init__.py | 3 ++-
 meta/lib/oeqa/core/target/qemu.py     | 4 ++--
 meta/lib/oeqa/core/target/ssh.py      | 5 ++---
 meta/lib/oeqa/runtime/context.py      | 2 +-
 4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/meta/lib/oeqa/core/target/__init__.py b/meta/lib/oeqa/core/target/__init__.py
index aff02ecc439..45ed3e54b40 100644
--- a/meta/lib/oeqa/core/target/__init__.py
+++ b/meta/lib/oeqa/core/target/__init__.py
@@ -7,8 +7,9 @@
 
 class OETarget:
 
-    def __init__(self, logger, server_ip):
+    def __init__(self, logger, server_ip, target_ip):
         self.server_ip = server_ip
+        self.ip = target_ip
         self.logger = logger
 
     def start(self):
diff --git a/meta/lib/oeqa/core/target/qemu.py b/meta/lib/oeqa/core/target/qemu.py
index 66551607fb9..ef567939ad8 100644
--- a/meta/lib/oeqa/core/target/qemu.py
+++ b/meta/lib/oeqa/core/target/qemu.py
@@ -20,13 +20,13 @@ from oeqa.utils.dump import TargetDumper
 supported_fstypes = ['ext3', 'ext4', 'cpio.gz', 'wic']
 
 class OEQemuTarget(OESSHTarget):
-    def __init__(self, logger, server_ip, timeout=300, user='root',
+    def __init__(self, logger, server_ip, target_ip=None, timeout=300, user='root',
             port=None, machine='', rootfs='', kernel='', kvm=False, slirp=False,
             dump_dir='', dump_host_cmds='', display='', bootlog='',
             tmpdir='', dir_image='', boottime=60, serial_ports=2,
             boot_patterns = defaultdict(str), ovmf=False, tmpfsdir=None, **kwargs):
 
-        super().__init__(logger, None, server_ip, timeout, user, port)
+        super().__init__(logger, server_ip, target_ip, timeout, user, port)
 
         self.machine = machine
         self.rootfs = rootfs
diff --git a/meta/lib/oeqa/core/target/ssh.py b/meta/lib/oeqa/core/target/ssh.py
index bbf621c8e38..b61c7d141d9 100644
--- a/meta/lib/oeqa/core/target/ssh.py
+++ b/meta/lib/oeqa/core/target/ssh.py
@@ -14,7 +14,7 @@ import codecs
 from . import OETarget
 
 class OESSHTarget(OETarget):
-    def __init__(self, logger, ip, server_ip, timeout=300, user='root',
+    def __init__(self, logger, server_ip, target_ip, timeout=300, user='root',
                  port=None, **kwargs):
         if not logger:
             logger = logging.getLogger('target')
@@ -27,8 +27,7 @@ class OESSHTarget(OETarget):
             fileHandler.setFormatter(formatter)
             logger.addHandler(fileHandler)
 
-        super().__init__(logger, server_ip)
-        self.ip = ip
+        super().__init__(logger, server_ip, target_ip)
         self.timeout = timeout
         self.user = user
         ssh_options = [
diff --git a/meta/lib/oeqa/runtime/context.py b/meta/lib/oeqa/runtime/context.py
index 8552aa782bc..76cae4ee789 100644
--- a/meta/lib/oeqa/runtime/context.py
+++ b/meta/lib/oeqa/runtime/context.py
@@ -100,7 +100,7 @@ class OERuntimeTestContextExecutor(OETestContextExecutor):
                 kwargs['port'] = target_ip_port[1]
 
         if target_type == 'simpleremote':
-            target = OESSHTarget(logger, target_ip, server_ip, **kwargs)
+            target = OESSHTarget(logger, server_ip, target_ip, **kwargs)
         elif target_type == 'qemu':
             target = OEQemuTarget(logger, server_ip, **kwargs)
         else:
-- 
2.25.1


  parent reply	other threads:[~2021-09-10 10:20 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-10 10:20 [PATCH 1/7] testimage: TEST_SERVER_IP isn't mandatory Ross Burton
2021-09-10 10:20 ` [PATCH 2/7] testimage: pass the base image name to the target class Ross Burton
2021-09-10 10:20 ` [PATCH 3/7] oeqa/core/target: remove abstract decorations Ross Burton
2021-09-10 10:20 ` [PATCH 4/7] oeqa/core/target: move server_ip to superclass Ross Burton
2021-09-10 10:20 ` [PATCH 5/7] oeqa/core/target: remove server port parameter Ross Burton
2021-09-10 10:20 ` Ross Burton [this message]
2021-09-10 10:20 ` [PATCH 7/7] oeqa/target/ssh: don't assume target_dumper is set Ross Burton
2021-09-10 12:21 ` [OE-core] [PATCH 1/7] testimage: TEST_SERVER_IP isn't mandatory Ross Burton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210910102050.1266413-6-ross.burton@arm.com \
    --to=ross@burtonini.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.