1 ! { dg-do run { target { ! { *-*-mingw* *-*-cygwin* spu-*-* } } } }
2 ! PR30005 Enhanced error messages for OPEN
3 ! Submitted by Jerry DeLisle <jvdelisle@gcc.gnu.org>
4 ! See PR38956. Test fails on cygwin when user has Administrator rights
5 ! As of the fix for PR 65200, the error message is partly generated by
6 ! strerror*(), so can depend on the target and the locale, so check
7 ! only the beginning of the error string, which should be constant.
9 character(25) :: n
= "temptestfile"
11 inquire(file
=n
, exist
=there
)
13 open(77,file
=n
,status
="new")
14 close(77, status
="keep")
17 open(77,file
=n
,status
="new", iomsg
=msg
, iostat
=i
)
19 if (msg(1:33) /= "Cannot open file 'temptestfile': ") STOP 2
21 open(77,file
=n
,status
="old")
22 close(77, status
="delete")
23 open(77,file
=n
,status
="old", iomsg
=msg
, iostat
=i
)
25 if (msg(1:33) /= "Cannot open file 'temptestfile': ") STOP 4
27 open(77,file
="./", iomsg
=msg
, iostat
=i
)
28 if (msg(1:23) /= "Cannot open file './': " &
29 .and
. msg
/= "Invalid argument") STOP 5
31 open(77,file
=n
,status
="new")
33 if (i
== 0 .and
. getuid() /= 0) then
34 close(77, status
="keep")
35 open(77,file
=n
, iomsg
=msg
, iostat
=i
, action
="write")
37 if (msg(1:33) /= "Cannot open file 'temptestfile': ") STOP 7
41 open(77,file
=n
, iomsg
=msg
, iostat
=i
, action
="read")
42 close(77, status
="delete")