* Re: [Autotest] [KVM-AUTOTEST PATCH 3/4] kvm_tests: Use autotest log files to scan results
[not found] <2104117119.1902681244884273485.JavaMail.root@zmail05.collab.prod.int.phx2.redhat.com>
@ 2009-06-13 9:13 ` Michael Goldish
2009-06-15 21:30 ` Lucas Meneghel Rodrigues
0 siblings, 1 reply; 2+ messages in thread
From: Michael Goldish @ 2009-06-13 9:13 UTC (permalink / raw)
To: Lucas Meneghel Rodrigues; +Cc: kvm, autotest
----- "Lucas Meneghel Rodrigues" <lmr@redhat.com> wrote:
> The 'autotest' kvm subtest was relying on autotest output, that
> now has the logging line prefixes. The logging line prefixes
> breaks the results parser, so we would either have to make the
> parser to strip the logging prefixes or read autotest status
> files generated on the results directory. The later is a simpler
> approach, so this patch implements it.
>
> Also, copy control files defined inside
> self.bindir/autotest_control directory to the guest. This way
> we can create more complex control files to run in guests
> without having to touch other tests directories.
>
> Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
> ---
> client/tests/kvm/kvm_tests.py | 22 ++++++++++++++++------
> 1 files changed, 16 insertions(+), 6 deletions(-)
>
> diff --git a/client/tests/kvm/kvm_tests.py
> b/client/tests/kvm/kvm_tests.py
> index 4b87a76..62e5161 100644
> --- a/client/tests/kvm/kvm_tests.py
> +++ b/client/tests/kvm/kvm_tests.py
> @@ -296,20 +296,30 @@ def run_autotest(test, params, env):
> if status != 0:
> raise error.TestFail("Could not extract %s.tar.bz2" %
> test_name)
>
> + # Cleaning up old remaining results
> + session.sendline("rm -rf autotest/results/*")
> + # Copying the selected control file (located inside
> + # test.bindir/autotest_control to the autotest dir
> + control_file_path = os.path.join(test.bindir,
> "autotest_control",
> + test_control_file)
> + if not vm.scp_to_remote(control_file_path, "autotest/control"):
> + raise error.TestFail("Could not copy the test control file to
> guest")
> # Run the test
> logging.info("Running test '%s'..." % test_name)
> - session.sendline("cd autotest/tests/%s" % test_name)
> - session.sendline("rm -f ./%s.state" % test_control_file)
> + session.sendline("cd autotest")
> + session.sendline("rm -f control.state")
> session.read_up_to_prompt()
> - session.sendline("../../bin/autotest ./%s" % test_control_file)
> + session.sendline("bin/autotest control")
> logging.info("---------------- Test output ----------------")
> - match, output = session.read_up_to_prompt(timeout=test_timeout,
> -
> print_func=logging.info)
> + match = session.read_up_to_prompt(timeout=test_timeout,
> + print_func=logging.info)[0]
> logging.info("---------------- End of test output
> ----------------")
> if not match:
> raise error.TestFail("Timeout elapsed while waiting for test
> to"
> " complete")
Do you think the space should be at the end of the first line or at the
beginning of the second? The only clue PEP 8 gives us is that operators
should be at the end of the first line. I'm not sure about this space.
It may not be important enough to spend time on.
> -
> + # Get the results generated by autotest
> + session.sendline("cat results/*/status")
> + output = session.read_up_to_prompt()[1]
You can use
output = session.get_command_output("cat results/*/status")
which will return a string that does not include the final prompt
(unlike read_up_to_prompt()). It's also a little shorter.
You can also use it to print the test output (between "Test output"
and "End of test output").
> session.close()
>
> # Parse test results
> --
> 1.6.2.2
>
> _______________________________________________
> Autotest mailing list
> Autotest@test.kernel.org
> http://test.kernel.org/cgi-bin/mailman/listinfo/autotest
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Autotest] [KVM-AUTOTEST PATCH 3/4] kvm_tests: Use autotest log files to scan results
2009-06-13 9:13 ` [Autotest] [KVM-AUTOTEST PATCH 3/4] kvm_tests: Use autotest log files to scan results Michael Goldish
@ 2009-06-15 21:30 ` Lucas Meneghel Rodrigues
0 siblings, 0 replies; 2+ messages in thread
From: Lucas Meneghel Rodrigues @ 2009-06-15 21:30 UTC (permalink / raw)
To: Michael Goldish; +Cc: kvm, autotest
On Sat, 2009-06-13 at 05:13 -0400, Michael Goldish wrote:
> ----- "Lucas Meneghel Rodrigues" <lmr@redhat.com> wrote:
>
> > The 'autotest' kvm subtest was relying on autotest output, that
> > now has the logging line prefixes. The logging line prefixes
> > breaks the results parser, so we would either have to make the
> > parser to strip the logging prefixes or read autotest status
> > files generated on the results directory. The later is a simpler
> > approach, so this patch implements it.
> >
> > Also, copy control files defined inside
> > self.bindir/autotest_control directory to the guest. This way
> > we can create more complex control files to run in guests
> > without having to touch other tests directories.
> >
> > Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
> > ---
> > client/tests/kvm/kvm_tests.py | 22 ++++++++++++++++------
> > 1 files changed, 16 insertions(+), 6 deletions(-)
> >
> > diff --git a/client/tests/kvm/kvm_tests.py
> > b/client/tests/kvm/kvm_tests.py
> > index 4b87a76..62e5161 100644
> > --- a/client/tests/kvm/kvm_tests.py
> > +++ b/client/tests/kvm/kvm_tests.py
> > @@ -296,20 +296,30 @@ def run_autotest(test, params, env):
> > if status != 0:
> > raise error.TestFail("Could not extract %s.tar.bz2" %
> > test_name)
> >
> > + # Cleaning up old remaining results
> > + session.sendline("rm -rf autotest/results/*")
> > + # Copying the selected control file (located inside
> > + # test.bindir/autotest_control to the autotest dir
> > + control_file_path = os.path.join(test.bindir,
> > "autotest_control",
> > + test_control_file)
> > + if not vm.scp_to_remote(control_file_path, "autotest/control"):
> > + raise error.TestFail("Could not copy the test control file to
> > guest")
> > # Run the test
> > logging.info("Running test '%s'..." % test_name)
> > - session.sendline("cd autotest/tests/%s" % test_name)
> > - session.sendline("rm -f ./%s.state" % test_control_file)
> > + session.sendline("cd autotest")
> > + session.sendline("rm -f control.state")
> > session.read_up_to_prompt()
> > - session.sendline("../../bin/autotest ./%s" % test_control_file)
> > + session.sendline("bin/autotest control")
> > logging.info("---------------- Test output ----------------")
> > - match, output = session.read_up_to_prompt(timeout=test_timeout,
> > -
> > print_func=logging.info)
> > + match = session.read_up_to_prompt(timeout=test_timeout,
> > + print_func=logging.info)[0]
> > logging.info("---------------- End of test output
> > ----------------")
> > if not match:
> > raise error.TestFail("Timeout elapsed while waiting for test
> > to"
> > " complete")
>
> Do you think the space should be at the end of the first line or at the
> beginning of the second? The only clue PEP 8 gives us is that operators
> should be at the end of the first line. I'm not sure about this space.
> It may not be important enough to spend time on.
Fair enough, space was moved to the end of the first line.
>
> > -
> > + # Get the results generated by autotest
> > + session.sendline("cat results/*/status")
> > + output = session.read_up_to_prompt()[1]
>
> You can use
>
> output = session.get_command_output("cat results/*/status")
>
> which will return a string that does not include the final prompt
> (unlike read_up_to_prompt()). It's also a little shorter.
> You can also use it to print the test output (between "Test output"
> and "End of test output").
Great, I've fixed that as well, thanks!
>
> > session.close()
> >
> > # Parse test results
> > --
> > 1.6.2.2
> >
> > _______________________________________________
> > Autotest mailing list
> > Autotest@test.kernel.org
> > http://test.kernel.org/cgi-bin/mailman/listinfo/autotest
--
Lucas Meneghel Rodrigues
Software Engineer (QE)
Red Hat - Emerging Technologies
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-06-15 21:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <2104117119.1902681244884273485.JavaMail.root@zmail05.collab.prod.int.phx2.redhat.com>
2009-06-13 9:13 ` [Autotest] [KVM-AUTOTEST PATCH 3/4] kvm_tests: Use autotest log files to scan results Michael Goldish
2009-06-15 21:30 ` Lucas Meneghel Rodrigues
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox