@@ -113,11 +113,7 @@ subroutine fs_list_dir_empty(error)
113113 integer :: stat
114114 type (string_type), allocatable :: files(:)
115115
116- call run(' rm -rf ' // temp_list_dir, iostat= stat)
117- if (stat /= 0 ) then
118- call test_failed(error, " Removing directory '" // temp_list_dir// " ' failed." ); return
119- end if
120-
116+ call rm_dir(temp_list_dir)
121117 call run(' mkdir ' // temp_list_dir, iostat= stat)
122118 if (stat /= 0 ) then
123119 call test_failed(error, " Creating directory '" // temp_list_dir// " ' failed." ); return
@@ -127,7 +123,7 @@ subroutine fs_list_dir_empty(error)
127123 call check(error, stat, " Listing the contents of an empty directory shouldn't fail." )
128124 call check(error, size (files) == 0 , " The directory should be empty." )
129125
130- call run( ' rm -rf ' // temp_list_dir, iostat = stat )
126+ call rm_dir( temp_list_dir)
131127 end
132128
133129 subroutine fs_list_dir_one_file (error )
@@ -138,11 +134,7 @@ subroutine fs_list_dir_one_file(error)
138134 type (string_type), allocatable :: files(:)
139135 character (* ), parameter :: filename = ' abc.txt'
140136
141- call run(' rm -rf ' // temp_list_dir, iostat= stat)
142- if (stat /= 0 ) then
143- call test_failed(error, " Removing directory '" // temp_list_dir// " ' failed." ); return
144- end if
145-
137+ call rm_dir(temp_list_dir)
146138 call run(' mkdir ' // temp_list_dir, iostat= stat)
147139 if (stat /= 0 ) then
148140 call test_failed(error, " Creating directory '" // temp_list_dir// " ' failed." ); return
@@ -158,7 +150,7 @@ subroutine fs_list_dir_one_file(error)
158150 call check(error, size (files) == 1 , " The directory should contain one file." )
159151 call check(error, char (files(1 )) == filename, " The file should be '" // filename// " '." )
160152
161- call run( ' rm -rf ' // temp_list_dir, iostat = stat )
153+ call rm_dir( temp_list_dir)
162154 end
163155
164156 subroutine fs_list_dir_two_files (error )
@@ -170,11 +162,7 @@ subroutine fs_list_dir_two_files(error)
170162 character (* ), parameter :: filename1 = ' abc.txt'
171163 character (* ), parameter :: filename2 = ' xyz'
172164
173- call run(' rm -rf ' // temp_list_dir, iostat= stat)
174- if (stat /= 0 ) then
175- call test_failed(error, " Removing directory '" // temp_list_dir// " ' failed." ); return
176- end if
177-
165+ call rm_dir(temp_list_dir)
178166 call run(' mkdir ' // temp_list_dir, iostat= stat)
179167 if (stat /= 0 ) then
180168 call test_failed(error, " Creating directory '" // temp_list_dir// " ' failed." ); return
@@ -196,7 +184,7 @@ subroutine fs_list_dir_two_files(error)
196184 call check(error, char (files(1 )) == filename1, " The file should be '" // filename1// " '." )
197185 call check(error, char (files(2 )) == filename2, " The file should be '" // filename2// " '." )
198186
199- call run( ' rm -rf ' // temp_list_dir, iostat = stat )
187+ call rm_dir( temp_list_dir)
200188 end
201189
202190 subroutine fs_list_dir_one_file_one_dir (error )
@@ -208,11 +196,7 @@ subroutine fs_list_dir_one_file_one_dir(error)
208196 character (* ), parameter :: filename1 = ' abc.txt'
209197 character (* ), parameter :: dir = ' xyz'
210198
211- call run(' rm -rf ' // temp_list_dir, iostat= stat)
212- if (stat /= 0 ) then
213- call test_failed(error, " Removing directory '" // temp_list_dir// " ' failed." ); return
214- end if
215-
199+ call rm_dir(temp_list_dir)
216200 call run(' mkdir ' // temp_list_dir, iostat= stat)
217201 if (stat /= 0 ) then
218202 call test_failed(error, " Creating directory '" // temp_list_dir// " ' failed." ); return
@@ -238,7 +222,7 @@ subroutine fs_list_dir_one_file_one_dir(error)
238222 call check(error, char (contents(1 )) == filename1, " The file should be '" // filename1// " '." )
239223 call check(error, char (contents(2 )) == dir, " The file should be '" // dir// " '." )
240224
241- call run( ' rm -rf ' // temp_list_dir, iostat = stat )
225+ call rm_dir( temp_list_dir)
242226 end
243227
244228 subroutine fs_rm_dir_empty (error )
0 commit comments