Commit 51022ff7 by Christophe Lyon Committed by Christophe Lyon

Fix race on temp file in gfortran tests.

2015-10-26  Christophe Lyon  <christophe.lyon@linaro.org>

	* gfortran.dg/chmod_1.f90: Add suffix to the temporary filename to
	make it unique per testcase.
	* gfortran.dg/chmod_2.f90: Likewise.
	* gfortran.dg/chmod_3.f90: Likewise.
	* gfortran.dg/direct_io_8.f90: Likewise.
	* gfortran.dg/f2003_inquire_1.f03: Likewise.
	* gfortran.dg/f2003_io_1.f03: Likewise.
	* gfortran.dg/f2003_io_2.f03: Likewise.
	* gfortran.dg/f2003_io_8.f03: Likewise.
	* gfortran.dg/inquire_size.f90: Likewise.
	* gfortran.dg/namelist_66.f90: Likewise.
	* gfortran.dg/namelist_82.f90: Likewise.
	* gfortran.dg/namelist_87.f90: Likewise.
	* gfortran.dg/open_negative_unit_1.f90: Likewise.
	* gfortran.dg/open_new.f90: Likewise.
	* gfortran.dg/stat_1.f90: Likewise.
	* gfortran.dg/stat_2.f90: Likewise.
	* gfortran.dg/streamio_15.f90: Likewise.
	* gfortran.dg/unf_read_corrupted_1.f90: Likewise.

