equal
deleted
inserted
replaced
84 out->print("Expecting that %s does not exist", path); |
84 out->print("Expecting that %s does not exist", path); |
85 break; |
85 break; |
86 case REQUIRED: |
86 case REQUIRED: |
87 out->print("Expecting that file %s must exist and is not altered", path); |
87 out->print("Expecting that file %s must exist and is not altered", path); |
88 break; |
88 break; |
|
89 case PATCH_MOD: |
|
90 out->print("Expecting --patch-module=%s", path); |
|
91 break; |
89 default: |
92 default: |
90 ShouldNotReachHere(); |
93 ShouldNotReachHere(); |
91 } |
94 } |
92 } |
95 } |
93 |
96 |
144 // The file actually exists |
147 // The file actually exists |
145 if (type == NON_EXIST) { |
148 if (type == NON_EXIST) { |
146 // But we want it to not exist -> fail |
149 // But we want it to not exist -> fail |
147 return fail("File must not exist"); |
150 return fail("File must not exist"); |
148 } |
151 } |
|
152 if ((st.st_mode & S_IFMT) != S_IFREG) { |
|
153 return fail("Did not get a regular file as expected."); |
|
154 } |
149 time_t timestamp; |
155 time_t timestamp; |
150 long filesize; |
156 long filesize; |
151 |
157 |
152 if (!read_time(×tamp) || !read_long(&filesize)) { |
158 if (!read_time(×tamp) || !read_long(&filesize)) { |
153 return fail("Corrupted archive file header"); |
159 return fail("Corrupted archive file header"); |
159 return fail("File size mismatch"); |
165 return fail("File size mismatch"); |
160 } |
166 } |
161 } |
167 } |
162 } |
168 } |
163 break; |
169 break; |
164 |
170 case PATCH_MOD: |
|
171 { |
|
172 GrowableArray<ModulePatchPath*>* patch_mod_args = Arguments::get_patch_mod_prefix(); |
|
173 if (patch_mod_args != NULL) { |
|
174 int num_of_entries = patch_mod_args->length(); |
|
175 for (int i = 0; i < num_of_entries; i++) { |
|
176 const char* module_name = (patch_mod_args->at(i))->module_name(); |
|
177 const char* path_string = (patch_mod_args->at(i))->path_string(); |
|
178 size_t n = strlen(module_name); |
|
179 // path contains the module name, followed by '=', and one or more entries. |
|
180 // E.g.: "java.base=foo" or "java.naming=dir1:dir2:dir3" |
|
181 if ((strncmp(module_name, path, n) != 0) || |
|
182 (path[n] != '=') || |
|
183 (strcmp(path + n + 1, path_string) != 0)) { |
|
184 return fail("--patch-module mismatch, path not found in run time: ", path); |
|
185 } |
|
186 } |
|
187 } |
|
188 } |
|
189 break; |
165 default: |
190 default: |
166 return fail("Corrupted archive file header"); |
191 return fail("Corrupted archive file header"); |
167 } |
192 } |
168 |
193 |
169 return true; |
194 return true; |