GCC dejagnu testsuite: how to check for non-zero exit code?

Jerry DeLisle jvdelisle@verizon.net
Fri Jul 7 06:10:00 GMT 2006


FX Coudert wrote:
> I'd like to include cases in the gfortran testsuite to check that we 
> correctly issue a run-time error, and exit with non-zero code.
> 
> I have the following example:
> 
> $ cat runtime_error.f90
> ! { dg-do run }
> ! { dg-options "-fbounds-check" }
>   integer :: x(5), y(5)
>   x = y((/0,2,3,4,6/))
>   end
> $ gfortran runtime_error.f90 -fbounds-check
> $ ./a.out ; echo $?
> Fortran runtime error: Array reference out of bounds for array 'y', 
> lower bound of dimension 1 exceeded (in file 'runtime_error.f90', at 
> line 4)
> 2
> 
> 
> I'd like to be able to check that this code indeed issue the error 
> message on stderr and indicate to dejagnu that non-zero exit codes does 
> not mean that the test FAILed). How can I do that?
> 
> Thanks for any help,
> FX
> 
Janis was working on this.  See the following:

http://gcc.gnu.org/ml/fortran/2006-06/msg00119.html

I do not think it has been checked in yet.  But it would be very useful.

Jerry



More information about the Fortran mailing list