public void TestProcessDump() { var sourceFile = CreateSourceFile(); var outputFile = CreateOutputFileArtifact(); Process process = CreateCmdProcess(dependencies: new[] { sourceFile }, outputs: new[] { outputFile }); PipGraphBuilder.AddProcess(process); RunAndAssertDumpPip(process); }
private Pip[] CreateGraph(int numNodes, string graphAsString) { // parse edges var graph = SimpleGraph.Parse(numNodes, graphAsString); // for each node create a single output file var outFiles = Enumerable .Range(0, numNodes) .Select(_ => CreateOutputFileArtifact()) .ToArray(); // for each node create a Process pip with a single output file and dependencies according to 'edges' var processes = Enumerable .Range(0, numNodes) .Select(procIdx => { var dependencies = graph .Edges .Where(e => e.Dest == procIdx) .Select(e => outFiles[e.Src]) .ToArray(); var processBuilder = new ProcessBuilder(); var arguments = SchedulerTestBase.CreateCmdArguments( stringTable: Context.StringTable, dependencies: dependencies, outputs: new[] { outFiles[procIdx] }); return(processBuilder .WithContext(Context) .WithWorkingDirectory(GetWorkingDirectory()) .WithStandardDirectory(GetStandardDirectory()) .WithExecutable(CmdExecutable) .WithArguments(arguments) .WithDependencies(dependencies) .WithOutputs(outFiles[procIdx]) .WithProvenance(CreateProvenance()) .Build()); }) .ToArray(); // add created processes to PipGraphBuilder foreach (var proc in processes) { PipGraphBuilder.AddProcess(proc); } // return created processes return(processes); }
public ProcessWithOutputs SchedulePipBuilder(ProcessBuilder builder) { AddUntrackedWindowsDirectories(builder); if (!builder.TryFinish(PipConstructionHelper, out var process, out var outputs)) { throw new BuildXLTestException("Failed to construct process pip"); } if (!PipGraphBuilder.AddProcess(process)) { throw new BuildXLTestException("Failed to add process pip"); } return(new ProcessWithOutputs(process, outputs)); }
public void TestProcessDump() { var sourceFile = CreateSourceFile(); var outputFile = CreateOutputFileArtifact(); Process process = CreateCmdProcess(dependencies: new[] { sourceFile }, outputs: new[] { outputFile }); PipGraphBuilder.AddProcess(process); RunAndAssertDumpPip(process); // Test a few empty list fields to ensure they did not get printed out var pipWrittenToFile = Encoding.UTF8.GetString(File.ReadAllBytes(GetDumpFilePath(process))); // This pip does not have any of the following fields set (they will have size 0 lists) Assert.False(pipWrittenToFile.Contains("Tags")); Assert.False(pipWrittenToFile.Contains("Environment Variables")); Assert.False(pipWrittenToFile.Contains("Retry Exit Codes")); }