[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [XTF PATCH v2] xtf-runner: support two modes for getting output



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.

> +    logfile.seek(0, 2) # Go to end of file

Does Python not have SEEK_END somewhere ?

> +    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 ?

Ian.

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

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.