コード例 #1
0
        /// <nodoc />
        public SandboxedProcessPipExecutionResult(
            SandboxedProcessPipExecutionStatus status,
            SortedReadOnlyArray <ObservedFileAccess, ObservedFileAccessExpandedPathComparer> observedFileAccesses,
            IReadOnlyDictionary <AbsolutePath, IReadOnlyCollection <FileArtifactWithAttributes> > sharedDynamicDirectoryWriteAccesses,
            Tuple <AbsolutePath, Encoding> encodedStandardOutput,
            Tuple <AbsolutePath, Encoding> encodedStandardError,
            int numberOfWarnings,
            FileAccessReportingContext unexpectedFileAccesses,
            ProcessTimes primaryProcessTimes,
            JobObject.AccountingInformation?jobAccountingInformation,
            int exitCode,
            long sandboxPrepMs,
            long processSandboxedProcessResultMs,
            long processStartTime,
            IReadOnlyList <ReportedFileAccess> allReportedFileAccesses,
            IReadOnlyList <ProcessDetouringStatusData> detouringStatuses,
            long maxDetoursHeapSize,
            ContainerConfiguration containerConfiguration,
            Dictionary <string, int> pipProperties,
            bool timedOut,
            IReadOnlySet <AbsolutePath> createdDirectories,
            RetryInfo retryInfo = null)
        {
            Contract.Requires(!ProcessCompletedExecution(status) || observedFileAccesses.IsValid);
            Contract.Requires(!ProcessCompletedExecution(status) || unexpectedFileAccesses != null);
            Contract.Requires(!ProcessCompletedExecution(status) || primaryProcessTimes != null);
            Contract.Requires(encodedStandardOutput == null || (encodedStandardOutput.Item1.IsValid && encodedStandardOutput.Item2 != null));
            Contract.Requires(encodedStandardError == null || (encodedStandardError.Item1.IsValid && encodedStandardError.Item2 != null));
            Contract.Requires(numberOfWarnings >= 0);
            Contract.Requires(containerConfiguration != null);
            Contract.Requires(retryInfo == null || status != SandboxedProcessPipExecutionStatus.Succeeded);

            // Protect against invalid combinations of RetryLocation and RetryReason
            Contract.Requires(!retryInfo.CanBeRetriedInlineOrFalseIfNull() || retryInfo.RetryReason != RetryReason.ResourceExhaustion);
            Contract.Requires(!retryInfo.CanBeRetriedInlineOrFalseIfNull() || retryInfo.RetryReason != RetryReason.ProcessStartFailure);
            Contract.Requires(!retryInfo.CanBeRetriedInlineOrFalseIfNull() || retryInfo.RetryReason != RetryReason.TempDirectoryCleanupFailure);
            Contract.Requires(!retryInfo.CanBeRetriedInlineOrFalseIfNull() || retryInfo.RetryReason != RetryReason.StoppedWorker);

            Status = status;
            ObservedFileAccesses     = observedFileAccesses;
            UnexpectedFileAccesses   = unexpectedFileAccesses;
            EncodedStandardOutput    = encodedStandardOutput;
            EncodedStandardError     = encodedStandardError;
            NumberOfWarnings         = numberOfWarnings;
            PrimaryProcessTimes      = primaryProcessTimes;
            JobAccountingInformation = jobAccountingInformation;
            ExitCode      = exitCode;
            SandboxPrepMs = sandboxPrepMs;
            ProcessSandboxedProcessResultMs = processSandboxedProcessResultMs;
            ProcessStartTimeMs                  = processStartTime;
            AllReportedFileAccesses             = allReportedFileAccesses;
            DetouringStatuses                   = detouringStatuses;
            MaxDetoursHeapSizeInBytes           = maxDetoursHeapSize;
            SharedDynamicDirectoryWriteAccesses = sharedDynamicDirectoryWriteAccesses;
            ContainerConfiguration              = containerConfiguration;
            PipProperties      = pipProperties;
            TimedOut           = timedOut;
            RetryInfo          = retryInfo;
            CreatedDirectories = createdDirectories ?? CollectionUtilities.EmptySet <AbsolutePath>();
        }
コード例 #2
0
 /// <summary>
 /// Helper method to create a project with predictions rooted at the test root
 /// </summary>
 /// <returns></returns>
 public NinjaNode CreateNinjaNode(
     string rule    = null,
     string command = null,
     IReadOnlySet <AbsolutePath> inputs           = null,
     IReadOnlySet <AbsolutePath> outputs          = null,
     IReadOnlyCollection <NinjaNode> dependencies = null)
 {
     return(new NinjaNode(
                rule ?? "",
                command ?? $@"{CMD} /C ""cd .""",
                inputs ?? new ReadOnlyHashSet <AbsolutePath>(),
                outputs ?? new ReadOnlyHashSet <AbsolutePath>(),
                dependencies ?? CollectionUtilities.EmptySet <NinjaNode>()
                ));
 }
