dejagnu
[Top][All Lists]
Advanced

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

Re: testsuite under wine


From: Jacob Bachmeyer
Subject: Re: testsuite under wine
Date: Fri, 23 Dec 2022 22:00:36 -0600
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8.1.22) Gecko/20090807 SeaMonkey/1.1.17 Mnenhy/0.7.6.0

NightStrike wrote:
On Wed, Dec 21, 2022 at 11:37 PM Jacob Bachmeyer <jcb62281@gmail.com> wrote:
NightStrike wrote:
[...]
Second, the problems with extra \r's still remain, but I think we've
generally come to think that that part isn't Wine and is instead
either the testsuite or deja.  So I'll keep those replies to Jacob's
previous message.

Most likely, it is a combination of the MinGW libc (which emits "\r\n"
for end-of-line in accordance with Windows convention) and the kernel
terminal driver (which passes "\r" and translates "\n" to "\r\n" in
accordance with POSIX convention).  Wine, short of trying to translate
"\r\n" back to "\n" in accordance with POSIX conventions (and likely
making an even bigger mess---does Wine know if a handle is supposed to
be text or binary?) cannot really fix this, so the testsuite needs to
handle non-POSIX-standard line endings.  (The Rust tests probably have
an outright bug if the newlines are being duplicated.)

You may be onto something here.  I ran wine under script as `script -c
"wine64 ./a.exe" out` (thanks, Arsen!), and it had the same extra \r
prepended to the \r\n.  I was making the mistake previously of running
wine manually and capturing it to a file as `wine64 ./a.exe > out`,
which as several have pointed out in this thread, that would disable
the quirk, so of course it didn't reveal any problems.  I'm behind,
but I'll catch up to you guys eventually :)

So close, and yet so far... script(1) /also/ uses a pty, so it is getting the same translations as Expect and therefore DejaGnu.

So at least we know for sure that this particular instance of extra
characters is coming from Wine.  Maybe Wine can be smart enough to
only translate \n into \r\n instead of translating \r\n into \r\r\n.
Jacek / Eric, comments here?  I'm happy to try another patch, the
first one was great.

I doubt that Wine is doing that translation. MinGW libc produces output conformant to Windows conventions, so printf("\n") on a text handle emits "\r\n", which Wine passes along. POSIX convention is that "\n" is translated to "\r\n" in the kernel terminal driver upon output, so the kernel translates the "\n" in the "\r\n" into /another/ "\r\n", yielding "\r\r\n" at the pty master end. This is why DejaGnu testsuites must be prepared to discard excess carriage returns. The first CR came from MinGW libc; the second CR came from the kernel terminal driver; the LF was ultimately passed through.

Rust is getting \r\r\n\n (as opposed to \r\n\r\n), so...  yeah.  Could
be the rust test, could be the rust frontend, could be another weird
Wine interaction.

That is probably either a Rust bug or the intended behavior. Does the test produce "\n\n" or "\r\n\n" when run natively? (Note that the terminal driver could reasonably optimize: once one CR has been produced, any number of LF may follow: the cursor is assumed to remain at the left edge. It is possible that the kernel terminal driver could even strip the second CR in "\r\n\r\n" since its only effect on an actual serial terminal would be wasting transmission time.)


-- Jacob



reply via email to

[Prev in Thread] Current Thread [Next in Thread]