Re: [PATCH kvm-unit-tests 5/5] x86-run: Pull extra arguments from unittests.cfg

2013-04-14 Thread Cole Robinson
On 04/14/2013 09:40 AM, Gleb Natapov wrote:
> On Mon, Mar 25, 2013 at 02:30:27PM -0400, Cole Robinson wrote:
>> On 03/20/2013 03:06 PM, Marcelo Tosatti wrote:
>>> On Sun, Mar 17, 2013 at 07:58:56PM -0400, Cole Robinson wrote:
 On 03/17/2013 11:25 AM, Gleb Natapov wrote:
> On Fri, Mar 15, 2013 at 08:09:09PM -0400, Cole Robinson wrote:
>> Some tests want extra arguments as enumerated in unittests.cfg,
>> use them.
>>
>> unittests.cfg also has a few sections about invoking certains tests
>> with different combinations of options, but x86-run doesn't do
>> anything with that.
> With this it will not be possible to use x86-run outside of autotest,
> no?
>

 Not true, x86-run is still meant to be the standalone helper script for
 running unittests. autotest doesn't care about x86-run, and ConfigParser 
 is a
 standard python module.

 x86/unittests.cfg already exists in the kvm-unit-tests repo, I assumed it 
 was
 encoding required test options but maybe I'm wrong about that. It's still
 useful to build off of if there's value in running some tests with 
 different
 combinations of parameters.
>>>
>>> I fail to see what is the point here.
>>>
>>> unittests.cfg has been originally (and continues to be, AFAIK), intended
>>> for autotest:
>>> http://kerneltrap.org/mailarchive/linux-kvm/2010/6/24/6264146
>>>
>>> Please don't remove manual execution from README.
>>
>> I guess I'm misunderstanding things here.
>>
>> I understood that unittests.cfg was only being used by autotest. What 
>> confused
>> me was that this config enumerates different command line options for some of
>> the tests. Why is autotest invoking these test cases with different options
>> than the README suggests? Which one is right?
>>
> Neither. README just have examples how to enable test device in various
> versions of QEMU. unittests.cfg suppose to have reasonable configuration
> for each test which is less likely to fail on most kernel. For instance
> I may add a fix for a kernel bug and a test case for the bug. Since the
> bug is not fixed on any released kernel autotest will start to fail,
> so it may sense to disable the test in unittests.cfg meanwhile. Or I can
> add a test that crashes kernel if it fails. It is probably not wise to
> enable it for autotest, but running it manually will be still possible.
> 
>> If unittests.cfg is the canonical list of options, than the README needs to
>> document different command lines for each test. If the README is canonical,
>> then I don't understand why autotest is using their own options.
>>
> I do not quite understand what do you mean here. README just have an
> example on how to enable test device in QEMU. unittests.cfg does not
> control that.
> 

Okay, sorry for the confusion. I revived the example invocations and reposted.

Thanks,
Cole

>> My intent was to unify the two, so that autotest wouldn't reproduce an error
>> that the kvm-unit-test docs might miss. And if there's ever a new unit test
>> added that requires non-default qemu options, or is useful to run with a few
>> permutations of cli options, unittests.cfg can be extended and x86-run will
>> just do the right thing.
>>
>> Does that make sense?
>>
>> Thanks,
>> Cole
> 
> --
>   Gleb.
> 

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH kvm-unit-tests 5/5] x86-run: Pull extra arguments from unittests.cfg

