From: Wei Liu <wei.liu2@citrix.com>
To: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Xen-devel <xen-devel@lists.xenproject.org>,
Wei Liu <wei.liu2@citrix.com>,
andrew.cooper3@citrix.com
Subject: Re: [XTF PATCH v2] xtf-runner: support two modes for getting output
Date: Thu, 11 Aug 2016 17:50:47 +0100 [thread overview]
Message-ID: <20160811165047.GY20641@citrix.com> (raw)
In-Reply-To: <22444.42892.601201.9331@mariner.uk.xensource.com>
On Thu, Aug 11, 2016 at 05:27:56PM +0100, Ian Jackson wrote:
> Wei Liu writes ("[XTF PATCH v2] xtf-runner: support two modes for getting output"):
> > We need two modes for getting output:
> ...
> > + logfile = open(fn, "rb")
> > + except IOError as e:
> > + # Create file if it doesn't exist
> > + if e.errno == 2:
> > + logfile = open(fn, "ab")
> > + logfile.close()
> > + logfile = open(fn, "rb")
> > + else:
> > + raise e
>
> This is perverse. Why not just open it O_CREAT|O_RDONLY ? If Python
> can't do that then unconditionally opening it O_CREAT|O_RDWR would do.
>
The open call doesn't accept O_CREAT|O_RDONLY.
Andy my experiment showed that "rb" doesn't create the file.
> > + logfile.seek(0, 2) # Go to end of file
>
> Does Python not have SEEK_END somewhere ?
There is one, but that's in os module.
Python official document is using numeric values directly.
>
> > + lines = logfile.readlines()
> > + logfile.close()
> > +
> > + if len(lines) == 0:
> > + raise RunnerError("Test output empty")
>
> I think you are racing with xenconsoled here. How do you know that
> all the output has arrived ?
>
Unfortunately there doesn't seem to be a direct way to synchronise
between the two.
Maybe the best bet is to watch the tty node for it to go away?
Wei.
> Ian.
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2016-08-11 16:50 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-11 14:14 [XTF PATCH v2] xtf-runner: support two modes for getting output Wei Liu
2016-08-11 16:27 ` Ian Jackson
2016-08-11 16:50 ` Wei Liu [this message]
2016-08-11 17:17 ` Ian Jackson
2016-08-11 17:21 ` Andrew Cooper
2016-08-11 17:23 ` Wei Liu
2016-08-11 17:51 ` Wei Liu
2016-08-11 17:54 ` Andrew Cooper
2016-08-11 18:29 ` Ian Jackson
2016-08-12 9:23 ` Wei Liu
2016-08-12 9:51 ` Ian Jackson
2016-08-12 13:28 ` Wei Liu
2016-08-15 10:58 ` 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=20160811165047.GY20641@citrix.com \
--to=wei.liu2@citrix.com \
--cc=andrew.cooper3@citrix.com \
--cc=ian.jackson@eu.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).