On Mon, Feb 28, 2005 at 03:59:52PM -0800, Janis Johnson wrote: > On Fri, Feb 25, 2005 at 08:14:04PM -0800, Steve Kargl wrote: > > I would like to write a short program to test the > > command line parsing of gfortran. I know I can add > > > > ! {dg-do run} > > > > at the top of the program to have dejagnu execute the > > the a.out file. But, I want to execute "a.out 1 2 3". > > Is this possible? I tried looking through gcc.dg and > > gfortran.dg directories, but nothing jumped out as the > > obvious way to do want I need. > > > > If you're wondering the test program would look like > > > > ! { dg-do run } > > ! { dg?????? } How to specify "a.out 1 2 3"? > > program args > > integer i > > i = iargc() > > if (i /= 3) call abort > > end program > > DejaGnu's definition of ${tool}_load has an optional argument for flags > to pass to the test program, but none of the procedures in DejaGnu or in > gcc/testsuite/* are set up to pass such flags. It would be fairly > straightforward to provide a local version of gfortran_load to intercept > calls to the global one, and have it add flags specified with a new test > directive to the DejaGnu version of ${tool}_load. That directive could > be something like: > > { dg-program-options options [{ target selector }] } > > Would something like this be useful for other languages as well, or is > Fortran the only one in GCC that has support to process a program's > command line? > > I'm willing to implement something like this if it looks worthwhile.
It's supposed to be possible to drop in replacements to DejaGnu in the GCC testsuite; do other test frameworks of interest handle passing arguments to the test program in a way that could support this? (Sorry for talking to myself here.) Janis