Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
first commit to add the mpich-test suite to smpi tesh suite. Obviously all tests...
[simgrid.git] / teshsuite / smpi / mpich-test / env / errstringsf.f
1 c
2 c Check the handling of error strings from Fortran
3 c      
4
5       program errstringsf
6
7       include 'mpif.h'
8
9       character*(MPI_MAX_ERROR_STRING) errs
10       integer i, reslen, reserr, ierr
11
12 c      
13 c     Fill the string with 'x' to check that
14 c     blank padding happens correctly.
15 c
16       call MPI_Init( ierr )
17       do i = 1,MPI_MAX_ERROR_STRING
18          errs(i:i) = 'x'
19       end do
20
21       call mpi_error_string(mpi_err_buffer, errs, reslen, reserr)
22
23       if (errs(reslen+1:) .ne. ' ') then
24          print *,' Fortran strings are not correctly blank padded'
25          if (errs(reslen+1:reslen+1) .eq. char(0)) then
26 c
27 c           Very strictly interpreted, an since an error string must be 
28 c           MPI_MAX_ERROR_STRING characters long, and the Fortran rules
29 c           for such assignements is to blank pad them, there should not
30 c           be a null character (C-like) in them.  However, the standard
31 c           is ambiguous on this.  
32 c
33             print *, ' Fortran strings have bogus null character'
34          end if
35       else
36          print *,' Fortran strings are assigned ok'
37       end if
38
39 c     Check that the length was right
40       if (errs(reslen:reslen) .eq. ' ') then
41          print *,' Length of result is wrong'
42       else 
43          print *,' Length of result is correct'
44       end if
45
46       call MPI_Finalize( ierr )
47
48       end