This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
GCC dejagnu testsuite: how to check for non-zero exit code?
- From: FX Coudert <fxcoudert at gmail dot com>
- To: GCC Development <gcc at gcc dot gnu dot org>, gfortran <fortran at gcc dot gnu dot org>
- Date: Thu, 06 Jul 2006 22:48:50 +0200
- Subject: GCC dejagnu testsuite: how to check for non-zero exit code?
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