gfortran.dg/read_dir.f90: Make PASS on Windows Avoid call to the shell using POSIX syntax and use '.' instead. Additionally, expect fail on non-Cygwin Windows as opening a directory is documented to fail with EACCESS. gcc/testsuite/ChangeLog: * gfortran.dg/read_dir.f90: Open '.' instead of a freshly created directory; expect error on Windows when opening a directory. gcc/testsuite/gfortran.dg/read_dir.f90 | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/gcc/testsuite/gfortran.dg/read_dir.f90 b/gcc/testsuite/gfortran.dg/read_dir.f90 index c7ddc51fb90..c91d0f78413 100644 --- a/gcc/testsuite/gfortran.dg/read_dir.f90 +++ b/gcc/testsuite/gfortran.dg/read_dir.f90 @@ -1,20 +1,27 @@ ! { dg-do run } +! { dg-additional-options "-cpp" } +! ! PR67367 + program bug implicit none character(len=1) :: c - character(len=256) :: message integer ios - call system('[ -d junko.dir ] || mkdir junko.dir') - open(unit=10, file='junko.dir',iostat=ios,action='read',access='stream') + open(unit=10, file='.',iostat=ios,action='read',access='stream') + +#if defined(__WIN32__) && !defined(__CYGWIN__) + ! Windows is documented to fail with EACCESS when trying to open a directory + if (ios == 0) & + stop 3 ! Expected EACCESS + stop 0 ! OK +#endif + if (ios.ne.0) then - call system('rmdir junko.dir') STOP 1 end if read(10, iostat=ios) c - if (ios.ne.21.and.ios.ne.0) then - close(10, status='delete') + close(10) + if (ios.ne.21.and.ios.ne.0) then ! EISDIR has often the value 21 STOP 2 end if - close(10, status='delete') end program bug