2013-04-14 Thread Gleb Natapov
On Mon, Mar 25, 2013 at 02:30:27PM -0400, Cole Robinson wrote:
> On 03/20/2013 03:06 PM, Marcelo Tosatti wrote:
> > On Sun, Mar 17, 2013 at 07:58:56PM -0400, Cole Robinson wrote:
> >> On 03/17/2013 11:25 AM, Gleb Natapov wrote:
> >>> On Fri, Mar 15, 2013 at 08:09:09PM -0400, Cole Robinson wrote:
>  Some tests want extra arguments as enumerated in unittests.cfg,
>  use them.
> 
>  unittests.cfg also has a few sections about invoking certains tests
>  with different combinations of options, but x86-run doesn't do
>  anything with that.
> >>> With this it will not be possible to use x86-run outside of autotest,
> >>> no?
> >>>
> >>
> >> Not true, x86-run is still meant to be the standalone helper script for
> >> running unittests. autotest doesn't care about x86-run, and ConfigParser 
> >> is a
> >> standard python module.
> >>
> >> x86/unittests.cfg already exists in the kvm-unit-tests repo, I assumed it 
> >> was
> >> encoding required test options but maybe I'm wrong about that. It's still
> >> useful to build off of if there's value in running some tests with 
> >> different
> >> combinations of parameters.
> > 
> > I fail to see what is the point here.
> > 
> > unittests.cfg has been originally (and continues to be, AFAIK), intended
> > for autotest:
> > http://kerneltrap.org/mailarchive/linux-kvm/2010/6/24/6264146
> > 
> > Please don't remove manual execution from README.
> 
> I guess I'm misunderstanding things here.
> 
> I understood that unittests.cfg was only being used by autotest. What confused
> me was that this config enumerates different command line options for some of
> the tests. Why is autotest invoking these test cases with different options
> than the README suggests? Which one is right?
> 
Neither. README just have examples how to enable test device in various
versions of QEMU. unittests.cfg suppose to have reasonable configuration
for each test which is less likely to fail on most kernel. For instance
I may add a fix for a kernel bug and a test case for the bug. Since the
bug is not fixed on any released kernel autotest will start to fail,
so it may sense to disable the test in unittests.cfg meanwhile. Or I can
add a test that crashes kernel if it fails. It is probably not wise to
enable it for autotest, but running it manually will be still possible.

> If unittests.cfg is the canonical list of options, than the README needs to
> document different command lines for each test. If the README is canonical,
> then I don't understand why autotest is using their own options.
> 
I do not quite understand what do you mean here. README just have an
example on how to enable test device in QEMU. unittests.cfg does not
control that.

> My intent was to unify the two, so that autotest wouldn't reproduce an error
> that the kvm-unit-test docs might miss. And if there's ever a new unit test
> added that requires non-default qemu options, or is useful to run with a few
> permutations of cli options, unittests.cfg can be extended and x86-run will
> just do the right thing.
> 
> Does that make sense?
> 
> Thanks,
> Cole

--
Gleb.
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH kvm-unit-tests 5/5] x86-run: Pull extra arguments from unittests.cfg

2013-03-25 Thread Cole Robinson
On 03/20/2013 03:06 PM, Marcelo Tosatti wrote:
> On Sun, Mar 17, 2013 at 07:58:56PM -0400, Cole Robinson wrote:
>> On 03/17/2013 11:25 AM, Gleb Natapov wrote:
>>> On Fri, Mar 15, 2013 at 08:09:09PM -0400, Cole Robinson wrote:
 Some tests want extra arguments as enumerated in unittests.cfg,
 use them.

 unittests.cfg also has a few sections about invoking certains tests
 with different combinations of options, but x86-run doesn't do
 anything with that.
>>> With this it will not be possible to use x86-run outside of autotest,
>>> no?
>>>
>>
>> Not true, x86-run is still meant to be the standalone helper script for
>> running unittests. autotest doesn't care about x86-run, and ConfigParser is a
>> standard python module.
>>
>> x86/unittests.cfg already exists in the kvm-unit-tests repo, I assumed it was
>> encoding required test options but maybe I'm wrong about that. It's still
>> useful to build off of if there's value in running some tests with different
>> combinations of parameters.
> 
> I fail to see what is the point here.
> 
> unittests.cfg has been originally (and continues to be, AFAIK), intended
> for autotest:
> http://kerneltrap.org/mailarchive/linux-kvm/2010/6/24/6264146
> 
> Please don't remove manual execution from README.

I guess I'm misunderstanding things here.

I understood that unittests.cfg was only being used by autotest. What confused
me was that this config enumerates different command line options for some of
the tests. Why is autotest invoking these test cases with different options
than the README suggests? Which one is right?

If unittests.cfg is the canonical list of options, than the README needs to
document different command lines for each test. If the README is canonical,
then I don't understand why autotest is using their own options.

My intent was to unify the two, so that autotest wouldn't reproduce an error
that the kvm-unit-test docs might miss. And if there's ever a new unit test
added that requires non-default qemu options, or is useful to run with a few
permutations of cli options, unittests.cfg can be extended and x86-run will
just do the right thing.

Does that make sense?

Thanks,
Cole
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH kvm-unit-tests 5/5] x86-run: Pull extra arguments from unittests.cfg

2013-03-20 Thread Marcelo Tosatti
On Sun, Mar 17, 2013 at 07:58:56PM -0400, Cole Robinson wrote:
> On 03/17/2013 11:25 AM, Gleb Natapov wrote:
> > On Fri, Mar 15, 2013 at 08:09:09PM -0400, Cole Robinson wrote:
> >> Some tests want extra arguments as enumerated in unittests.cfg,
> >> use them.
> >>
> >> unittests.cfg also has a few sections about invoking certains tests
> >> with different combinations of options, but x86-run doesn't do
> >> anything with that.
> > With this it will not be possible to use x86-run outside of autotest,
> > no?
> > 
> 
> Not true, x86-run is still meant to be the standalone helper script for
> running unittests. autotest doesn't care about x86-run, and ConfigParser is a
> standard python module.
> 
> x86/unittests.cfg already exists in the kvm-unit-tests repo, I assumed it was
> encoding required test options but maybe I'm wrong about that. It's still
> useful to build off of if there's value in running some tests with different
> combinations of parameters.

I fail to see what is the point here.

unittests.cfg has been originally (and continues to be, AFAIK), intended
for autotest:
http://kerneltrap.org/mailarchive/linux-kvm/2010/6/24/6264146

Please don't remove manual execution from README.


--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH kvm-unit-tests 5/5] x86-run: Pull extra arguments from unittests.cfg

2013-03-17 Thread Cole Robinson
On 03/17/2013 11:25 AM, Gleb Natapov wrote:
> On Fri, Mar 15, 2013 at 08:09:09PM -0400, Cole Robinson wrote:
>> Some tests want extra arguments as enumerated in unittests.cfg,
>> use them.
>>
>> unittests.cfg also has a few sections about invoking certains tests
>> with different combinations of options, but x86-run doesn't do
>> anything with that.
> With this it will not be possible to use x86-run outside of autotest,
> no?
> 

Not true, x86-run is still meant to be the standalone helper script for
running unittests. autotest doesn't care about x86-run, and ConfigParser is a
standard python module.

x86/unittests.cfg already exists in the kvm-unit-tests repo, I assumed it was
encoding required test options but maybe I'm wrong about that. It's still
useful to build off of if there's value in running some tests with different
combinations of parameters.

- Cole

>> ---
>>  x86-run | 20 
>>  1 file changed, 20 insertions(+)
>>
>> diff --git a/x86-run b/x86-run
>> index ab9eed9..7eebee2 100755
>> --- a/x86-run
>> +++ b/x86-run
>> @@ -1,5 +1,6 @@
>>  #!/usr/bin/env python
>>  
>> +import ConfigParser
>>  import glob
>>  import optparse
>>  import os
>> @@ -36,6 +37,24 @@ def check_qemu(binpath):
>>  
>>  return cmd + devcmd
>>  
>> +cfgfile = None
>> +def args_for_test(testfile):
>> +global cfgfile
>> +if not cfgfile:
>> +cfgfile = ConfigParser.ConfigParser()
>> +cfgfile.read("x86/unittests.cfg")
>> +
>> +testname = os.path.splitext(os.path.basename(testfile))[0]
>> +if testname not in cfgfile.sections():
>> +return ""
>> +
>> +cmd = ""
>> +if cfgfile.has_option(testname, "extra_params"):
>> +cmd += cfgfile.get(testname, "extra_params")
>> +if cfgfile.has_option(testname, "smp"):
>> +cmd += " -smp %s" % int(cfgfile.get(testname, "smp"))
>> +return cmd
>> +
>>  
>>  def parse_args():
>>  parser = optparse.OptionParser(
>> @@ -67,6 +86,7 @@ def main():
>>  ret = 0
>>  for testfile in testfiles:
>>  cmd = basecmd + " -kernel %s" % testfile
>> +cmd += " " + args_for_test(testfile)
>>  print cmd
>>  
>>  cmdret = os.system(cmd) >> 8
>> -- 
>> 1.8.1.4
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe kvm" in
>> the body of a message to majord...@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> --
>   Gleb.
> 

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH kvm-unit-tests 5/5] x86-run: Pull extra arguments from unittests.cfg

