On 11/08/16 18:51, Wei Liu wrote: > On Thu, Aug 11, 2016 at 06:17:31PM +0100, Ian Jackson wrote: >> Wei Liu writes ("Re: [XTF PATCH v2] xtf-runner: support two modes for >> getting output"): >>> On Thu, Aug 11, 2016 at 05:27:56PM +0100, Ian Jackson wrote: >>>> 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. >> open("t", O_RDONLY|O_CREAT, 0666) = 3 >> >> But maybe you mean Python's open doesn't. >> >>> Andy my experiment showed that "rb" doesn't create the file. >> Yes, it wouldn't. If you want a fopen mode, "a+" may be of some use. >> >>>>> + 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. >> Seriously? Fine, whatever. >> >>>>> + 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? >> Does xenconsole write the remaining output to the logfile before >> deleting the tty node from xenstore ? >> > Unfortunately no, watching tty node in xenstore won't work. In fact, > xenconsoled doesn't delete the tty node at all. It's libxl that deletes > it AFAICT. > > It is sure that xenconsoled will close the tty before closing the file, > so stat'ing the actual device node won't work either. > > I'm pretty out of idea here.
Because of XTF's behaviour (waiting for xenconsoled to catch up), you know for certain that once `xl create` has finished, nothing more will write into the log. This is a catch 22 situation though, as I specifically want to avoid that behaviour. Perhaps it is acceptable in logfile mode, if we can get `xl console` mode working without the synchronous delay. ~Andrew _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel