public void TestGraphFileSystem() { var harness = new Harness(Context.PathTable); // Rewritten file harness.AddArtifact(A("b", "dir", "out", "bin", "a2.dll"), 0); harness.AddArtifact(A("b", "dir", "out", "bin", "a2.dll"), 1); harness.AddArtifact(A("b", "dir", "out", "bin", "a3.dll"), 3); harness.AddArtifact(A("b", "dir", "out", "gen1.cs"), 1); harness.AddArtifact(A("b", "dir", "out", "gen2.cs"), 2); harness.AddArtifact(A("b", "dir", "a.cs"), 0); harness.AddArtifact(A("b", "dir", "b.cs"), 0); harness.AddArtifact(A("b", "dir", "output.dll"), 1); harness.AddArtifact(A("b", "src", "foo.txt"), 0); harness.AddArtifact(A("b", "src", "jab.txt"), 0); harness.AddRealPath(A("b", "src", "real.ds"), PathExistence.ExistsAsFile); harness.VerifyGraphExistence(A("b", "dir"), FileSystemViewMode.FullGraph, PathExistence.ExistsAsDirectory); harness.VerifyGraphExistence(A("b", "dir", "out"), FileSystemViewMode.FullGraph, PathExistence.ExistsAsDirectory); harness.VerifyGraphExistence(A("b", "dir", "out", "bin", "a2.dll"), FileSystemViewMode.FullGraph, PathExistence.ExistsAsFile); harness.VerifyGraphExistence(A("b", "dir", "out", "bin", "a3.dll"), FileSystemViewMode.FullGraph, PathExistence.ExistsAsFile); harness.VerifyGraphExistence(A("b", "dir"), FileSystemViewMode.Output, PathExistence.ExistsAsDirectory); harness.VerifyGraphExistence(A("b", "dir", "out"), FileSystemViewMode.Output, PathExistence.ExistsAsDirectory); harness.VerifyGraphExistence(A("b", "dir", "out", "bin", "a2.dll"), FileSystemViewMode.Output, PathExistence.ExistsAsFile); harness.VerifyGraphExistence(A("b", "dir", "out", "bin", "a3.dll"), FileSystemViewMode.Output, PathExistence.ExistsAsFile); // Paths which are non-existent in output graph but existent in full graph // Also verify they are non-existent in real fs harness.VerifyExistence(A("b", "src", "foo.txt"), FileSystemViewMode.Real, PathExistence.Nonexistent, shouldBeProbed: true); harness.VerifyGraphExistence(A("b", "src", "foo.txt"), FileSystemViewMode.FullGraph, PathExistence.ExistsAsFile); harness.VerifyGraphExistence(A("b", "src", "foo.txt"), FileSystemViewMode.Output, PathExistence.Nonexistent); harness.VerifyExistence(A("b", "src"), FileSystemViewMode.Real, PathExistence.ExistsAsDirectory, shouldBeProbed: true); harness.VerifyGraphExistence(A("b", "src"), FileSystemViewMode.FullGraph, PathExistence.ExistsAsDirectory); harness.VerifyGraphExistence(A("b", "src"), FileSystemViewMode.Output, PathExistence.Nonexistent); // Enumerate same directories in output graph and full graph harness.ExpectEnumerationMembers(A("b", ""), FileSystemViewMode.Output, Dir(A("b", "dir"))); harness.ExpectEnumerationMembers(A("b", ""), FileSystemViewMode.FullGraph, Dir(A("b", "dir")), Dir(A("b", "src"))); harness.ExpectEnumerationMembers(A("b", "dir"), FileSystemViewMode.Output, Dir(A("b", "dir", "out")), File(A("b", "dir", "output.dll"))); harness.ExpectEnumerationMembers(A("b", "dir"), FileSystemViewMode.FullGraph, Dir(A("b", "dir", "out")), File(A("b", "dir", "output.dll")), File(A("b", "dir", "a.cs")), File(A("b", "dir", "b.cs"))); // Query the same path in all three file systems which only exists on real file system harness.VerifyExistence(A("b", "src", "real.ds"), FileSystemViewMode.Real, PathExistence.ExistsAsFile, shouldBeProbed: true); harness.ResetProbes(); harness.VerifyGraphExistence(A("b", "src", "real.ds"), FileSystemViewMode.FullGraph, PathExistence.Nonexistent); harness.ResetProbes(); harness.VerifyGraphExistence(A("b", "src", "real.ds"), FileSystemViewMode.Output, PathExistence.Nonexistent); harness.ResetProbes(); }