From-SVN: r229319
parent a9fdbccb
2015-10-26 Christophe Lyon <christophe.lyon@linaro.org>
* gfortran.dg/chmod_1.f90: Add suffix to the temporary filename to
make it unique per testcase.
* gfortran.dg/chmod_2.f90: Likewise.
* gfortran.dg/chmod_3.f90: Likewise.
* gfortran.dg/direct_io_8.f90: Likewise.
* gfortran.dg/f2003_inquire_1.f03: Likewise.
* gfortran.dg/f2003_io_1.f03: Likewise.
* gfortran.dg/f2003_io_2.f03: Likewise.
* gfortran.dg/f2003_io_8.f03: Likewise.
* gfortran.dg/inquire_size.f90: Likewise.
* gfortran.dg/namelist_66.f90: Likewise.
* gfortran.dg/namelist_82.f90: Likewise.
* gfortran.dg/namelist_87.f90: Likewise.
* gfortran.dg/open_negative_unit_1.f90: Likewise.
* gfortran.dg/open_new.f90: Likewise.
* gfortran.dg/stat_1.f90: Likewise.
* gfortran.dg/stat_2.f90: Likewise.
* gfortran.dg/streamio_15.f90: Likewise.
* gfortran.dg/unf_read_corrupted_1.f90: Likewise.
2015-10-26 Kyrylo Tkachov <kyrylo.tkachov@arm.com> 2015-10-26 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
PR middle-end/67989 PR middle-end/67989
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
! { dg-options "-std=gnu" } ! { dg-options "-std=gnu" }
! See PR38956. Test fails on cygwin when user has Administrator rights ! See PR38956. Test fails on cygwin when user has Administrator rights
implicit none implicit none
character(len=*), parameter :: n = "foobar_file" character(len=*), parameter :: n = "foobar_file_chmod_1"
integer :: i integer :: i
open (10,file=n) open (10,file=n)
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
! { dg-options "-std=gnu" } ! { dg-options "-std=gnu" }
! See PR38956. Test fails on cygwin when user has Administrator rights ! See PR38956. Test fails on cygwin when user has Administrator rights
implicit none implicit none
character(len=*), parameter :: n = "foobar_file" character(len=*), parameter :: n = "foobar_file_chmod_2"
integer :: i integer :: i
open (10,file=n) open (10,file=n)
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
! { dg-options "-std=gnu -fdefault-integer-8" } ! { dg-options "-std=gnu -fdefault-integer-8" }
! See PR38956. Test fails on cygwin when user has Administrator rights ! See PR38956. Test fails on cygwin when user has Administrator rights
implicit none implicit none
character(len=*), parameter :: n = "foobar_file" character(len=*), parameter :: n = "foobar_file_chmod_3"
integer :: i integer :: i
open (10,file=n) open (10,file=n)
......
...@@ -7,7 +7,7 @@ program main ...@@ -7,7 +7,7 @@ program main
i=44 i=44
ir = -42 ir = -42
open(11,file="foo.dat") open(11,file="foo_direct_io_8.dat")
! Try a direct access read on a formatted sequential rile ! Try a direct access read on a formatted sequential rile
READ (11, REC = I, ERR = 99) TEMP_CHANGES READ (11, REC = I, ERR = 99) TEMP_CHANGES
call abort call abort
......
...@@ -4,7 +4,7 @@ character(25) :: sround, ssign, sasynchronous, sdecimal, sencoding ...@@ -4,7 +4,7 @@ character(25) :: sround, ssign, sasynchronous, sdecimal, sencoding
integer :: vsize, vid integer :: vsize, vid
logical :: vpending logical :: vpending
open(10, file='mydata', asynchronous="yes", blank="null", & open(10, file='mydata_f2003_inquire_1', asynchronous="yes", blank="null", &
& decimal="comma", encoding="utf-8", sign="plus") & decimal="comma", encoding="utf-8", sign="plus")
inquire(unit=10, round=sround, sign=ssign, size=vsize, id=vid, & inquire(unit=10, round=sround, sign=ssign, size=vsize, id=vid, &
......
...@@ -8,7 +8,7 @@ character(25) :: msg ...@@ -8,7 +8,7 @@ character(25) :: msg
a = 23.45 a = 23.45
b = 0.0 b = 0.0
open(10, file='mydata', asynchronous="yes", blank="null") open(10, file='mydata_f2003_io_1', asynchronous="yes", blank="null")
write(10,'(10f8.3)', asynchronous="yes", decimal="comma", id=j) a write(10,'(10f8.3)', asynchronous="yes", decimal="comma", id=j) a
rewind(10) rewind(10)
......
...@@ -7,7 +7,7 @@ character(25) :: msg ...@@ -7,7 +7,7 @@ character(25) :: msg
real, dimension(10) :: a, b real, dimension(10) :: a, b
a = 43.21 a = 43.21
open(10, file='mydata', asynchronous="yes") open(10, file='mydata_f2003_io_2', asynchronous="yes")
write(10,'(10f8.3)', asynchronous="yes", decimal="comma") a write(10,'(10f8.3)', asynchronous="yes", decimal="comma") a
rewind(10) rewind(10)
read(10,'(10f8.3)', asynchronous="yes", decimal="comma", id=idvar) b read(10,'(10f8.3)', asynchronous="yes", decimal="comma", id=idvar) b
......
...@@ -6,7 +6,7 @@ real :: c ...@@ -6,7 +6,7 @@ real :: c
integer :: istat, j integer :: istat, j
character(25) :: msg character(25) :: msg
open(10, file='mydata', asynchronous="yes", blank="null") open(10, file='mydata_f2003_io_8', asynchronous="yes", blank="null")
write(10,'(10f8.3)', asynchronous='no', decimal="comma", id=j) a ! { dg-error "must be with ASYNCHRONOUS=" } write(10,'(10f8.3)', asynchronous='no', decimal="comma", id=j) a ! { dg-error "must be with ASYNCHRONOUS=" }
read(10,'(10f8.3)', id=j, decimal="comma", blank="zero") b ! { dg-error "must be with ASYNCHRONOUS=" } read(10,'(10f8.3)', id=j, decimal="comma", blank="zero") b ! { dg-error "must be with ASYNCHRONOUS=" }
read(10,'(10f8.3)', asynchronous=msg, decimal="comma", blank="zero") b ! { dg-error "must be an initialization expression" } read(10,'(10f8.3)', asynchronous=msg, decimal="comma", blank="zero") b ! { dg-error "must be an initialization expression" }
......
...@@ -4,7 +4,7 @@ integer :: i ...@@ -4,7 +4,7 @@ integer :: i
character(30) :: aname = "noname" character(30) :: aname = "noname"
logical :: is_named logical :: is_named
open(25, file="testfile", status="replace", access="stream", form="unformatted") open(25, file="testfile_inquire_size", status="replace", access="stream", form="unformatted")
do i=1,100 do i=1,100
write(25) i, "abcdefghijklmnopqrstuvwxyz" write(25) i, "abcdefghijklmnopqrstuvwxyz"
enddo enddo
...@@ -14,16 +14,16 @@ enddo ...@@ -14,16 +14,16 @@ enddo
inquire(unit=25, named=is_named, name=aname, size=i) inquire(unit=25, named=is_named, name=aname, size=i)
if (.not.is_named) call abort if (.not.is_named) call abort
if (aname /= "testfile") call abort if (aname /= "testfile_inquire_size") call abort
if (i /= 3000) call abort if (i /= 3000) call abort
inquire(file="testfile", size=i) inquire(file="testfile_inquire_size", size=i)
if (.not.is_named) call abort if (.not.is_named) call abort
if (aname /= "testfile") call abort if (aname /= "testfile_inquire_size") call abort
if (i /= 3000) call abort if (i /= 3000) call abort
close(25, status="delete") close(25, status="delete")
inquire(file="testfile", size=i) inquire(file="testfile_inquire_size", size=i)
if (i /= -1) call abort if (i /= -1) call abort
end end
......
...@@ -17,7 +17,7 @@ end type qptracer ...@@ -17,7 +17,7 @@ end type qptracer
type(qptracer) , dimension(3) :: qtracer type(qptracer) , dimension(3) :: qtracer
namelist/naml2/ qtracer namelist/naml2/ qtracer
open (99, file='nml.dat', status="replace") open (99, file='nml_66.dat', status="replace")
write(99,*) "&naml1" write(99,*) "&naml1"
write(99,*) " tracer(1) = 'aa', .true." write(99,*) " tracer(1) = 'aa', .true."
write(99,*) " tracer(2) = 'bb', .true." write(99,*) " tracer(2) = 'bb', .true."
......
...@@ -10,7 +10,7 @@ namelist/naml1/ tracer ...@@ -10,7 +10,7 @@ namelist/naml1/ tracer
tracer(:) = ptracer('XXX', .false.) tracer(:) = ptracer('XXX', .false.)
open (99, file='nml.dat', status="replace") open (99, file='nml_82.dat', status="replace")
write(99,*) "&naml1" write(99,*) "&naml1"
!write(99,*) " tracer(2) = 'bb' , .true." !write(99,*) " tracer(2) = 'bb' , .true."
write(99,*) " tracer(:) = 'aa' , .true." write(99,*) " tracer(:) = 'aa' , .true."
......
...@@ -30,7 +30,7 @@ character(3) :: c2 = 'YYY' ...@@ -30,7 +30,7 @@ character(3) :: c2 = 'YYY'
character(3) :: c3 = 'ZZZ' character(3) :: c3 = 'ZZZ'
namelist /nml/ i, r1,r2,r3,r4,r5,c,ll,c1,c2,c3 namelist /nml/ i, r1,r2,r3,r4,r5,c,ll,c1,c2,c3
open (99, file='nml.dat', status="replace") open (99, file='nml_87.dat', status="replace")
write(99,*) "&nml" write(99,*) "&nml"
write(99,*) " i=42!11" ! Fixed BUG: wrong result: Unmodified, no error write(99,*) " i=42!11" ! Fixed BUG: wrong result: Unmodified, no error
write(99,*) " r1=43!11" ! Fixed BUG: wrong result: Unmodified, no error write(99,*) " r1=43!11" ! Fixed BUG: wrong result: Unmodified, no error
......
...@@ -9,7 +9,7 @@ program nutest ...@@ -9,7 +9,7 @@ program nutest
logical l logical l
integer id, ios integer id, ios
open(newunit=id, file="foo.txt", iostat=ios) open(newunit=id, file="foo_open_negative_unit_1.txt", iostat=ios)
if (ios /= 0) call abort if (ios /= 0) call abort
open(id, file="bar.txt", iostat=ios) open(id, file="bar.txt", iostat=ios)
...@@ -17,14 +17,14 @@ program nutest ...@@ -17,14 +17,14 @@ program nutest
close(id, status="delete") close(id, status="delete")
open(unit=10, file="foo.txt", status="old", iostat=ios) open(unit=10, file="foo_open_negative_unit_1.txt", status="old", iostat=ios)
if (ios /= 0) call abort if (ios /= 0) call abort
close(10, status="delete") close(10, status="delete")
open(-10, file="foo.txt", iostat=ios) open(-10, file="foo_open_negative_unit_1.txt", iostat=ios)
if (ios == 0) call abort if (ios == 0) call abort
inquire(file="foo.txt", exist=l) inquire(file="foo_open_negative_unit_1.txt", exist=l)
if (l) call abort if (l) call abort
end program nutest end program nutest
...@@ -3,9 +3,9 @@ ...@@ -3,9 +3,9 @@
! status="new" is an error ! status="new" is an error
program main program main
nout = 10 nout = 10
open(nout, file="foo.dat", status="replace") ! make sure foo.dat exists open(nout, file="foo_open_new.dat", status="replace") ! make sure foo_open_new.dat exists
close(nout) close(nout)
open(nout, file="foo.dat", status="new",err=100) open(nout, file="foo_open_new.dat", status="new",err=100)
call abort ! This should never happen call abort ! This should never happen
100 call unlink ("foo.dat") 100 call unlink ("foo_open_new.dat")
end program main end program main
! { dg-do run } ! { dg-do run }
! { dg-skip-if "" { *-*-mingw* spu-*-* } { "*" } { "" } } ! { dg-skip-if "" { *-*-mingw* spu-*-* } { "*" } { "" } }
! { dg-options "-std=gnu" } ! { dg-options "-std=gnu" }
character(len=*), parameter :: f = "testfile" character(len=*), parameter :: f = "testfile_stat_1"
integer :: s1(13), r1, s2(13), r2, s3(13), r3, d(13), rd integer :: s1(13), r1, s2(13), r2, s3(13), r3, d(13), rd
open (10,file=f) open (10,file=f)
......
! { dg-do run } ! { dg-do run }
! { dg-skip-if "" { *-*-mingw* spu-*-* } { "*" } { "" } } ! { dg-skip-if "" { *-*-mingw* spu-*-* } { "*" } { "" } }
! { dg-options "-std=gnu" } ! { dg-options "-std=gnu" }
character(len=*), parameter :: f = "testfile" character(len=*), parameter :: f = "testfile_stat_2"
integer :: s1(13), r1, s2(13), r2, s3(13), r3, d(13), rd integer :: s1(13), r1, s2(13), r2, s3(13), r3, d(13), rd
open (10,file=f) open (10,file=f)
......
...@@ -13,7 +13,7 @@ program main ...@@ -13,7 +13,7 @@ program main
if (newline_length < 1 .or. newline_length > 2) call abort if (newline_length < 1 .or. newline_length > 2) call abort
close(20) close(20)
open(20,file="foo.txt",form="formatted",access="stream") open(20,file="foo_streamio_15.txt",form="formatted",access="stream")
write(20,'(A)') '123456' write(20,'(A)') '123456'
write(20,'(A)') 'abcdef' write(20,'(A)') 'abcdef'
write(20,'(A)') 'qwerty' write(20,'(A)') 'qwerty'
......
...@@ -10,13 +10,13 @@ program main ...@@ -10,13 +10,13 @@ program main
! Write out a truncated unformatted sequential file by ! Write out a truncated unformatted sequential file by
! using unformatted stream. ! using unformatted stream.
open (10, form="unformatted", access="stream", file="foo.dat", & open (10, form="unformatted", access="stream", file="foo_unf_read_corrupted_1.dat", &
status="unknown") status="unknown")
write (10) 16_4, 1_4 write (10) 16_4, 1_4
close (10, status="keep") close (10, status="keep")
! Try to read ! Try to read
open (10, file="foo.dat", form="unformatted", access="sequential") open (10, file="foo_unf_read_corrupted_1.dat", form="unformatted", access="sequential")
i1 = 0 i1 = 0
i2 = 0 i2 = 0
read (10, iostat=ios, iomsg=msg) i1, i2 read (10, iostat=ios, iomsg=msg) i1, i2
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment