From: Amos Kong <akong@redhat.com>
To: lmr@redhat.com, wquan@redhat.com, kvm@vger.kernel.org,
jasowang@redhat.com, rhod@redhat.com, autotest@test.kernel.org
Subject: [RFC PATCH 1/4] virt-test: add NTttcp subtests
Date: Fri, 23 Dec 2011 18:28:25 +0800 [thread overview]
Message-ID: <20111223102825.29662.79244.stgit@dhcp-8-167.nay.redhat.com> (raw)
In-Reply-To: <20111223102308.29662.59520.stgit@dhcp-8-167.nay.redhat.com>
This case will test tcp throughput between 2 windows guests,
or between 1 guest and 1 external Windows host.
When test between guest and external Windows host,
'receiver_address' should be set to external Windows' ip address.
Need extract NTttcp.tar.gz[1] to the root dir of winutils.iso
[1] http://amos-kong.rhcloud.com/pub/NTttcp.tar.gz
NTttcp/
NTttcp/NT Testing TCP Tool.msi
NTttcp/ntttcp.au3
This test will generate result files with standard format,
raw_output_1.RHS:
buf(k)| throughput(Mbit/s)
2| 109.548
4| 209.519
8| 399.576
We can compare it by a common method.
Signed-off-by: Qingtang Zhou <qzhou@redhat.com>
Signed-off-by: Amos Kong <akong@redhat.com>
---
client/tests/kvm/subtests.cfg.sample | 21 ++++
client/virt/tests/ntttcp.py | 160 ++++++++++++++++++++++++++++++++++
2 files changed, 181 insertions(+), 0 deletions(-)
create mode 100644 client/virt/tests/ntttcp.py
diff --git a/client/tests/kvm/subtests.cfg.sample b/client/tests/kvm/subtests.cfg.sample
index 3d47fb4..a05aee8 100644
--- a/client/tests/kvm/subtests.cfg.sample
+++ b/client/tests/kvm/subtests.cfg.sample
@@ -966,6 +966,27 @@ variants:
netperf_cmd = %s/netperf-2.4.5/src/netperf -t %s -H %s -l 60 -- -r %s
protocols = "TCP_RR TCP_CRR UDP_RR"
+ - ntttcp:
+ type = ntttcp
+ image_snapshot = yes
+ check_ntttcp_cmd = "cmd /c dir C:\NTttcp"
+ ntttcp_sender_cmd = "cmd /c C:\NTttcp\NTttcps.exe -m %s,0,%s -a 2 -l %s"
+ ntttcp_receiver_cmd = "cmd /c C:\NTttcp\NTttcpr.exe -m %s,0,%s -a 6 -rb 256k"
+ session_num = 1
+ buffers = "2k 4k 8k 16k 32k 64k 128k 256k"
+ timeout = 300
+ kill_vm = yes
+ variants:
+ - guest_guest:
+ vms += " vm2"
+ - guest_host:
+ # external Windows system IP, NTttcp need to be installed firstly.
+ receiver_address = "192.168.1.1"
+ 32:
+ ntttcp_install_cmd = 'cmd /c "D:\autoit3.exe D:\NTttcp\NTttcp.au3 && mkdir C:\NTttcp && copy "C:\Program Files\Microsoft Corporation\NT Testing TCP Tool\*" C:\NTttcp && cd C:\NTttcp\ && copy NTttcp_%s.exe NTttcps.exe && copy NTttcp_%s.exe NTttcpr.exe"'
+ 64:
+ ntttcp_install_cmd = 'cmd /c "D:\autoit3.exe D:\NTttcp\NTttcp.au3 && mkdir C:\NTttcp && copy "C:\Program Files (x86)\Microsoft Corporation\NT Testing TCP Tool\*" C:\NTttcp && cd C:\NTttcp\ && copy NTttcp_%s.exe NTttcps.exe && copy NTttcp_%s.exe NTttcpr.exe"'
+
- ethtool: install setup image_copy unattended_install.cdrom
only Linux
type = ethtool
diff --git a/client/virt/tests/ntttcp.py b/client/virt/tests/ntttcp.py
new file mode 100644
index 0000000..4a1f7b0
--- /dev/null
+++ b/client/virt/tests/ntttcp.py
@@ -0,0 +1,160 @@
+import logging, os, glob, re
+from autotest_lib.client.common_lib import error
+from autotest_lib.client.virt import virt_utils
+
+_receiver_ready = False
+
+def run_ntttcp(test, params, env):
+ """
+ Run NTttcp on Windows guest
+
+ 1) Install NTttcp in server/client side by Autoit
+ 2) Start NTttcp in server/client side
+ 3) Get test results
+
+ @param test: kvm test object
+ @param params: Dictionary with the test parameters
+ @param env: Dictionary with test environment.
+ """
+ login_timeout = int(params.get("login_timeout", 360))
+ timeout = int(params.get("timeout"))
+ results_path = os.path.join(test.resultsdir,
+ 'raw_output_%s' % test.iteration)
+ if params.get("platform") == "64":
+ platform = "x64"
+ else:
+ platform = "x86"
+ buffers = params.get("buffers").split()
+ session_num = params.get("session_num")
+
+ vm_sender = env.get_vm(params["main_vm"])
+ vm_sender.verify_alive()
+ vm_receiver = None
+ receiver_addr = params.get("receiver_address")
+ if not receiver_addr:
+ vm_receiver = env.get_vm("vm2")
+ vm_receiver.verify_alive()
+ try:
+ sess = None
+ sess = vm_receiver.wait_for_login(timeout=login_timeout)
+ receiver_addr = vm_receiver.get_address()
+ if not receiver_addr:
+ raise error.TestError("Can't get receiver(%s) ip address" %
+ vm_sender.name)
+ finally:
+ if sess:
+ sess.close()
+
+ def install_ntttcp(session):
+ """ Install ntttcp through a remote session """
+ logging.info("Installing NTttcp ...")
+ if session.cmd_status(params.get("check_ntttcp_cmd")) == 0:
+ # Don't install ntttcp if it's already installed
+ logging.info("NTttcp directory already exists")
+ return
+ ntttcp_install_cmd = params.get("ntttcp_install_cmd")
+ ret, output = session.cmd_status_output(ntttcp_install_cmd %
+ (platform, platform), timeout=200)
+ if ret != 0:
+ logging.error(output)
+ raise error.TestError("Can't install NTttcp on guest")
+
+ def receiver():
+ """ Receive side """
+ logging.info("Starting receiver process on %s", receiver_addr)
+ if vm_receiver:
+ session = vm_receiver.wait_for_login(timeout=login_timeout)
+ else:
+ username = params.get("username", "")
+ password = params.get("password", "")
+ prompt = params.get("shell_prompt", "[\#\$]")
+ linesep = eval("'%s'" % params.get("shell_linesep", r"\n"))
+ client = params.get("shell_client")
+ port = int(params.get("shell_port"))
+ log_filename = ("session-%s-%s.log" % (receiver_addr,
+ virt_utils.generate_random_string(4)))
+ session = virt_utils.remote_login(client, receiver_addr, port,
+ username, password, prompt,
+ linesep, log_filename, timeout)
+ install_ntttcp(session)
+ ntttcp_receiver_cmd = params.get("ntttcp_receiver_cmd")
+ global _receiver_ready
+ f = open(results_path + ".receiver", 'a')
+ for b in buffers:
+ _receiver_ready = True
+ cmd = ntttcp_receiver_cmd % (session_num, receiver_addr)
+ r = session.cmd_output(cmd, timeout=timeout,
+ print_func=logging.debug)
+ _receiver_ready = False
+ f.write("Send buffer size: %s\n%s\n%s" % (b, cmd, r))
+ f.close()
+ session.close()
+
+ def _wait():
+ """ Check if receiver is ready """
+ global _receiver_ready
+ if _receiver_ready:
+ return _receiver_ready
+ return None
+
+ def sender():
+ """ Send side """
+ logging.info("Sarting sender process ...")
+ session = vm_sender.wait_for_login(timeout=login_timeout)
+ install_ntttcp(session)
+ ntttcp_sender_cmd = params.get("ntttcp_sender_cmd")
+ f = open(results_path + ".sender", 'a')
+ try:
+ for b in buffers:
+ cmd = ntttcp_sender_cmd % (session_num, receiver_addr, b)
+ # Wait until receiver ready
+ virt_utils.wait_for(_wait, timeout)
+ r = session.cmd_output(cmd, timeout=timeout,
+ print_func=logging.debug)
+ f.write("Send buffer size: %s\n%s\n%s" % (b, cmd, r))
+ finally:
+ f.close()
+ session.close()
+
+ def parse_file(resultfile):
+ """ Parse raw result files and generate files with standard format """
+ file = open(resultfile, "r")
+ list= []
+ found = False
+ for line in file.readlines():
+ o = re.findall("Send buffer size: (\d+)", line)
+ if o:
+ buffer = o[0]
+ if "Total Throughput(Mbit/s)" in line:
+ found = True
+ if found:
+ fields = line.split()
+ if len(fields) == 0:
+ continue
+ try:
+ [float(i) for i in fields]
+ list.append([buffer, fields[-1]])
+ except ValueError:
+ continue
+ found = False
+ return list
+
+ try:
+ bg = virt_utils.Thread(receiver, ())
+ bg.start()
+ if bg.is_alive():
+ sender()
+ bg.join(suppress_exception=True)
+ else:
+ raise error.TestError("Can't start backgroud receiver thread")
+ finally:
+ for i in glob.glob("%s.receiver" % results_path):
+ f = open("%s.RHS" % results_path, "w")
+ raw = " buf(k)| throughput(Mbit/s)"
+ logging.info(raw)
+ f.write(raw + "\n")
+ for j in parse_file(i):
+ raw = "%8s| %8s" % (j[0], j[1])
+ logging.info(raw)
+ f.write(raw + "\n")
+ f.close()
next prev parent reply other threads:[~2011-12-23 10:28 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-23 10:28 [RFC PATCH 0/4] Network performance regression Amos Kong
2011-12-23 10:28 ` Amos Kong [this message]
2011-12-23 10:28 ` [RFC PATCH 2/4] virt-test: Refactor netperf test and add analysis module Amos Kong
2011-12-23 10:28 ` [RFC PATCH 3/4] netperf: pin guest vcpus/memory/vhost thread to numa node Amos Kong
2011-12-23 10:28 ` [RFC PATCH 4/4] virt: Introduce regression testing infrastructure Amos Kong
2011-12-24 1:13 ` Yang Hamo Bai
2011-12-25 1:26 ` Amos Kong
2011-12-29 13:12 ` [RFC PATCH 0/4] Network performance regression Amos Kong
2012-01-05 3:05 ` [Autotest PATCH v2 " Amos Kong
2012-01-05 3:05 ` [Autotest PATCH v2 1/4] virt-test: add NTttcp subtests Amos Kong
2012-01-05 3:06 ` [Autotest PATCH v2 2/4] virt-test: Refactor netperf test and add analysis module Amos Kong
2012-01-05 3:06 ` [Autotest PATCH v2 3/4] netperf: pin guest vcpus/memory/vhost thread to numa node Amos Kong
2012-01-05 3:06 ` [Autotest PATCH v2 4/4] virt: Introduce regression testing infrastructure Amos Kong
2012-01-06 20:17 ` [Autotest PATCH v2 0/4] Network performance regression Lucas Meneghel Rodrigues
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20111223102825.29662.79244.stgit@dhcp-8-167.nay.redhat.com \
--to=akong@redhat.com \
--cc=autotest@test.kernel.org \
--cc=jasowang@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=lmr@redhat.com \
--cc=rhod@redhat.com \
--cc=wquan@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).