Skip to contentSkip to conversation

fix runtime tests with systemd-boot

PATCH New Stephano Cetola 1 participant 5 messages Nov 6, 2017

lore
Share & tools
lore
#0 lore raw

cover fix runtime tests with systemd-boot

These patches fell through the cracks of 2.4. I've checked with the QA team and they are still relevant. Ping me with any questions.

I will be backporting these to rocko as well.

This fixes [YOCTO #11524]

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

 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.14.2
#1 lore raw

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

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 07418fcda1..fe90967923 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.14.2
#2 lore raw

PATCH 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 fe90967923..e2ff3f12c2 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.14.2
#3 lore raw

PATCH 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 e2ff3f12c2..a2912fc568 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.14.2
#4 lore raw

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

In reply to Stephano Cetola

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.14.2