> -----Original Message-----
> From: Jakub Jelinek <ja...@redhat.com>
> Sent: Saturday, March 15, 2025 12:34
> To: Robert Dubner <rdub...@symas.com>
> Cc: 'GCC Mailing List' <gcc@gcc.gnu.org>; 'James K. Lowden'
> <jklow...@schemamania.org>; 'Richard Biener'
<richard.guent...@gmail.com>
> Subject: Re: COBOL test cases
> 
> On Sat, Mar 15, 2025 at 11:02:59AM -0500, Robert Dubner wrote:
> > I am struggling with the learning curves, here.  I am trying to
> > understand dejagnu, and I am trying to understand tcl, and I am trying
> > to understand the testsuite chain of commands and files that result,
> > somehow, in the programs in testsuite/cobol.dg being executed.
> > Dealing with three new technologies is slowing me down considerably.
> > I am looking for some help to leapfrog that.
> >
> > We have about 800 programs that definitively have no IP issues
> > preventing their use in the GCC repository.
> >
> > But the vast bulk of them are based on capturing stdout and comparing
> > that to a known-good file.
> >
> > I am completely prepared to create a test-0001.cob source code file
> > for the repo.  I can prepare a matching test-0001.expected-output file
> > for the repo.
> 
> The normal dejagnu way is to use dg-output for that.
> So, if you have test-0001.cob and test-0001.expected-output, you could
do
> for i in *.cob; do \ sed 's/\([].*()[]\)/\\\1/g;s/^/*> { dg-output
> {/;s/$/(\\n|\\r\\n|\\r)} }/;$s/.\{12\}} }$/} }/' \ < $i.expected-output
>>
> $i.cob; done to turn the expected output into dg-output directives.
> Maybe I've missed some characters that also need to be backslash
prefixed,
> in that case they'd go next to the .*() part early in the regexp.

Okay.  Interesting.  Hang on a minute....

... tried a test.  It'll work.

Thanks!




> 
> Of course, if the output is huge, perhaps we should write some dg-
> directive for specifying file with expected output and compare against
> that rather than the dg-output directives.
> But if it is just a couple dozens of lines, I think dg-output could be
> fine.
> 
> > I see the stdout from each executed program is captured in the
> > cobol.log file.  But it doesn't do me much good, there.
> >
> > Is there some way that the output of { dg-do run } can be directed to
> > designated test-0001.stdout and test-0001.stderr files?  If so, I can
> > fairly easily add boilerplate to the end of the COBOL test program to
> > do the comparison.
> >
> > Otherwise I am going to have start rewriting those hundreds of
> > programs to somehow test themselves and produce the go/no-go response.
> 
>       Jakub

Reply via email to