This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RTEMS FORTRAN Pattern Failures


On 1/12/2015 2:49 PM, Tobias Burnus wrote:
> Joel Sherrill wrote:
>> run.txt is the cut and paste of the log file which reflects DejaGNU's 
>> view of the run.
> Which means that it hopefully matches every bit of the original output 
> and that no editor interferes by adding or removing line breaks.
>
>
>> Additionally, I think you are right that the "*** EXIT code 0" also 
>> causes problems with the pattern.
>> Details below but this is standard DejaGNU output when the target
>> doesn't return
>> an exit code.
> Good to know. If the pattern is known, one can add it to the pattern.
>
>
>>>   Can you try the following:
>>>
>>> a) Replace the pattern by  "1 2  3(\n|\r\r\n|\r)" (twice), note the
>>> duplicated "\r"
>>> b) Remove the "dg-output "\$" line
>>>
>>> [Best would be if you could try them also separately.] My bet would be
>>> that doing (a) and (b) will succeed, while only (a) and (b) will fail.
>>>
>>>
>>> If using (a) [alone or together with (b)] works, you should really find
>>> out what inserts the "\r", especially as it does not appear if you
>>> manually run the program. "\r\r\n" is definitely not a pattern I would
>>> like to see in the test file.
>> I assume the file in question is
>> gcc/gcc/testsuite/gfortran.dg/g77/f77-edit-x-out.f
> Yes.
>
>> (a) alone didn't make it pass.
>> (b) alone didn't make it pass.
>> (a) and (b) together did not make it pass
>>
>> Does this file get copied or something else during the process that
>> would eliminate edits having an impact?
> I don't think so. Too bad that it didn't seem to help.
>
>> Is there an easy way to take out.txt and just force it against this 
>> .exp pattern?
> Well, you could try whether PERL is able to match it, i.e. something 
> like "cat file | perl ..." if you manage to get the exact output into a 
> file (esp. with the right number of \r and \n, including the last line). 
> I don't know whether that's really identical but it should come close to 
> how DejaGNU matches the pattern.
>
> Example - I use printf instead of a file:
>
> printf '1 2  3\n1 2  3\n\n*** EXIT code 0' \
>    | perl -e '$in = join("", <STDIN>); if ($in =~ m/^1 2 3(\n|\r\n|\r)1 
> 2  3(\n|\r\n|\r)((\n|\r\n|\r)\*\*\* EXIT code 0)?$/s) { print 
> "matched\n" } else { print "not matched\n" };'
That was very close.

cat out.txt |  \
  perl -e '$in = join("", <STDIN>); if ($in =~ m/^1 2  3(\n|\r\n|\r)1 2 
3(\n|\r\n|\r)((\n|\r\n|\r)\*\*\* EXIT code 0)(\n|\r\n|\r)?$/s) { print
"matched\n" } else { print "not matched\n" };'

I think I mainly fixed the first line to have two spaces between the 2 and 3
and added another the EOL pattern at the end.

That just leaves translating that back into DejaGNU/Expect. :)
> Tobias

-- 
Joel Sherrill, Ph.D.             Director of Research & Development
joel.sherrill@OARcorp.com        On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
Support Available                (256) 722-9985


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]