Skip to contentSkip to conversation

fix runtime testing using systemd-boot targe

PATCH In review Stephano Cetola 1 participant 6 messages Jun 20, 2017 – Jul 10, 2017

lore
Share & tools
lore
#0 lore raw

v4 cover fix runtime testing using systemd-boot targe

I'm sending this on behalf of Zeeshan Ali <[email protected]>. One of the patches required a rebase and he is on vacation. This fixes [YOCTO #11524].

Erik Botö (4):
sshcontrol.py: in copy_to() always use scp masterimage.py: fix stop()
masterimage.py: rename parameter "params" in start() to
"extra_bootparams"
masterimage.py: fix issue with calling reboot on masterimage/DUT

 meta/lib/oeqa/controllers/masterimage.py | 6 +++---
 meta/lib/oeqa/utils/sshcontrol.py        | 9 +++------
 2 files changed, 6 insertions(+), 9 deletions(-)
Signature · 1 line
2.13.1
#1 lore raw

PATCH v4 1/4 sshcontrol.py: in copy_to() always use scp

From: Erik Botö <[email protected]>

The current implementation is broken when the localpath is a link. Then only a symlink would be created on the target, instead of copying the actual file.

[YOCTO #11524]

---
 meta/lib/oeqa/utils/sshcontrol.py | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
meta/lib/oeqa/utils/sshcontrol.py +3 -6
index 05d6502550..d292893c08 100644
@@ -150,12 +150,9 @@ class SSHControl(object):
 
     def copy_to(self, localpath, remotepath):
         if os.path.islink(localpath):
-            link = os.readlink(localpath)
-            dst_dir, dst_base = os.path.split(remotepath)
-            return self.run("cd %s; ln -s %s %s" % (dst_dir, link, dst_base))
-        else:
-            command = self.scp + [localpath, '%s@%s:%s' % (self.user, self.ip, remotepath)]
-            return self._internal_run(command, ignore_status=False)
+            localpath = os.path.dirname(localpath) + "/" + os.readlink(localpath)
+        command = self.scp + [localpath, '%s@%s:%s' % (self.user, self.ip, remotepath)]
+        return self._internal_run(command, ignore_status=False)
 
     def copy_from(self, remotepath, localpath):
         command = self.scp + ['%s@%s:%s' % (self.user, self.ip, remotepath), localpath]
Signature · 1 line
2.13.1
#2 lore raw

PATCH v4 2/4 masterimage.py: fix stop()

In reply to Stephano Cetola

From: Erik Botö <[email protected]>

The stop() function is called in the context of the masterimage, so self.master should be used instead of self.connection which is undefined at that time.

[YOCTO #11524]

---
 meta/lib/oeqa/controllers/masterimage.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/lib/oeqa/controllers/masterimage.py +1 -1
index 07418fcda1..6aa7fba6eb 100644
@@ -156,7 +156,7 @@ class MasterImageHardwareTarget(oeqa.targetcontrol.BaseTarget, metaclass=ABCMeta
 
     def stop(self):
         bb.plain("%s - reboot/powercycle target" % self.pn)
-        self.power_cycle(self.connection)
+        self.power_cycle(self.master)
 
 
 class SystemdbootTarget(MasterImageHardwareTarget):
Signature · 1 line
2.13.1
#3 lore raw

PATCH v4 3/4 masterimage.py: rename parameter "params" in start() to "extra_bootparams"

In reply to Stephano Cetola

From: Erik Botö <[email protected]>

This matches how it is called, and how it is named in qmeu target.

[YOCTO #11524]

---
 meta/lib/oeqa/controllers/masterimage.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/lib/oeqa/controllers/masterimage.py +1 -1
index 6aa7fba6eb..e43e4d8889 100644
@@ -143,7 +143,7 @@ class MasterImageHardwareTarget(oeqa.targetcontrol.BaseTarget, metaclass=ABCMeta
     def _deploy(self):
         pass
 
-    def start(self, params=None):
+    def start(self, extra_bootparams=None):
         bb.plain("%s - boot test image on target" % self.pn)
         self._start()
         # set the ssh object for the target/test image
Signature · 1 line
2.13.1
#4 lore raw

PATCH v4 4/4 masterimage.py: fix issue with calling reboot on masterimage/DUT

In reply to Stephano Cetola

From: Erik Botö <[email protected]>

On systemd systems calling reboot over an ssh connection doesn't return as expected causing an exception, therefore wrap the call to reboot in order to avoid this issue.

Also sync the filesystems before rebooting cause otherwise, it will be done as part of the reboot and could take a very long time and testimage will fail to access the machine. This issue was observed consistently with one of our rootfs at Pelagicore.

[YOCTO #11524]

---
 meta/lib/oeqa/controllers/masterimage.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/lib/oeqa/controllers/masterimage.py +1 -1
index e43e4d8889..a2912fc568 100644
@@ -108,7 +108,7 @@ class MasterImageHardwareTarget(oeqa.targetcontrol.BaseTarget, metaclass=ABCMeta
             time.sleep(10)
             self.power_ctl("cycle")
         else:
-            status, output = conn.run("reboot")
+            status, output = conn.run("sync; { sleep 1; reboot; } > /dev/null &")
             if status != 0:
                 bb.error("Failed rebooting target and no power control command defined. You need to manually reset the device.\n%s" % output)
 
Signature · 1 line
2.13.1
#5 lore raw
In reply to Stephano Cetola

Any updates on this?

I can setup a test for this if one doesn't already exist.

Cheers,
Stephano

Quoted 18 lines · Stephano Cetola

I'm sending this on behalf of Zeeshan Ali <[email protected]>. One of the patches required a rebase and he is on vacation. This fixes [YOCTO #11524].

Erik Botö (4):
sshcontrol.py: in copy_to() always use scp masterimage.py: fix stop()
masterimage.py: rename parameter "params" in start() to
"extra_bootparams"
masterimage.py: fix issue with calling reboot on masterimage/DUT

 meta/lib/oeqa/controllers/masterimage.py | 6 +++---
 meta/lib/oeqa/utils/sshcontrol.py        | 9 +++------
 2 files changed, 6 insertions(+), 9 deletions(-)
Signature · 1 line
2.13.1