File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed
test/hotspot/gtest/runtime Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -135,8 +135,20 @@ static void create_rel_directory_w(const wchar_t* path) {
135
135
static void delete_empty_rel_directory_w (const wchar_t * path) {
136
136
WITH_ABS_PATH (path);
137
137
EXPECT_TRUE (file_exists_w (abs_path)) << " Can't delete directory: \" " << path << " \" does not exists" ;
138
- BOOL result = RemoveDirectoryW (abs_path);
139
- EXPECT_TRUE (result) << " Failed to delete directory \" " << path << " \" : " << GetLastError ();
138
+ const int retry_count = 20 ;
139
+
140
+ // If the directory cannot be deleted directly, a file in it might be kept
141
+ // open by a virus scanner. Try a few times, since this should be temporary.
142
+ for (int i = 0 ; i <= retry_count; ++i) {
143
+ BOOL result = RemoveDirectoryW (abs_path);
144
+
145
+ if (!result && (i < retry_count)) {
146
+ Sleep (1 );
147
+ } else {
148
+ EXPECT_TRUE (result) << " Failed to delete directory \" " << path << " \" : " << GetLastError ();
149
+ return ;
150
+ }
151
+ }
140
152
}
141
153
142
154
static void create_rel_file_w (const wchar_t * path) {
You can’t perform that action at this time.
0 commit comments