Skip to content

Commit 8012ac8

Browse files
committed
improve test flow a bit
1 parent c3db3a6 commit 8012ac8

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

test/system/test_filesystem.f90

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,6 @@ subroutine test_make_directory(error)
166166
! Clean up: remove the empty directory
167167
call execute_command_line('rmdir ' // filename, exitstat=ios, cmdstat=iocmd, cmdmsg=msg)
168168
call check(error, ios==0 .and. iocmd==0, 'Cannot cleanup make_directory test: '//trim(msg))
169-
if (allocated(error)) return
170169
end subroutine test_make_directory
171170

172171
subroutine test_make_directory_existing(error)
@@ -187,8 +186,12 @@ subroutine test_make_directory_existing(error)
187186

188187
! Clean up: remove the empty directory
189188
call execute_command_line('rmdir ' // filename, exitstat=ios, cmdstat=iocmd, cmdmsg=msg)
189+
if (allocated(error)) then
190+
! if previous error is allocated as well
191+
call check(error, ios==0 .and. iocmd==0, error%message // ' and cannot cleanup make_directory test: '//trim(msg))
192+
return
193+
end if
190194
call check(error, ios==0 .and. iocmd==0, 'Cannot cleanup make_directory test: '//trim(msg))
191-
if (allocated(error)) return
192195
end subroutine test_make_directory_existing
193196

194197
subroutine test_remove_directory(error)
@@ -209,8 +212,7 @@ subroutine test_remove_directory(error)
209212
if (allocated(error)) then
210213
! Clean up: remove the empty directory
211214
call execute_command_line('rmdir ' // filename, exitstat=ios, cmdstat=iocmd, cmdmsg=msg)
212-
call check(error, ios==0 .and. iocmd==0, 'Cannot cleanup make_directory test: '//trim(msg))
213-
if (allocated(error)) return
215+
call check(error, ios==0 .and. iocmd==0, error%message // ' and cannot cleanup make_directory test: '//trim(msg))
214216
end if
215217
end subroutine test_remove_directory
216218

0 commit comments

Comments
 (0)