Looks good, applied, thanks! On Thu, Dec 27, 2012 at 3:37 AM, Amos Kong <[email protected]> wrote: > Result file was not copied from remote machine to localhost > when checking if all threads work, this patch fixed it. > And add one more client session for controlling. > > Signed-off-by: Amos Kong <[email protected]> > --- > tests/netperf.py | 21 ++++++++++++--------- > 1 files changed, 12 insertions(+), 9 deletions(-) > > diff --git a/tests/netperf.py b/tests/netperf.py > index 68090fc..d91fa0f 100644 > --- a/tests/netperf.py > +++ b/tests/netperf.py > @@ -166,7 +166,7 @@ def run_netperf(test, params, env): > sessions_str = params.get('sessions') + " " + > params.get("sessions_rr") > for i in sessions_str.split(): > clients_n = max(clients_n, int(i.strip())) > - for i in range(clients_n): > + for i in range(clients_n + 1): > if client in params.get("vms"): > vm_client = utils_test.get_living_vm(env, client) > tmp = vm_client.wait_for_login(timeout=login_timeout) > @@ -498,13 +498,16 @@ def launch_client(sessions, server, server_ctl, host, > clients, l, nf_args, > niteration = nresult / sessions > result = 0.0 > for this in lines[-sessions * niteration:]: > - result += float(re.findall("Interim result: *(\S+)", this)[0]) > + if "Interim" in this: > + result += float(re.findall("Interim result: *(\S+)", > this)[0]) > result = result / niteration > logging.debug("niteration: %s" % niteration) > return result > > > pid = str(os.getpid()) > + fname = "/tmp/netperf.%s.nf" % pid > + ssh_cmd(clients[-1], "rm -f %s" % fname) > threads = [] > numa_enable = params.get("netperf_with_numa", "yes") == "yes" > for i in range(int(sessions)): > @@ -515,13 +518,11 @@ def launch_client(sessions, server, server_ctl, host, > clients, l, nf_args, > t.start() > ret = {} > ret['pid'] = pid > - fname = "/tmp/netperf.%s.nf" % pid > + > while True: > try: > - fd = open(fname) > - content = "".join(fd.readlines()) > - fd.close() > - except IOError: > + content = ssh_cmd(clients[-1], "cat %s" % fname) > + except: > content = "" > if int(sessions) == len(re.findall("MIGRATE", content)): > logging.debug("All netperf clients start to work.") > @@ -531,7 +532,7 @@ def launch_client(sessions, server, server_ctl, host, > clients, l, nf_args, > if get_status_flag: > start_state = get_state() > ret['mpstat'] = ssh_cmd(host, "mpstat 1 %d |tail -n 1" % (l - 1)) > - shutil.copy(fname, "/tmp/finished_result") > + finished_result = ssh_cmd(clients[-1], "cat %s" % fname) > > # real & effective test ends > if get_status_flag: > @@ -550,6 +551,8 @@ def launch_client(sessions, server, server_ctl, host, > clients, l, nf_args, > t.join() > > # recover result file to remove the noise from end > - shutil.copy("/tmp/finished_result", fname) > + f = open(fname, "w") > + f.write(finished_result) > + f.close() > ret['thu'] = parse_demo_result(fname, int(sessions)) > return ret > -- > 1.7.1 > > _______________________________________________ > Virt-test-devel mailing list > [email protected] > https://www.redhat.com/mailman/listinfo/virt-test-devel
-- Lucas _______________________________________________ Autotest-kernel mailing list [email protected] https://www.redhat.com/mailman/listinfo/autotest-kernel
