Example #1
0
 protected static void AssertEdges(PipGraph pipGraph, SimpleGraph file2file, List <Pip> pips, StringTable stringTable)
 {
     XAssert.All(
         file2file.Edges,
         edge =>
     {
         var srcPip  = FindPipByTag(pips, GetProcTag(edge.Src), stringTable);
         var destPip = FindPipByTag(pips, GetProcTag(edge.Dest), stringTable);
         var deps    = pipGraph.RetrievePipImmediateDependencies(srcPip).ToList();
         if (!deps.Contains(destPip))
         {
             XAssert.Fail($"Edge ({edge.Src})->({edge.Dest}) not found: expected an edge between {srcPip} <-- {destPip}; dependencies of Pip {srcPip} are: {XAssert.SetToString(deps)}");
         }
     });
 }
Example #2
0
        protected static void AssertMonikerConsistencyForIpcPip(IEnumerable <IpcPip> ipcPips, PipGraph pipGraph)
        {
            XAssert.All(
                ipcPips,
                ipcPip =>
            {
                var servicePip = (Process)pipGraph.RetrievePipImmediateDependencies(ipcPip).FirstOrDefault(p => (p as Process)?.IsService == true);
                XAssert.IsNotNull(servicePip, $" could not find service pip dependency of ipc pip {ipcPip.PipId}");

                var finalizationPip = pipGraph.PipTable.HydratePip(servicePip.ServiceInfo.ShutdownPipId, global::BuildXL.Pips.PipQueryContext.Test) as Process;
                XAssert.IsNotNull(finalizationPip, $" could not find finalization pip for ipc pip {ipcPip.PipId}");

                var shutdownPip = pipGraph.PipTable.HydratePip(servicePip.ServiceInfo.FinalizationPipIds.First(), global::BuildXL.Pips.PipQueryContext.Test) as Process;
                XAssert.IsNotNull(shutdownPip, $" could not find shutdown pip for ipc pip {ipcPip.PipId}");

                StringId servicePipMoniker = ExtractMonikerValueFromPipData(servicePip.Arguments);
                XAssert.AreEqual(servicePipMoniker, ExtractMonikerValueFromPipData(ipcPip.MessageBody), "service pip and ipc pip monikers don't match");
                XAssert.AreEqual(servicePipMoniker, ExtractMonikerValueFromPipData(finalizationPip.Arguments), "service pip and finalization pip monikers don't match");
                XAssert.AreEqual(servicePipMoniker, ExtractMonikerValueFromPipData(shutdownPip.Arguments), "service pip and shutdown pip monikers don't match");
            });
        }
Example #3
0
        private static void SetCommonPipDetails(Pip p, PipDetails result)
        {
            IVisualizationInformation visualizationInformation = EngineModel.VisualizationInformation;
            PipGraph pipGraph    = visualizationInformation.PipGraph.Value;
            var      scheduler   = visualizationInformation.Scheduler.Value;
            var      context     = visualizationInformation.Context.Value;
            var      pathTable   = context.PathTable;
            var      symbolTable = context.SymbolTable;

            result.Id   = p.PipId.Value;
            result.Hash = p.SemiStableHash.ToString("X16", CultureInfo.InvariantCulture);
            result.QualifierAsString = p.Provenance != null?context.QualifierTable.GetCanonicalDisplayString(p.Provenance.QualifierId) : "";

            result.Description = p.GetDescription(context);
            result.State       = scheduler.GetPipState(p.PipId);

            result.Tags = p.Tags.IsValid ? p.Tags.Select(tag => pathTable.StringTable.GetString(tag)).ToList() : new List <string>();

            IEnumerable <Pip> dependents = pipGraph.RetrievePipImmediateDependents(p);

            result.DependantOf = dependents
                                 .Where(d => d.PipType != PipType.HashSourceFile)
                                 .Select(f => FromPip(f))
                                 .ToList();

            IEnumerable <Pip> dependencies = pipGraph.RetrievePipImmediateDependencies(p);

            result.DependsOn = dependencies
                               .Where(d => d.PipType != PipType.HashSourceFile)
                               .Select(f => FromPip(f))
                               .ToList();

            IEnumerable <ValuePip> valuePips = dependents.Where(pipId => pipId.PipType == PipType.Value).Cast <ValuePip>();

            result.Values = valuePips.Select(valuePip => ValueReference.Create(symbolTable, pathTable, valuePip));
        }