@@ -127,9 +127,9 @@ TEST(SupportFileListTest, RelativePathMatchesWindows) {
127
127
}
128
128
129
129
// Support file is a symlink to the breakpoint file.
130
- // A matching prefix is set.
131
- // Should find the two compatible.
132
130
// Absolute paths are used.
131
+ // A matching prefix is set.
132
+ // Should find it compatible.
133
133
TEST (SupportFileListTest, SymlinkedAbsolutePaths) {
134
134
// Prepare FS
135
135
llvm::IntrusiveRefCntPtr<MockSymlinkFileSystem> fs (new MockSymlinkFileSystem (
@@ -151,9 +151,33 @@ TEST(SupportFileListTest, SymlinkedAbsolutePaths) {
151
151
}
152
152
153
153
// Support file is a symlink to the breakpoint file.
154
- // A matching prefix is set.
155
- // Should find the two compatible.
154
+ // Absolute paths are used.
155
+ // A matching prefix is set, which is the root directory.
156
+ // Should find it compatible.
157
+ TEST (SupportFileListTest, RootDirectory) {
158
+ // Prepare FS
159
+ llvm::IntrusiveRefCntPtr<MockSymlinkFileSystem> fs (new MockSymlinkFileSystem (
160
+ FileSpec (" /symlink_dir/foo.h" ), FileSpec (" /real_dir/foo.h" )));
161
+
162
+ // Prepare RealpathPrefixes
163
+ FileSpecList file_spec_list;
164
+ file_spec_list.EmplaceBack (" /" );
165
+ RealpathPrefixes prefixes (file_spec_list, fs);
166
+
167
+ // Prepare support file list
168
+ SupportFileList support_file_list;
169
+ support_file_list.EmplaceBack (FileSpec (" /symlink_dir/foo.h" ));
170
+
171
+ // Test
172
+ size_t ret = support_file_list.FindCompatibleIndex (
173
+ 0 , FileSpec (" /real_dir/foo.h" ), &prefixes);
174
+ EXPECT_EQ (ret, (size_t )0 );
175
+ }
176
+
177
+ // Support file is a symlink to the breakpoint file.
156
178
// Relative paths are used.
179
+ // A matching prefix is set.
180
+ // Should find it compatible.
157
181
TEST (SupportFileListTest, SymlinkedRelativePaths) {
158
182
// Prepare FS
159
183
llvm::IntrusiveRefCntPtr<MockSymlinkFileSystem> fs (new MockSymlinkFileSystem (
@@ -177,7 +201,7 @@ TEST(SupportFileListTest, SymlinkedRelativePaths) {
177
201
// Support file is a symlink to the breakpoint file.
178
202
// A matching prefix is set.
179
203
// Input file only match basename and not directory.
180
- // Should find the two incompatible.
204
+ // Should find it incompatible.
181
205
TEST (SupportFileListTest, RealpathOnlyMatchFileName) {
182
206
// Prepare FS
183
207
llvm::IntrusiveRefCntPtr<MockSymlinkFileSystem> fs (new MockSymlinkFileSystem (
@@ -198,10 +222,34 @@ TEST(SupportFileListTest, RealpathOnlyMatchFileName) {
198
222
EXPECT_EQ (ret, UINT32_MAX);
199
223
}
200
224
225
+ // Support file is a symlink to the breakpoint file.
226
+ // A prefix is set, which is a matching string prefix, but not a path prefix.
227
+ // Should find it incompatible.
228
+ TEST (SupportFileListTest, DirectoryMatchStringPrefixButNotWholeDirectoryName) {
229
+ // Prepare FS
230
+ llvm::IntrusiveRefCntPtr<MockSymlinkFileSystem> fs (new MockSymlinkFileSystem (
231
+ FileSpec (" symlink_dir/foo.h" ), FileSpec (" real_dir/foo.h" )));
232
+
233
+ // Prepare RealpathPrefixes
234
+ FileSpecList file_spec_list;
235
+ file_spec_list.EmplaceBack (" symlink" ); // This is a string prefix of the
236
+ // symlink but not a path prefix.
237
+ RealpathPrefixes prefixes (file_spec_list, fs);
238
+
239
+ // Prepare support file list
240
+ SupportFileList support_file_list;
241
+ support_file_list.EmplaceBack (FileSpec (" symlink_dir/foo.h" ));
242
+
243
+ // Test
244
+ size_t ret = support_file_list.FindCompatibleIndex (
245
+ 0 , FileSpec (" real_dir/foo.h" ), &prefixes);
246
+ EXPECT_EQ (ret, UINT32_MAX);
247
+ }
248
+
201
249
// Support file is a symlink to the breakpoint file.
202
250
// A matching prefix is set.
203
251
// However, the breakpoint is set with a partial path.
204
- // Should find the two compatible.
252
+ // Should find it compatible.
205
253
TEST (SupportFileListTest, PartialBreakpointPath) {
206
254
// Prepare FS
207
255
llvm::IntrusiveRefCntPtr<MockSymlinkFileSystem> fs (new MockSymlinkFileSystem (
@@ -225,7 +273,7 @@ TEST(SupportFileListTest, PartialBreakpointPath) {
225
273
// Support file is a symlink to the breakpoint file.
226
274
// A matching prefix is set.
227
275
// However, the basename is different between the symlink and its target.
228
- // Should find the two incompatible.
276
+ // Should find it incompatible.
229
277
TEST (SupportFileListTest, DifferentBasename) {
230
278
// Prepare FS
231
279
llvm::IntrusiveRefCntPtr<MockSymlinkFileSystem> fs (new MockSymlinkFileSystem (
@@ -248,7 +296,7 @@ TEST(SupportFileListTest, DifferentBasename) {
248
296
249
297
// No prefixes are configured.
250
298
// The support file and the breakpoint file are different.
251
- // Should find the two incompatible.
299
+ // Should find it incompatible.
252
300
TEST (SupportFileListTest, NoPrefixes) {
253
301
// Prepare support file list
254
302
SupportFileList support_file_list;
@@ -262,7 +310,7 @@ TEST(SupportFileListTest, NoPrefixes) {
262
310
263
311
// No prefixes are configured.
264
312
// The support file and the breakpoint file are the same.
265
- // Should find the two compatible.
313
+ // Should find it compatible.
266
314
TEST (SupportFileListTest, SameFile) {
267
315
// Prepare support file list
268
316
SupportFileList support_file_list;
0 commit comments