Esempio n. 1
0
        public void ConsumeFilterPassingFile(bool topOnly)
        {
            FileArtifact source;

            if (topOnly)
            {
                source = FileArtifact.CreateSourceFile(SourceRootPath.Combine(Context.PathTable, "file.txt"));
            }
            else
            {
                var nestedDir = AbsolutePath.Create(Context.PathTable, Path.Combine(SourceRoot, "nested"));
                source = FileArtifact.CreateSourceFile(nestedDir.Combine(Context.PathTable, "file.txt"));
            }

            WriteSourceFile(source);
            var output = CreateOutputFileArtifact(ObjectRoot);

            SealDirectory     sealedDirectory = CreateSourceSealDirectory(SourceRootPath, topOnly ? SealDirectoryKind.SourceTopDirectoryOnly : SealDirectoryKind.SourceAllDirectories, "*.txt", "*.cs");
            DirectoryArtifact dir             = PipGraphBuilder.AddSealDirectory(sealedDirectory);

            var builder = CreatePipBuilder(new Operation[]
            {
                Operation.ReadFile(source, doNotInfer: true),
                Operation.WriteFile(output),
            });

            builder.AddInputDirectory(dir);
            SchedulePipBuilder(builder);

            RunScheduler().AssertSuccess();
        }
Esempio n. 2
0
        public void ConsumeFilterNotPassingFile()
        {
            FileArtifact source = FileArtifact.CreateSourceFile(SourceRootPath.Combine(Context.PathTable, "file.txt"));

            WriteSourceFile(source);
            var output = CreateOutputFileArtifact(ObjectRoot);

            SealDirectory     sealedDirectory = CreateSourceSealDirectory(SourceRootPath, SealDirectoryKind.SourceTopDirectoryOnly, "*.cs");
            DirectoryArtifact dir             = PipGraphBuilder.AddSealDirectory(sealedDirectory);

            var builder = CreatePipBuilder(new Operation[]
            {
                Operation.ReadFile(source, doNotInfer: true),
                Operation.WriteFile(output),
            });

            builder.AddInputDirectory(dir);
            SchedulePipBuilder(builder);

            RunScheduler().AssertFailure();
            AssertVerboseEventLogged(ProcessesLogEventId.PipProcessDisallowedFileAccess);
            AssertVerboseEventLogged(LogEventId.DependencyViolationMissingSourceDependency);
            AssertWarningEventLogged(LogEventId.ProcessNotStoredToCacheDueToFileMonitoringViolations);
            AssertErrorEventLogged(LogEventId.FileMonitoringError);
        }
Esempio n. 3
0
 private TestHarness CreateDefaultHarness()
 {
     return(new TestHarness(
                Context,
                SourceRootPath.Combine(Context.PathTable, PathAtom.Create(Context.StringTable, "config.dsc")),
                TryGetSubstSourceAndTarget(out var substSource, out var substTarget)
         ? (substSource, substTarget)
         : default((string, string)?)));
 }
 private TestHarness CreateDefaultHarness()
 {
     return(new TestHarness(
                Context,
                SourceRootPath.Combine(Context.PathTable, PathAtom.Create(Context.StringTable, "config.dsc"))));
 }