2013-03-17 Thread Gleb Natapov
On Fri, Mar 15, 2013 at 08:09:09PM -0400, Cole Robinson wrote:
> Some tests want extra arguments as enumerated in unittests.cfg,
> use them.
> 
> unittests.cfg also has a few sections about invoking certains tests
> with different combinations of options, but x86-run doesn't do
> anything with that.
With this it will not be possible to use x86-run outside of autotest,
no?

> ---
>  x86-run | 20 
>  1 file changed, 20 insertions(+)
> 
> diff --git a/x86-run b/x86-run
> index ab9eed9..7eebee2 100755
> --- a/x86-run
> +++ b/x86-run
> @@ -1,5 +1,6 @@
>  #!/usr/bin/env python
>  
> +import ConfigParser
>  import glob
>  import optparse
>  import os
> @@ -36,6 +37,24 @@ def check_qemu(binpath):
>  
>  return cmd + devcmd
>  
> +cfgfile = None
> +def args_for_test(testfile):
> +global cfgfile
> +if not cfgfile:
> +cfgfile = ConfigParser.ConfigParser()
> +cfgfile.read("x86/unittests.cfg")
> +
> +testname = os.path.splitext(os.path.basename(testfile))[0]
> +if testname not in cfgfile.sections():
> +return ""
> +
> +cmd = ""
> +if cfgfile.has_option(testname, "extra_params"):
> +cmd += cfgfile.get(testname, "extra_params")
> +if cfgfile.has_option(testname, "smp"):
> +cmd += " -smp %s" % int(cfgfile.get(testname, "smp"))
> +return cmd
> +
>  
>  def parse_args():
>  parser = optparse.OptionParser(
> @@ -67,6 +86,7 @@ def main():
>  ret = 0
>  for testfile in testfiles:
>  cmd = basecmd + " -kernel %s" % testfile
> +cmd += " " + args_for_test(testfile)
>  print cmd
>  
>  cmdret = os.system(cmd) >> 8
> -- 
> 1.8.1.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
Gleb.
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH kvm-unit-tests 5/5] x86-run: Pull extra arguments from unittests.cfg

2013-03-15 Thread Cole Robinson
Some tests want extra arguments as enumerated in unittests.cfg,
use them.

unittests.cfg also has a few sections about invoking certains tests
with different combinations of options, but x86-run doesn't do
anything with that.
---
 x86-run | 20 
 1 file changed, 20 insertions(+)

diff --git a/x86-run b/x86-run
index ab9eed9..7eebee2 100755
--- a/x86-run
+++ b/x86-run
@@ -1,5 +1,6 @@
 #!/usr/bin/env python
 
+import ConfigParser
 import glob
 import optparse
 import os
@@ -36,6 +37,24 @@ def check_qemu(binpath):
 
 return cmd + devcmd
 
+cfgfile = None
+def args_for_test(testfile):
+global cfgfile
+if not cfgfile:
+cfgfile = ConfigParser.ConfigParser()
+cfgfile.read("x86/unittests.cfg")
+
+testname = os.path.splitext(os.path.basename(testfile))[0]
+if testname not in cfgfile.sections():
+return ""
+
+cmd = ""
+if cfgfile.has_option(testname, "extra_params"):
+cmd += cfgfile.get(testname, "extra_params")
+if cfgfile.has_option(testname, "smp"):
+cmd += " -smp %s" % int(cfgfile.get(testname, "smp"))
+return cmd
+
 
 def parse_args():
 parser = optparse.OptionParser(
@@ -67,6 +86,7 @@ def main():
 ret = 0
 for testfile in testfiles:
 cmd = basecmd + " -kernel %s" % testfile
+cmd += " " + args_for_test(testfile)
 print cmd
 
 cmdret = os.system(cmd) >> 8
-- 
1.8.1.4

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html