On Sun, Dec 18, 2022 at 11:29 PM Jacob Bachmeyer <jcb62...@gmail.com> wrote: > > NightStrike wrote: > > On Sat, Dec 17, 2022 at 10:44 PM Jacob Bachmeyer <jcb62...@gmail.com> wrote: > > > >> [...] > >> This is either a testsuite problem or an environment problem. The GNU > >> Fortran I/O module certainly has interesting behavior here. Try setting > >> TERM=dumb in the environment while running the testsuite. If that fixes > >> the problem, it may be appropriate to add "set ::env(TERM) dumb" to the > >> tool init file for GNU Fortran. > >> > > > > Setting TERM doesn't help. Wine tries to emulate the windows console, > > which requires outputting this stuff. It does so any time there's a > > pty, and I believe that Deja creates a pty when running the tests. > > > > That is a bug in Wine: the escapes should be suppressed entirely if the > terminal does not support them---and the "dumb" terminal does not > support them.
I think it's a paradigm difference. I'm just guessing here, but Wine runs in a terminal that doesn't know about TERM. It's mimicking the "cmd.exe" that you'd run on a native Windows system (I think... I'd welcome corrections from those more knowledgeable). In theory, the effect would be the same if I set up a remote target board to ssh to a windows system and get dropped into a cmd.exe shell (I used to run this way... it'd take about a week to run the whole testsuite. It sucked...) [...snip for now, I'm working on getting reasonable output back to you, including an example of a case that fails, and how it responds to your suggestion. Stay tuned...] > > For now, I modified Wine to kludge out the code that > > creates the console, and a long term solution needs to be on the Wine > > side. I was just hoping for a less dirty hack from the Deja side. > > > > I think that the long-term solution is that Wine should properly honor > the TERM environment variable and not produce escape codes that the > declared terminal does not support. Agreed, just trying to get by for now. > > Note that there are other problems, too. It seems that when Deja is > > matching against "\n", it doesn't handle the different line endings of > > Windows correctly in a cross environment. Is there a way that I can > > set how to interpret \n in a target-board file? This affects fortran > > and other language tests also. > > No---problems related to line endings are bugs in the testsuite. This > caveat is documented in *Note: (dejagnu)Writing a test case. The manual > explains: "Note that terminal settings may result in the insertion of > additional `\r' characters, usually translating `\n' to `\r\n'." > > At the terminal layer, POSIX can *also* use "\r\n" sequences, since some > terminals historically needed them, even though the standard line ending > *within* a POSIX system is "\n" by itself. Because a pty simply > presents the "terminal" side of the interface to the controlling > program, Expect can receive "\r\n" when the subprocess emits "\n"; the > translation is performed by the kernel terminal driver and DejaGnu > testsuites must be prepared to receive (and discard) excess carriage > returns in the general case. Here's one that tries to handle different line endings (most tests do not do this): gfortran.dg/parameter_array_dummy.f90 which uses: ! { dg-output " *1 aa(\n|\r\n|\r)" } ! { dg-output " *2 ab(\n|\r\n|\r)" } ! { dg-output " *3 aaab(\n|\r\n|\r)" } ! { dg-output " *4 abaa(\n|\r\n|\r)" } ! { dg-output " *5 ababab(\n|\r\n|\r)" } But this results in: FAIL: gfortran.dg/parameter_array_dummy.f90 -O0 output pattern test Output was: 1 aa^M^M 2 ab^M^M 3 aaab^M^M 4 abaa^M^M 5 ababab^M^M Should match: *1 aa( |^M |^M) *2 ab( |^M |^M) *3 aaab( |^M |^M) *4 abaa( |^M |^M) *5 ababab( |^M |^M) The problem being that we are getting "0x0d 0x0d 0x0a", or \r\r\n. (Other examples fail differently, for instance there's a Rust test that outputs \r\r\n\n... but let's start with this one).