Skip to content

Commit dd10b5a

Browse files
committed
fix test commands
1 parent 661ec55 commit dd10b5a

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

test/system/test_filesystem.f90

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,9 @@ end subroutine test_exists_dir
149149
subroutine test_exists_symlink(error)
150150
type(error_type), allocatable, intent(out) :: error
151151
type(state_type) :: err
152-
character(len=256) :: target_name, link_name, cmd
152+
character(len=128) :: target_name, link_name
153153
integer :: ios, iunit, iocmd, t
154-
character(len=512) :: msg
154+
character(len=512) :: msg, cmd
155155

156156
target_name = "test_file.txt"
157157
link_name = "symlink.txt"
@@ -165,12 +165,21 @@ subroutine test_exists_symlink(error)
165165
cmd = 'mklink '//link_name//' '//target_name
166166
call execute_command_line(cmd, exitstat=ios, cmdstat=iocmd, cmdmsg=msg)
167167
else
168-
cmd = 'ln -s '//link_name//' '//target_name
168+
cmd = 'ln -s '//target_name//' '//link_name
169+
print *, cmd
169170
call execute_command_line(cmd, exitstat=ios, cmdstat=iocmd, cmdmsg=msg)
171+
cmd = 'mklink '//link_name//' '//target_name
172+
print *, cmd
170173
end if
171174

172175
call check(error, ios == 0 .and. iocmd == 0, "Cannot create symlink!: " // trim(msg))
173-
if (allocated(error)) return
176+
177+
if (allocated(error)) then
178+
! Clean up: remove the target
179+
close(iunit,status='delete',iostat=ios,iomsg=msg)
180+
call check(error, ios == 0, err%message // "and cannot delete target: " // trim(msg))
181+
return
182+
end if
174183

175184
t = exists(link_name, err)
176185
call check(error, err%ok(), "exists failed for symlink: " // err%print())

0 commit comments

Comments
 (0)