Lines Matching refs:filesystem
34 func newFinder(t *testing.T, filesystem *fs.MockFs, cacheParams CacheParams) *Finder {
35 return newFinderWithNumThreads(t, filesystem, cacheParams, 2)
38 func newFinderWithNumThreads(t *testing.T, filesystem *fs.MockFs, cacheParams CacheParams, numThrea…
39 f, err := newFinderAndErr(t, filesystem, cacheParams, numThreads)
46 func newFinderAndErr(t *testing.T, filesystem *fs.MockFs, cacheParams CacheParams, numThreads int) …
49 filesystem.MkDirs(cacheDir)
55 f, err := newImpl(cacheParams, filesystem, logger, cachePath, numThreads)
70 original.filesystem,
80 filesystem := newFs()
82 filesystem.MkDirs(root)
84 fs.Create(t, filepath.Join(root, path), filesystem)
88 filesystem,
153 filesystem := newFs()
155 fs.Create(t, filepath.Join(root, "findme.txt"), filesystem)
159 filesystem,
175 filesystem := newFs()
178 fs.Create(t, createdPath, filesystem)
182 filesystem,
200 filesystem := newFs()
201 fs.Create(t, "/tmp/findme.txt", filesystem)
205 filesystem,
218 filesystem := newFs()
219 fs.Create(t, "/tmp/exclude/findme.txt", filesystem)
220 fs.Create(t, "/tmp/exclude/subdir/findme.txt", filesystem)
221 fs.Create(t, "/tmp/subdir/exclude/findme.txt", filesystem)
222 fs.Create(t, "/tmp/subdir/subdir/findme.txt", filesystem)
223 fs.Create(t, "/tmp/subdir/findme.txt", filesystem)
224 fs.Create(t, "/tmp/findme.txt", filesystem)
228 filesystem,
246 filesystem := newFs()
247 fs.Create(t, "/tmp/out/findme.txt", filesystem)
248 fs.Create(t, "/tmp/out/.ignore-out-dir", filesystem)
249 fs.Create(t, "/tmp/out/child/findme.txt", filesystem)
251 fs.Create(t, "/tmp/out2/.ignore-out-dir", filesystem)
252 fs.Create(t, "/tmp/out2/sub/findme.txt", filesystem)
254 fs.Create(t, "/tmp/findme.txt", filesystem)
255 fs.Create(t, "/tmp/include/findme.txt", filesystem)
259 filesystem,
278 filesystem := newFs()
279 fs.Create(t, "/tmp/a/findme.txt", filesystem)
280 fs.Create(t, "/tmp/a/subdir/findme.txt", filesystem)
281 fs.Create(t, "/tmp/b/findme.txt", filesystem)
282 fs.Create(t, "/tmp/b/subdir/findme.txt", filesystem)
286 filesystem,
302 filesystem := newFs()
303 fs.Create(t, "/tmp/a/findme.txt", filesystem)
304 fs.Create(t, "/tmp/a/subdir/findme.txt", filesystem)
305 fs.Create(t, "/tmp/b/findme.txt", filesystem)
306 fs.Create(t, "/tmp/b/subdir/findme.txt", filesystem)
310 filesystem,
330 filesystem := newFs()
331 fs.Create(t, "/tmp/findme.txt", filesystem)
332 fs.Create(t, "/tmp/a/findme.txt", filesystem)
333 fs.Create(t, "/tmp/a/misc.txt", filesystem)
338 filesystem,
356 filesystem := newFs()
358 fs.Create(t, "/tmp/ignore/hi.txt", filesystem)
359 fs.Create(t, "/tmp/include/hi.txt", filesystem)
360 fs.Create(t, "/cwd/hi.txt", filesystem)
361 fs.Create(t, "/cwd/a/hi.txt", filesystem)
362 fs.Create(t, "/cwd/a/a/hi.txt", filesystem)
363 fs.Create(t, "/rel/a/hi.txt", filesystem)
367 filesystem,
400 filesystem := newFs()
402 fs.Create(t, "/tmp/a/b/c/d/e/f/g/h/i/j/findme.txt", filesystem)
406 filesystem,
421 filesystem := newFs()
422 fs.Create(t, "/tmp/a/hi.txt", filesystem)
423 fs.Create(t, "/tmp/b/hi.txt", filesystem)
424 fs.Create(t, "/tmp/b/a/hi.txt", filesystem)
428 filesystem,
447 filesystem := newFs()
460 fs.Create(t, path, filesystem)
466 filesystem,
496 filesystem := newFs()
516 fs.Create(t, path, filesystem)
522 filesystem,
559 filesystem := newFs()
561 fs.Create(t, "/tmp/findme.txt", filesystem)
562 fs.Create(t, "/tmp/a/findme.txt", filesystem)
563 fs.Create(t, "/tmp/b/findme.txt", filesystem)
567 filesystem,
584 filesystem := newFs()
586 fs.Create(t, "/tmp/findme.txt", filesystem)
587 fs.Create(t, "/tmp/a/findme.txt", filesystem)
588 fs.Write(t, "/finder/finder-db", "sample header", filesystem)
592 filesystem,
609 filesystem := newFs()
610 fs.Create(t, "/tmp/findme.txt", filesystem)
611 fs.Create(t, "/tmp/a/findme.txt", filesystem)
616 filesystem,
630 cacheText := fs.Read(t, finder.DbPath, filesystem)
634 if len(filesystem.StatCalls) == 0 {
637 if len(filesystem.ReadDirCalls) == 0 {
640 statCalls := filesystem.StatCalls
641 filesystem.ClearMetrics()
647 fs.AssertSameReadDirCalls(t, filesystem.ReadDirCalls, []string{})
648 fs.AssertSameReadDirCalls(t, filesystem.StatCalls, statCalls)
655 filesystem := newFs()
656 fs.Create(t, "/tmp/findme.txt", filesystem)
657 fs.Create(t, "/tmp/a/findme.txt", filesystem)
662 filesystem,
675 numStatCalls := len(filesystem.StatCalls)
676 numReadDirCalls := len(filesystem.ReadDirCalls)
679 cacheReader, err := filesystem.Open(finder.DbPath)
688 filesystem.WriteFile(finder.DbPath, cacheData, 0777)
689 filesystem.ClearMetrics()
696 numNewStatCalls := len(filesystem.StatCalls)
697 numNewReadDirCalls := len(filesystem.ReadDirCalls)
719 filesystem := newFs()
720 fs.Create(t, "/tmp/a/findme.txt", filesystem)
725 filesystem,
736 fs.AssertSameStatCalls(t, filesystem.StatCalls, []string{"/tmp", "/tmp/a"})
737 fs.AssertSameReadDirCalls(t, filesystem.ReadDirCalls, []string{"/tmp", "/tmp/a"})
742 filesystem := newFs()
743 fs.Create(t, "/tmp/ignoreme.txt", filesystem)
744 fs.Create(t, "/tmp/a/findme.txt", filesystem)
745 fs.Create(t, "/tmp/b/ignore.txt", filesystem)
746 fs.Create(t, "/tmp/b/c/nope.txt", filesystem)
747 fs.Create(t, "/tmp/b/c/d/irrelevant.txt", filesystem)
752 filesystem,
758 filesystem.Clock.Tick()
765 filesystem.Clock.Tick()
766 fs.Create(t, "/tmp/b/c/findme.txt", filesystem)
767 filesystem.Clock.Tick()
768 filesystem.ClearMetrics()
776 …fs.AssertSameStatCalls(t, filesystem.StatCalls, []string{"/tmp", "/tmp/a", "/tmp/b", "/tmp/b/c", "…
777 fs.AssertSameReadDirCalls(t, filesystem.ReadDirCalls, []string{"/tmp/b/c"})
784 filesystem := newFs()
785 fs.Create(t, "/tmp/ignoreme.txt", filesystem)
786 fs.Create(t, "/tmp/a/findme.txt", filesystem)
787 fs.Create(t, "/tmp/b/ignore.txt", filesystem)
788 fs.Create(t, "/tmp/b/c/nope.txt", filesystem)
789 fs.Create(t, "/tmp/b/c/d/irrelevant.txt", filesystem)
794 filesystem,
806 filesystem.Clock.Tick()
807 fs.Create(t, "/tmp/b/c/new/findme.txt", filesystem)
808 fs.Create(t, "/tmp/b/c/new/new2/findme.txt", filesystem)
809 fs.Create(t, "/tmp/b/c/new/new2/ignoreme.txt", filesystem)
810 filesystem.ClearMetrics()
819 fs.AssertSameStatCalls(t, filesystem.StatCalls,
821 …fs.AssertSameReadDirCalls(t, filesystem.ReadDirCalls, []string{"/tmp/b/c", "/tmp/b/c/new", "/tmp/b…
828 filesystem := newFs()
829 fs.Create(t, "/tmp/hi1.txt", filesystem)
830 fs.Create(t, "/tmp/a/hi1.txt", filesystem)
835 filesystem,
847 filesystem.Clock.Tick()
848 fs.Create(t, "/tmp/hi2.txt", filesystem)
849 fs.Create(t, "/tmp/a/hi2.txt", filesystem)
850 filesystem.ClearMetrics()
859 fs.AssertSameStatCalls(t, filesystem.StatCalls,
861 fs.AssertSameReadDirCalls(t, filesystem.ReadDirCalls, []string{"/tmp", "/tmp/a"})
868 filesystem := newFs()
869 fs.Create(t, "/tmp/ignoreme.txt", filesystem)
870 fs.Create(t, "/tmp/a/findme.txt", filesystem)
871 fs.Create(t, "/tmp/b/findme.txt", filesystem)
872 fs.Create(t, "/tmp/b/c/nope.txt", filesystem)
873 fs.Create(t, "/tmp/b/c/d/irrelevant.txt", filesystem)
878 filesystem,
890 filesystem.Clock.Tick()
891 fs.Delete(t, "/tmp/b/findme.txt", filesystem)
892 filesystem.ClearMetrics()
900 …fs.AssertSameStatCalls(t, filesystem.StatCalls, []string{"/tmp", "/tmp/a", "/tmp/b", "/tmp/b/c", "…
901 fs.AssertSameReadDirCalls(t, filesystem.ReadDirCalls, []string{"/tmp/b"})
908 filesystem := newFs()
909 fs.Create(t, "/tmp/findme.txt", filesystem)
910 fs.Create(t, "/tmp/a/findme.txt", filesystem)
911 fs.Create(t, "/tmp/a/1/findme.txt", filesystem)
912 fs.Create(t, "/tmp/a/1/2/findme.txt", filesystem)
913 fs.Create(t, "/tmp/b/findme.txt", filesystem)
918 filesystem,
935 filesystem.Clock.Tick()
936 fs.RemoveAll(t, "/tmp/a/1", filesystem)
937 filesystem.ClearMetrics()
954 fs.AssertSameStatCalls(t, filesystem.StatCalls,
956 fs.AssertSameReadDirCalls(t, filesystem.ReadDirCalls, []string{"/tmp/a"})
963 filesystem := newFs()
964 fs.Create(t, "/tmp/findme.txt", filesystem)
965 fs.Create(t, "/tmp/a/findme.txt", filesystem)
966 fs.Create(t, "/tmp/a/1/findme.txt", filesystem)
967 fs.Create(t, "/tmp/a/1/2/findme.txt", filesystem)
968 fs.Create(t, "/tmp/b/findme.txt", filesystem)
973 filesystem,
990 filesystem.Clock.Tick()
991 fs.Move(t, "/tmp/a", "/tmp/c", filesystem)
992 filesystem.ClearMetrics()
1013 fs.AssertSameStatCalls(t, filesystem.StatCalls,
1015 …fs.AssertSameReadDirCalls(t, filesystem.ReadDirCalls, []string{"/tmp", "/tmp/c", "/tmp/c/1", "/tmp…
1021 filesystem := newFs()
1022 fs.Create(t, "/tmp/findme.txt", filesystem)
1023 fs.Create(t, "/tmp/a/findme.txt", filesystem)
1024 fs.Create(t, "/tmp/a/1/findme.txt", filesystem)
1025 fs.Create(t, "/tmp/a/1/2/findme.txt", filesystem)
1026 fs.Create(t, "/tmp/b/findme.txt", filesystem)
1031 filesystem,
1048 filesystem.Clock.Tick()
1049 fs.Move(t, "/tmp/a", "/tmp/temp", filesystem)
1050 fs.Move(t, "/tmp/b", "/tmp/a", filesystem)
1051 fs.Move(t, "/tmp/temp", "/tmp/b", filesystem)
1052 filesystem.ClearMetrics()
1073 fs.AssertSameStatCalls(t, filesystem.StatCalls,
1075 …fs.AssertSameReadDirCalls(t, filesystem.ReadDirCalls, []string{"/tmp", "/tmp/a", "/tmp/b", "/tmp/b…
1157 filesystem := newFs()
1159 fs.Create(t, fmt.Sprintf("/tmp/%v/findme.txt", i), filesystem)
1165 filesystem,
1175 string1 := fs.Read(t, finder.DbPath, filesystem)
1177 err := filesystem.Remove(finder.DbPath)
1187 string2 := fs.Read(t, finder.DbPath, filesystem)
1209 filesystem := newFs()
1210 fs.Create(t, "/tmp/findme.txt", filesystem)
1211 fs.Create(t, "/tmp/a/findme.txt", filesystem)
1212 fs.Create(t, "/tmp/a/misc.txt", filesystem)
1217 filesystem,
1226 filesystem.ClearMetrics()
1231 fs.AssertSameStatCalls(t, filesystem.StatCalls, []string{})
1232 fs.AssertSameReadDirCalls(t, filesystem.ReadDirCalls, []string{})
1239 filesystem := newFs()
1240 fs.Create(t, "/tmp/findme.txt", filesystem)
1241 fs.Create(t, "/tmp/a/findme.txt", filesystem)
1242 fs.Create(t, "/tmp/a/metoo.txt", filesystem)
1247 filesystem,
1256 filesystem.ClearMetrics()
1261 fs.AssertSameStatCalls(t, filesystem.StatCalls, []string{})
1262 fs.AssertSameReadDirCalls(t, filesystem.ReadDirCalls, []string{})
1269 filesystem := newFs()
1270 fs.Create(t, "/tmp/a/hi.txt", filesystem)
1271 fs.Create(t, "/tmp/a/ignoreme.txt", filesystem)
1272 fs.Link(t, "/tmp/hi.txt", "a/hi.txt", filesystem)
1273 fs.Link(t, "/tmp/b/hi.txt", "../a/hi.txt", filesystem)
1274 fs.Link(t, "/tmp/c/hi.txt", "/tmp/hi.txt", filesystem)
1275 fs.Link(t, "/tmp/d/hi.txt", "../a/bye.txt", filesystem)
1276 fs.Link(t, "/tmp/d/bye.txt", "../a/hi.txt", filesystem)
1277 fs.Link(t, "/tmp/e/bye.txt", "../a/bye.txt", filesystem)
1278 fs.Link(t, "/tmp/f/hi.txt", "somethingThatDoesntExist", filesystem)
1283 filesystem,
1305 filesystem := newFs()
1306 fs.Create(t, "/tmp/dir/hi.txt", filesystem)
1307 fs.Create(t, "/tmp/dir/ignoreme.txt", filesystem)
1309 fs.Link(t, "/tmp/links/dir", "../dir", filesystem)
1310 fs.Link(t, "/tmp/links/link", "../dir", filesystem)
1311 fs.Link(t, "/tmp/links/hi.txt", "../dir", filesystem)
1312 fs.Link(t, "/tmp/links/broken", "nothingHere", filesystem)
1313 fs.Link(t, "/tmp/links/recursive", "recursive", filesystem)
1318 filesystem,
1339 filesystem := newFs()
1340 fs.Create(t, "/tmp/out/hi.txt", filesystem)
1341 fs.Create(t, "/tmp/out/a/hi.txt", filesystem)
1342 fs.Create(t, "/tmp/hi.txt", filesystem)
1347 filesystem,
1366 filesystem.Clock.Tick()
1367 fs.Create(t, "/tmp/out/.ignore-out-dir", filesystem)
1377 filesystem := newFs()
1378 fs.Create(t, "/tmp/a/hi.txt", filesystem)
1379 fs.Create(t, "/tmp/b/bye.txt", filesystem)
1384 filesystem,
1390 filesystem.Clock.Tick()
1397 filesystem.Clock.Tick()
1398 fs.Create(t, "/tmp/b/hi.txt", filesystem)
1399 filesystem.Clock.Tick()
1400 filesystem.ClearMetrics()
1408 fs.AssertSameReadDirCalls(t, filesystem.ReadDirCalls, []string{"/tmp/b"})
1409 expectedDbWriteTime := filesystem.Clock.Time()
1410 actualDbWriteTime := fs.ModTime(t, finder2.DbPath, filesystem)
1417 filesystem.ClearMetrics()
1425 fs.AssertSameReadDirCalls(t, filesystem.ReadDirCalls, []string{})
1427 actualDbWriteTime = fs.ModTime(t, finder3.DbPath, filesystem)
1436 filesystem := newFs()
1437 fs.Create(t, "/tmp/hi.txt", filesystem)
1438 fs.Create(t, "/tmp/a/hi.txt", filesystem)
1439 fs.Create(t, "/tmp/a/a/hi.txt", filesystem)
1440 fs.Create(t, "/tmp/b/hi.txt", filesystem)
1445 filesystem,
1451 filesystem.Clock.Tick()
1459 filesystem.Clock.Tick()
1461 fs.SetReadable(t, "/tmp/a", false, filesystem)
1462 filesystem.Clock.Tick()
1472 fs.SetReadable(t, "/tmp/a", true, filesystem)
1484 filesystem := newFs()
1485 fs.Create(t, "/tmp/hi.txt", filesystem)
1486 fs.SetReadable(t, "/tmp/hi.txt", false, filesystem)
1491 filesystem,
1497 filesystem.Clock.Tick()
1506 filesystem := newFs()
1507 fs.Create(t, "/tmp/a/hi.txt", filesystem)
1512 filesystem,
1518 filesystem.Clock.Tick()
1525 fs.SetReadErr(t, "/tmp/a", os.ErrInvalid, filesystem)