All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Wei Liu <wei.liu2@citrix.com>
Cc: Xen-devel <xen-devel@lists.xenproject.org>,
	Ian Jackson <Ian.Jackson@eu.citrix.com>
Subject: Re: [XTF PATCH 1/3] xtf-runner: introduce get_xen_version
Date: Thu, 11 Aug 2016 11:14:02 +0100	[thread overview]
Message-ID: <4e1b1b35-9a93-c3ae-16fe-33923931da59@citrix.com> (raw)
In-Reply-To: <20160811101235.GG20641@citrix.com>

On 11/08/16 11:12, Wei Liu wrote:
> On Thu, Aug 11, 2016 at 11:10:41AM +0100, Andrew Cooper wrote:
>> On 10/08/16 16:07, Wei Liu wrote:
>>> Signed-off-by: Wei Liu <wei.liu2@citrix.com>
>>> ---
>>>  xtf-runner | 13 +++++++++++++
>>>  1 file changed, 13 insertions(+)
>>>
>>> diff --git a/xtf-runner b/xtf-runner
>>> index c063699..7b69c45 100755
>>> --- a/xtf-runner
>>> +++ b/xtf-runner
>>> @@ -151,6 +151,19 @@ def __repr__(self):
>>>          return "TestInfo(%s)" % (self.name, )
>>>  
>>>  
>>> +def get_xen_version():
>>> +    """Get the version string of Xen"""
>>> +
>>> +    for line in check_output(['xl', 'info']).splitlines():
>>> +        if not line.startswith("xen_version"):
>>> +            continue
>>> +
>>> +        version_str = line.split()[2:][0]
>>> +        break
>>> +
>>> +    return version_str
>> This will hit a name error if xen_version isn't found in the output.
>>
>> A better option would be to "return line.split()[2:][0]" directly and
>> raise a RunnerError() at this point.
>>
>> However, xen_version was introduced by me a while ago, but not so very
>> long ago, and won't work on older versions of Xen.
>>
> Oh, didn't notice that. I thought it was available to all versions of
> Xen.
>
>> I think at this point, it would just be easier to use the python libxc
>> bindings, so
>>
>> from xen.lowlevel.xc import xc
>> libxc = xc()
>>
>> info = libxc.xeninfo()
>> return "%s.%s" % (info["xen_major"], info["xen_minor"])

Erm - these should be %d not %s.

Sorry for the misinformation.

~Andrew

>>
>> Make sure the import statement is inside the function call to avoid
>> breaking the usecase of `xtf-runner --list` offhost.
>>
> NP.
>
> Wei.
>
>> ~Andrew
>>
>>> +
>>> +
>>>  def parse_test_instance_string(arg):
>>>      """Parse a test instance string.
>>>  


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

  reply	other threads:[~2016-08-11 10:14 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-10 15:07 [XTF PATCH 0/3] Support getting output from either console or log file Wei Liu
2016-08-10 15:07 ` [XTF PATCH 1/3] xtf-runner: introduce get_xen_version Wei Liu
2016-08-11 10:10   ` Andrew Cooper
2016-08-11 10:12     ` Wei Liu
2016-08-11 10:14       ` Andrew Cooper [this message]
2016-08-10 15:07 ` [XTF PATCH 2/3] xtf-runner: options for different modes to get output Wei Liu
2016-08-10 15:07 ` [XTF PATCH 3/3] xtf-runner: support two modes for getting output Wei Liu
2016-08-11  8:33   ` Wei Liu
2016-08-11  9:44     ` Wei Liu
2016-08-11  9:56       ` Andrew Cooper
2016-08-11 10:05         ` Wei Liu
2016-08-11 11:08         ` Ian Jackson
2016-08-11 11:19           ` Wei Liu
2016-08-11 11:41             ` Andrew Cooper
2016-08-11 10:49   ` Ian Jackson
2016-08-11 11:03     ` Wei Liu

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=4e1b1b35-9a93-c3ae-16fe-33923931da59@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xenproject.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.