Esempio n. 1
0
        public void RelationTable_can_be_built()
        {
            PackedExecution packedExecution = new PackedExecution();

            PackedExecution.Builder packedExecutionBuilder = new PackedExecution.Builder(packedExecution);
            long   hash   = 1;
            string name   = "ShellCommon.Shell.ShellCommon.Shell.Merged.Winmetadata";
            PipId  pipId1 = packedExecutionBuilder.PipTableBuilder.Add(hash, name, PipType.Process);
            PipId  pipId2 = packedExecutionBuilder.PipTableBuilder.Add(hash + 1, $"{name}2", PipType.Process);
            PipId  pipId3 = packedExecutionBuilder.PipTableBuilder.Add(hash + 2, $"{name}3", PipType.SealDirectory);
            PipId  pipId4 = packedExecutionBuilder.PipTableBuilder.Add(hash + 3, $"{name}4", PipType.Process);

            packedExecution.ConstructRelationTables();

            RelationTable <PipId, PipId> relationTable = packedExecution.PipDependencies;

            RelationTable <PipId, PipId> .Builder builder = new RelationTable <PipId, PipId> .Builder(relationTable);

            // add relations in any order (but without cycles)
            // 1 <- 2
            // 1 <- 3
            // 2 <- 4
            // 3 <- 4
            builder.Add(pipId2, pipId1);
            builder.Add(pipId3, pipId1);
            builder.Add(pipId4, pipId2);
            builder.Add(pipId4, pipId3);

            // done adding relations; flush to table
            builder.Complete();

            CheckRelation(packedExecution, pipId1, pipId2, pipId3, pipId4, relationTable);
        }
Esempio n. 2
0
        public void RelationTable_can_be_built()
        {
            PackedExecution packedExecution = new PackedExecution();

            PackedExecution.Builder packedExecutionBuilder = new PackedExecution.Builder(packedExecution);
            long   hash   = 1;
            string name   = "ShellCommon.Shell.ShellCommon.Shell.Merged.Winmetadata";
            PipId  pipId  = packedExecutionBuilder.PipTableBuilder.Add(hash, name, PipType.Process);
            PipId  pipId2 = packedExecutionBuilder.PipTableBuilder.Add(hash + 1, $"{name}2", PipType.Process);
            PipId  pipId3 = packedExecutionBuilder.PipTableBuilder.Add(hash + 2, $"{name}3", PipType.Process);

            packedExecution.ConstructRelationTables();

            RelationTable <PipId, PipId> relationTable = packedExecution.PipDependencies;

            RelationTable <PipId, PipId> .Builder builder = new RelationTable <PipId, PipId> .Builder(relationTable);

            // add relations in any order
            builder.Add(pipId3, pipId2);
            builder.Add(pipId3, pipId);
            builder.Add(pipId, pipId3);
            builder.Add(pipId, pipId2);

            // done adding relations; flush to table
            builder.Complete();

            XAssert.AreArraysEqual(new[] { pipId2, pipId3 }, relationTable[pipId].ToArray(), true);
            XAssert.AreArraysEqual(new PipId[0], relationTable[pipId2].ToArray(), true);
            XAssert.AreArraysEqual(new[] { pipId, pipId2 }, relationTable[pipId3].ToArray(), true);

            XAssert.AreArraysEqual(new[] { pipId2, pipId3 }, relationTable.Enumerate(pipId).ToArray(), true);
            XAssert.AreArraysEqual(new PipId[0], relationTable.Enumerate(pipId2).ToArray(), true);
            XAssert.AreArraysEqual(new[] { pipId, pipId2 }, relationTable.Enumerate(pipId3).ToArray(), true);
        }
Esempio n. 3
0
            /// <summary>
            /// Complete the builders that need completing.
            /// </summary>
            /// <remarks>
            /// The builders that need completing are MultiValueTable.Builders, or builders derived therefrom.
            /// </remarks>
            public void Complete()
            {
                PipExecutionTableBuilder.Complete();
                ProcessExecutionTableBuilder.Complete();
                ProcessPipExecutionTableBuilder.Complete();

                if (ConsumedFilesBuilder != null)
                {
                    ConsumedFilesBuilder.Complete();
                    DeclaredInputFilesBuilder.Complete();
                    DeclaredInputDirectoriesBuilder.Complete();
                    DirectoryContentsBuilder.Complete();
                }
            }