[committed] PR95195 - Fortran testcase should clean up afterwards

Message ID trinity-8cf4ed78-751f-4700-8809-91133af373c8-1591643132430@3c-app-gmx-bap16
State New
Headers show
Series
  • [committed] PR95195 - Fortran testcase should clean up afterwards
Related show

Commit Message

Harald Anlauf June 8, 2020, 7:05 p.m.
In a parallel make check-fortran there was a race condition due to a
file "test.dat" not being cleaned up.  Adjust testcase to use a
separate filename, and instead of failing catch error message within
the program.

Committed as obvious.

Thanks,
Harald


PR fortran/95195 - Fortran testcase should clean up afterwards

Change testcase to check error message (iomsg) at runtime, rather than to crash.

libgfortran/
	PR fortran/95091
	* io/transfer.c (finalize_transfer): Fix type in error message.

gcc/testsuite/
	PR fortran/95195
	* gfortran.dg/namelist_97.f90: Adjust testcase.

Patch

diff --git a/gcc/testsuite/gfortran.dg/namelist_97.f90 b/gcc/testsuite/gfortran.dg/namelist_97.f90
index 4907e46b46a..3c6ad7ce3c1 100644
--- a/gcc/testsuite/gfortran.dg/namelist_97.f90
+++ b/gcc/testsuite/gfortran.dg/namelist_97.f90
@@ -1,14 +1,16 @@ 
 ! { dg-do run }
-! { dg-output "At line 12 .*" }
-! { dg-shouldfail "Fortran runtime error: Namelist formatting .* FORM='UNFORMATTED'" }
 !
 ! PR95195 - improve runtime error when writing a namelist to an unformatted file

 program test
   character(len=11) :: my_form = 'unformatted'
   integer           :: i = 1, j = 2, k = 3
+  character(80)     :: iomsg
   namelist /nml1/ i, j, k
-  open  (unit=10, file='test.dat', form=my_form)
-  write (unit=10, nml=nml1)
+  open  (unit=10, file='namelist_97.dat', form=my_form)
+  write (unit=10, nml=nml1, iostat=iostat, iomsg=iomsg)
   close (unit=10, status='delete')
+  if (iostat == 0) stop 1
+  if (iomsg  /= "Namelist formatting for unit connected with FORM='UNFORMATTED'") &
+       stop 2
 end program test
diff --git a/libgfortran/io/transfer.c b/libgfortran/io/transfer.c
index cd51679ff46..dc18bc34b32 100644
--- a/libgfortran/io/transfer.c
+++ b/libgfortran/io/transfer.c
@@ -4127,7 +4127,7 @@  finalize_transfer (st_parameter_dt *dtp)
 	 {
 	   generate_error (&dtp->common, LIBERROR_OPTION_CONFLICT,
 			   "Namelist formatting for unit connected "
-			   "with FORM='UNFORMATTED");
+			   "with FORM='UNFORMATTED'");
 	   return;
 	 }