From ed849bb172b0cafdff4ff3c8c733524098c11bba Mon Sep 17 00:00:00 2001 From: Yiqiao Pu Date: Mon, 27 May 2013 19:50:12 +0800 Subject: [PATCH] tests.netperf: Add some string process code Process some output value before use them to igonre the problem caused by different guest os version and session setup. Signed-off-by: Yiqiao Pu --- tests/netperf.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/netperf.py b/tests/netperf.py index 186337af..6c4a556d 100644 --- a/tests/netperf.py +++ b/tests/netperf.py @@ -419,6 +419,7 @@ def launch_client(sessions, server, server_ctl, host, clients, l, nf_args, """ intr = 0 stat = ssh_cmd(server_ctl, "cat /proc/interrupts |grep %s" % name) + stat = stat.strip().split("\n")[-1] for cpu in range(int(ncpu)): intr += int(stat.split()[cpu+1]) return intr @@ -426,7 +427,7 @@ def launch_client(sessions, server, server_ctl, host, clients, l, nf_args, def get_state(): for i in ssh_cmd(server_ctl, "ifconfig").split("\n\n"): if server in i: - ifname = i.split()[0] + ifname = re.findall("(\w+\d+)[:\s]", i)[0] path = "find /sys/devices|grep net/%s/statistics" % ifname cmd = "%s/rx_packets|xargs cat;%s/tx_packets|xargs cat;" \ -- GitLab