1# 2# Copyright (C) 2016 Intel Corporation 3# 4# SPDX-License-Identifier: MIT 5# 6 7import os 8import subprocess 9import time 10from oeqa.core.case import OETestCase 11from oeqa.utils.package_manager import install_package, uninstall_package 12 13class OERuntimeTestCase(OETestCase): 14 # target instance set by OERuntimeTestLoader. 15 target = None 16 17 def setUp(self): 18 super(OERuntimeTestCase, self).setUp() 19 install_package(self) 20 21 def tearDown(self): 22 super(OERuntimeTestCase, self).tearDown() 23 uninstall_package(self) 24 25def run_network_serialdebug(runner): 26 status, output = runner.run_serial("ip addr") 27 print("ip addr on target: %s %s" % (output, status)) 28 status, output = runner.run_serial("ping -c 1 %s" % self.target.server_ip) 29 print("ping on target for %s: %s %s" % (self.target.server_ip, output, status)) 30 status, output = runner.run_serial("ping -c 1 %s" % self.target.ip) 31 print("ping on target for %s: %s %s" % (self.target.ip, output, status)) 32 # Have to use a full path for netstat which isn't in HOSTTOOLS 33 subprocess.call(["/usr/bin/netstat", "-tunape"]) 34 subprocess.call(["/usr/bin/netstat", "-ei"]) 35 subprocess.call(["ps", "-awx"], shell=True) 36 print("PID: %s %s" % (str(os.getpid()), time.time())) 37