mirror of
https://git.yoctoproject.org/poky
synced 2026-02-06 16:56:37 +01:00
This patch makes the necessary changes for using the targetcontrol.py module so that one can run the same tests on a qemu instance or a remote machine based on the value of TEST_TARGET variable: "qemu" or "simpleremote". The default value is "qemu" which starts a qemu instance and it's the with what we currently have. With "simpleremote", the remote machine must be up with network and ssh and you need to set TEST_TARGET_IP with the IP address of the remote machine (it can still be a qemu instance that was manually started). Basically testimage.bbclass now does something along the lines of: - load tests -> deploy (prepare) / start target -> run tests. There were a couple of changes necessary for tests and also some cleanups/renames that were needed to adjust this change. (use ip everywhere when refering to target and server_ip when refering to host/build machine) Also two unnecessary and unsed methods were dropped from sshcontrol. [ YOCTO #5554 ] (From OE-Core rev: a7820350fa3271d78ed7476e02f4aef593be1125) Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
21 lines
652 B
Python
21 lines
652 B
Python
import subprocess
|
|
import unittest
|
|
import sys
|
|
import time
|
|
from oeqa.oetest import oeRuntimeTest
|
|
|
|
class PingTest(oeRuntimeTest):
|
|
|
|
def test_ping(self):
|
|
output = ''
|
|
count = 0
|
|
endtime = time.time() + 60
|
|
while count < 5 and time.time() < endtime:
|
|
proc = subprocess.Popen("ping -c 1 %s" % self.target.ip, shell=True, stdout=subprocess.PIPE)
|
|
output += proc.communicate()[0]
|
|
if proc.poll() == 0:
|
|
count += 1
|
|
else:
|
|
count = 0
|
|
self.assertEqual(count, 5, msg = "Expected 5 consecutive replies, got %d.\nping output is:\n%s" % (count,output))
|