Ejemplo n.º 1
0
        public void RebuildAfterCleanObjectsWithLazyOutputMaterialization()
        {
            BeforeRebuild("Build #1");
            Configuration.Schedule.EnableLazyOutputMaterialization = true;

            Configuration.Schedule.EnableLazyWriteFileMaterialization = true;
            Configuration.Engine.DefaultFilter = @"output='*\HelloWorldFinal.out'";

            BuildCounters counters = Build("Build #2");

            // Execute HelloWorldFinal.exe.
            counters.VerifyNumberOfPipsExecuted(1);

            // Cache hit for everything else.
            counters.VerifyNumberOfProcessPipsCached(TotalPips - 1);
            counters.VerifyNumberOfPipsBringContentToLocal(TotalPips - 1);

            counters.VerifyNumberOfCachedOutputsUpToDate(0);

            // Intermediates which are inputs to executed process are materialized from cache
            // \obj\HelloWorldIntermediate.out (output)
            counters.VerifyNumberOfCachedOutputsCopied(1);

            // Copy file outputs (actually deployed from cache but CopyFile outputs are logged as produced):
            // \obj\deploy\bin\HelloWorldFinal.exe(output)
            // \obj\deploy\bin\HelloWorldFinal.exe.config(output)

            // Output of executed process (HelloWorldFinal.exe):
            // \obj\HelloWorldFinal.out (output)

            // Write file output (NOT MATERIALIZED due to lazy materialization):
            // \obj\HelloWorld.cs (output)
            counters.VerifyNumberOfOutputsProduced(Configuration.Schedule.EnableLazyWriteFileMaterialization ? 3 : 4);
        }
Ejemplo n.º 2
0
        public void RebuildAfterCleanObjectsWithoutLazyOutputMaterialization()
        {
            BeforeRebuild("Build #1");
            Configuration.Schedule.EnableLazyOutputMaterialization = false;

            BuildCounters counters = Build("Build #2");

            // Execute HelloWorldFinal.exe.
            counters.VerifyNumberOfPipsExecuted(1);

            // Csc-compile HelloWorldIntermediate.exe, HelloWorldFinal.exe.
            // Running HelloWorldIntermediate.exe.
            counters.VerifyNumberOfProcessPipsCached(3);

            counters.VerifyNumberOfCachedOutputsUpToDate(0);

            // Because obj\ was destroyed.
            // Fetch HelloWorldIntermediate.exe, HelloWorldFinal.exe.
            // Fetch HelloWorldIntermediate.out.
            counters.VerifyNumberOfCachedOutputsCopied(3);

            // Deploy HelloWorldIntermediate.exe, HelloWolrdIntermediate.exe.config.
            // Deploy HelloWorldFinal.exe, HelloWolrdFinal.exe.config.
            // Produce HelloWorldFinal.out.
            // Produce HelloWorld.cs
            counters.VerifyNumberOfOutputsProduced(6);
        }
Ejemplo n.º 3
0
        public void IncrementalBuildRunsPipsImpactedFromChangedSources()
        {
            SetupTestState();
            EagerCleanBuild("Build #1");

            // SourceFile2 is used by the second process, but not the first. Only the second process run.
            Paths buildPaths = GetBuildPaths();

            File.WriteAllText(buildPaths.SourceFile2Path, "Hey! Look at this new input!");

            BuildCounters counters = Build("Build #2");

            counters.VerifyNumberOfPipsExecuted(1);
            counters.VerifyNumberOfProcessPipsCached(TotalPips - 1);
            VerifyNumberOfCachedOutputs(counters, totalUpToDate: 1, totalCopied: 0);

            // Despite being a partial build, results from the single pip run should have been cached for next time.
            EagerBuildWithoutChanges("Build #3");
        }
Ejemplo n.º 4
0
        public void IncrementalBuildCopiesContentWhenOutputsDeletedWithLazyOutputMaterialization()
        {
            SetupTestState();
            Configuration.Engine.DefaultFilter = @"output='" + Path.Combine(Configuration.Layout.ObjectDirectory.ToString(PathTable), "combined") + Path.DirectorySeparatorChar + "*'";
            EagerCleanBuild("Build #1");

            Paths buildPaths = GetBuildPaths();

            File.Delete(buildPaths.CopyOfSourceFile1Path);
            File.Delete(buildPaths.FinalOutputPath);

            BuildCounters counters = Build("Build #2");

            counters.VerifyNumberOfPipsExecuted(0);
            counters.VerifyNumberOfProcessPipsCached(TotalPips);
            counters.VerifyNumberOfCachedOutputsUpToDate(0);

            // Although CopyOfSourceFile1Path is deleted, since output materialization is lazy, the file is not materialized.
            counters.VerifyNumberOfCachedOutputsCopied(TotalPipOutputs - 1);
        }
Ejemplo n.º 5
0
        public void IncrementalBuildCopiesContentWhenOutputsDeleted()
        {
            SetupTestState();
            EagerCleanBuild("Build #1");

            Paths buildPaths = GetBuildPaths();

            File.Delete(buildPaths.CopyOfSourceFile1Path);
            File.Delete(buildPaths.FinalOutputPath);

            Configuration.Schedule.EnableLazyOutputMaterialization = false;

            BuildCounters counters = Build("Build #2");

            counters.VerifyNumberOfPipsExecuted(0);
            counters.VerifyNumberOfProcessPipsCached(TotalPips);
            counters.VerifyNumberOfCachedOutputsUpToDate(0);
            counters.VerifyNumberOfCachedOutputsCopied(TotalPipOutputs);

            // The next build should know that outputs are up to date, despite them having been re-deployed rather than re-computed last time.
            EagerBuildWithoutChanges("Build #3");
        }