コード例 #3
0
        private static ObservedInputProcessingResult CreateResult(PathTable pathTable, params ObservedInput[] inputs)
        {
            var sorted = SortedReadOnlyArray <ObservedInput, ObservedInputExpandedPathComparer> .SortUnsafe(
                inputs,
                new ObservedInputExpandedPathComparer(pathTable.ExpandedPathComparer));

            var emptyObservedAccessFileNames = SortedReadOnlyArray <StringId, CaseInsensitiveStringIdComparer> .FromSortedArrayUnsafe(
                ReadOnlyArray <StringId> .Empty,
                new CaseInsensitiveStringIdComparer(pathTable.StringTable));

            return(ObservedInputProcessingResult.CreateForSuccess(
                       sorted,
                       emptyObservedAccessFileNames,
                       dynamicObservations: ReadOnlyArray <(AbsolutePath, DynamicObservationKind)> .Empty,
                       allowedUndeclaredSourceReads: CollectionUtilities.EmptySet <AbsolutePath>()));
        }
コード例 #4
0
ファイル: BuildXLReader.cs プロジェクト: gravitytrope/BuildXL
        /// <summary>
        /// Reads a ReadOnlySet
        /// </summary>
        public IReadOnlySet <T> ReadReadOnlySet <T>(Func <BuildXLReader, T> reader)
        {
            Contract.Requires(reader != null);
            Start <IReadOnlySet <T> >();
            int length = ReadInt32Compact();

            if (length == 0)
            {
                End();
                return(CollectionUtilities.EmptySet <T>());
            }

            T[] array = ReadArrayCore(reader, length);

            End();
            return(new ReadOnlyHashSet <T>(array));
        }
コード例 #5
0
        /// <summary>
        /// Creates a configuration created for a specific process
        /// </summary>
        public ContainerConfiguration(
            PathTable pathTable,
            IReadOnlyDictionary <ExpandedAbsolutePath, IReadOnlyList <ExpandedAbsolutePath> > redirectedDirectories,
            IReadOnlyDictionary <AbsolutePath, IReadOnlyList <ExpandedAbsolutePath> > originalDirectories,
            bool enableWciFilter = true,
            IReadOnlySet <ExpandedAbsolutePath> bindFltExcludedPaths = null)
        {
            Contract.Requires(redirectedDirectories.Count == 0 || pathTable != null);
            Contract.Requires(redirectedDirectories != null);
            Contract.Requires(originalDirectories != null);

            IsIsolationEnabled    = redirectedDirectories.Count > 0;
            RedirectedDirectories = redirectedDirectories;
            OriginalDirectories   = originalDirectories;
            EnableWciFilter       = enableWciFilter;
            BindFltExcludedPaths  = bindFltExcludedPaths ?? CollectionUtilities.EmptySet <ExpandedAbsolutePath>();
        }
コード例 #6
0
            /// <inheritdoc/>
            public SortedReadOnlyArray <FileArtifact, OrdinalFileArtifactComparer> ListSealDirectoryContents(DirectoryArtifact directory, out IReadOnlySet <AbsolutePath> temporaryFiles)
            {
                var dirContent = m_pipExecutionEnvironment.State.FileContentManager.ListSealedDirectoryContents(directory);

                using (var pooledSet = Pools.GetAbsolutePathSet())
                {
                    var instance = pooledSet.Instance;
                    instance.UnionWith(dirContent
                                       .Where(file => m_pipExecutionEnvironment.State.FileContentManager.TryGetInputContent(file, out var materializationInfo) &&
                                              materializationInfo.Hash == WellKnownContentHashes.AbsentFile)
                                       .Select(file => file.Path));

                    temporaryFiles = instance.Count > 0
                        ? new ReadOnlyHashSet <AbsolutePath>(instance)
                        : CollectionUtilities.EmptySet <AbsolutePath>();
                }

                return(dirContent);
            }
コード例 #7
0
 public IReadOnlySet <FileArtifact> GetExistenceAssertionsUnderOpaqueDirectory(DirectoryArtifact directoryArtifact)
 {
     return(CollectionUtilities.EmptySet <FileArtifact>());
 }
コード例 #8
0
 /// <inheritdoc/>
 public SortedReadOnlyArray <FileArtifact, OrdinalFileArtifactComparer> ListSealDirectoryContents(DirectoryArtifact directory, out IReadOnlySet <AbsolutePath> temporaryFiles)
 {
     temporaryFiles = CollectionUtilities.EmptySet <AbsolutePath>();
     return(SortedReadOnlyArray <FileArtifact, OrdinalFileArtifactComparer> .CloneAndSort(m_inputContent, OrdinalFileArtifactComparer.Instance));
 }