public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Cole Robinson <crobinso@redhat.com>
To: Gleb Natapov <gleb@redhat.com>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH kvm-unit-tests 5/5] x86-run: Pull extra arguments from unittests.cfg
Date: Sun, 17 Mar 2013 19:58:56 -0400	[thread overview]
Message-ID: <514658C0.4060605@redhat.com> (raw)
In-Reply-To: <20130317152529.GP11223@redhat.com>

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 majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> --
> 			Gleb.
> 


  reply	other threads:[~2013-03-17 23:58 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-16  0:09 [PATCH kvm-unit-tests 1/5] .gitignore: Add *.flat and config.mak Cole Robinson
2013-03-16  0:09 ` [PATCH kvm-unit-tests 2/5] x86/README: Drop it Cole Robinson
2013-03-20 18:54   ` Marcelo Tosatti
2013-03-25 18:32     ` Cole Robinson
2013-03-16  0:09 ` [PATCH kvm-unit-tests 3/5] x86/run-kvm-unit-tests: " Cole Robinson
2013-03-16  0:09 ` [PATCH kvm-unit-tests 4/5] Rewrite x86-run in python Cole Robinson
2013-03-16  0:09 ` [PATCH kvm-unit-tests 5/5] x86-run: Pull extra arguments from unittests.cfg Cole Robinson
2013-03-17 15:25   ` Gleb Natapov
2013-03-17 23:58     ` Cole Robinson [this message]
2013-03-20 19:06       ` Marcelo Tosatti
2013-03-25 18:30         ` Cole Robinson
2013-04-14 13:40           ` Gleb Natapov
2013-04-14 18:20             ` Cole Robinson

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=514658C0.4060605@redhat.com \
    --to=crobinso@redhat.com \
    --cc=gleb@redhat.com \
    --cc=kvm@vger.kernel.org \
    /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