[qmtest] File Attachment line endings mangled
Ken Horovatin
ken.horovatin at autodesk.com
Wed Mar 15 21:36:20 UTC 2006
-----Original Message-----
From: Mark Mitchell [mailto:mark at codesourcery.com]
Sent: March 8, 2006 3:50 PM
To: Ken Horovatin
Cc: qmtest at codesourcery.com
Subject: Re: [qmtest] File Attachment line endings mangled
Ken Horovatin wrote:
> The problem I'm facing is that, when the file attachments (all text)
> are copied to the attachment store in the test database, something is
> mangling the files: files that use a Unix line-end are copied to the
> store unmolested, but files with a DOS line-end (CRLF) end up with
> mangled line ends (i.e. the CRLF seems to be reversed to a LFCR). As a
> result, the tests fail.
That's really strange. Are you sure it's turning into LF/CR and not
just the UNIX LF convention? I can't think of anything that would
mangle it in the way that you suggest.
--
Mark Mitchell
CodeSourcery
mark at codesourcery.com
(650) 331-3385 x713
------------------------------
Mark,
I've encountered this issue in another place in my test class. My
previous description of the issue above is incorrect: the source file
has Windows-style line endings (\r\n), and when they get copied to the
attachment store, they end up with an extra carriage return in the line
ending (\r\r\n).
Normally this wouldn't be a problem except for a couple of specifics to
my test setup. Some of the copied files are PHP test scripts that get
copied to a server under test: PHP chokes on the modified files. Also,
when I try to use an attachment file as a baseline to compare to a test
result, the comparison fails. I'm opening the attachment in Python using
the flags "rb", because sometimes the expected result is text, and
sometimes it is binary.
On the text front, I've tried using the Python string "splitlines()"
function to disregard line endings, but it creates extra elements in the
resulting list for each "\r".
I'm planning on working around this problem a couple of ways: I'm now
copying the PHP files without using the attachment store, and I'm
thinking of splitting my baseline comparison so text baselines are
opened using only the "r" flag and binaries are opened using the "rb" as
before.
Some more information that may be pertinent: QMTest is being run on
Windows XP SP2 using ActivePython 2.4.2.
Despite the fact that I'm thinking of working around this issue, I'd
still like to know what, if anything, I'm doing wrong.
Thanks in advance for any guidance you can offer.
Cheers,
Ken Horovatin
More information about the qmtest
mailing list