public void TestAllPipsOption()
        {
            FileArtifact srcA = CreateSourceFile();
            FileArtifact outA = CreateOutputFileArtifact();
            Process      pipA = CreateAndSchedulePipBuilder(new Operation[]
            {
                Operation.ReadFile(srcA),
                Operation.WriteFile(outA)
            }).Process;

            // Make pipB dependent on pipA
            FileArtifact srcB = CreateSourceFile();
            Process      pipB = CreateAndSchedulePipBuilder(new Operation[]
            {
                Operation.ReadFile(srcB),
                Operation.ReadFile(outA),
                Operation.WriteFile(CreateOutputFileArtifact())
            }).Process;

            RunScheduler().AssertCacheMiss(pipA.PipId, pipB.PipId);

            ScheduleRunResult buildA = RunScheduler().AssertCacheHit(pipA.PipId, pipB.PipId);

            // Force miss on pipA
            File.WriteAllText(ArtifactToPrint(srcA), "asdf");
            // Force miss on pipB
            File.WriteAllText(ArtifactToPrint(srcB), "hjkl");

            ScheduleRunResult buildB = RunScheduler().AssertCacheMiss(pipA.PipId, pipB.PipId);

            AnalyzerResult result = RunAnalyzer(buildA, buildB);

            result.AssertPipMiss(
                pipA,
                PipCacheMissType.MissForDescriptorsDueToWeakFingerprints,
                ArtifactToPrint(srcA));

            // Don't analyze downstream pip misses
            XAssert.IsFalse(result.FileOutput.Contains(pipB.FormattedSemiStableHash));

            Option allPips = new Option
            {
                Name = "allPips",
            };

            AnalyzerResult allPipsResult = RunAnalyzer(buildA, buildB, additionalArgs: new Option[] { allPips });

            allPipsResult.AssertPipMiss(
                pipA,
                PipCacheMissType.MissForDescriptorsDueToWeakFingerprints,
                ArtifactToPrint(srcA));
            // Analyze downstream pips
            allPipsResult.AssertPipMiss(
                pipA,
                PipCacheMissType.MissForDescriptorsDueToWeakFingerprints,
                ArtifactToPrint(srcB));
        }
示例#2
0
        public void FilterSkippedPipNoFingerprint()
        {
            FileArtifact src = CreateSourceFile();

            var pipBuilderA = this.CreatePipBuilder(new Operation[]
            {
                Operation.ReadFile(src),
                Operation.WriteFile(CreateOutputFileArtifact())
            });

            pipBuilderA.AddTags(Context.StringTable, "pipA");
            Process pipA = SchedulePipBuilder(pipBuilderA).Process;

            // Create independent pipB
            var pipBuilderB = this.CreatePipBuilder(new Operation[]
            {
                Operation.ReadFile(src),
                Operation.WriteFile(CreateOutputFileArtifact())
            });

            pipBuilderB.AddTags(Context.StringTable, "pipB");
            Process pipB = SchedulePipBuilder(pipBuilderB).Process;

            RunScheduler().AssertCacheMiss(pipA.PipId, pipB.PipId);

            Configuration.Filter = "tag='pipB'"; // filter graph to just pipB

            var buildA = RunScheduler().AssertCacheHit(pipB.PipId);

            Configuration.Filter = ""; // reset filter to default

            // Cause a miss on pipA and pipB
            File.WriteAllText(ArtifactToPrint(src), "asdf");
            var buildB = RunScheduler().AssertCacheMiss(pipA.PipId, pipB.PipId);

            var messages = new string[] { ArtifactToPrint(src) };

            AnalyzerResult result = RunAnalyzer(buildA, buildB);

            // Missing fingerprint for pipA because it was filtered out in last build
            result.AssertPipMiss(
                pipA,
                PipCacheMissType.MissForDescriptorsDueToWeakFingerprints,
                messages);

            // Normal analysis for pipB
            result.AssertPipMiss(
                pipB,
                PipCacheMissType.MissForDescriptorsDueToWeakFingerprints,
                messages);
        }
示例#3
0
        public void IncrementalSchedulingSkippedPipNoFingerprint()
        {
            Configuration.Schedule.IncrementalScheduling = true;
            Configuration.Schedule.SkipHashSourceFile    = false;

            FileArtifact src = CreateSourceFile();
            Process      pip = CreateAndSchedulePipBuilder(new Operation[]
            {
                Operation.ReadFile(src),
                Operation.WriteFile(CreateOutputFileArtifact())
            }).Process;

            RunScheduler().AssertCacheMiss(pip.PipId);

            // Incremental scheduling will skip executing clean pip
            var buildA = RunScheduler().AssertCacheHit(pip.PipId);

            File.WriteAllText(ArtifactToPrint(src), "asfd");
            var buildB = RunScheduler().AssertCacheMiss(pip.PipId);

            var messages = new string[] { ArtifactToPrint(src) };

            AnalyzerResult result = RunAnalyzer(buildA, buildB);

            // The pip is in the old graph, but there is no weak fingerprint computation
            // to compare to since it was skipped in the last build
            result.AssertPipMiss(
                pip,
                PipCacheMissType.MissForDescriptorsDueToWeakFingerprints,
                messages);
        }