poky/meta/lib/oeqa/runtime/case.py
Mikko Rapeli 2d900c3061 oeqa/runtime: set self.runner and handle None
Set default self.runner to None. qemu target sets
the runner to qemu. Then handle self.runner None in
run_network_serialdebug(). This way ssh runner
and failing ping or ssh tests handle the error cases.

(From OE-Core rev: 39f72147ef402bea54a66abf984315c1f93aa141)

Signed-off-by: Mikko Rapeli <mikko.rapeli@linaro.org>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2025-07-03 10:40:17 +01:00

39 lines
1.3 KiB
Python

#
# Copyright (C) 2016 Intel Corporation
#
# SPDX-License-Identifier: MIT
#
import os
import subprocess
import time
from oeqa.core.case import OETestCase
from oeqa.utils.package_manager import install_package, uninstall_package
class OERuntimeTestCase(OETestCase):
# target instance set by OERuntimeTestLoader.
target = None
def setUp(self):
super(OERuntimeTestCase, self).setUp()
install_package(self)
def tearDown(self):
super(OERuntimeTestCase, self).tearDown()
uninstall_package(self)
def run_network_serialdebug(runner):
if not runner:
return
status, output = runner.run_serial("ip addr")
print("ip addr on target: %s %s" % (output, status))
status, output = runner.run_serial("ping -c 1 %s" % self.target.server_ip)
print("ping on target for %s: %s %s" % (self.target.server_ip, output, status))
status, output = runner.run_serial("ping -c 1 %s" % self.target.ip)
print("ping on target for %s: %s %s" % (self.target.ip, output, status))
# Have to use a full path for netstat which isn't in HOSTTOOLS
subprocess.call(["/usr/bin/netstat", "-tunape"])
subprocess.call(["/usr/bin/netstat", "-ei"])
subprocess.call(["ps", "-awx"], shell=True)
print("PID: %s %s" % (str(os.getpid()), time.time()))