/// <nodoc/> public SchedulerIntegrationTestBase(ITestOutputHelper output) : base(output) { m_testOutputHelper = output; CaptureAllDiagnosticMessages = false; // Each event listener that we want to capture events from must be listed here foreach (var eventSource in BuildXLApp.GeneratedEventSources) { RegisterEventSource(eventSource); } // Go through the command line configuration handling used by the real app to get the appropriate defaults ICommandLineConfiguration config; XAssert.IsTrue(Args.TryParseArguments(new[] { "/c:" + Path.Combine(TemporaryDirectory, "config.dc") }, Context.PathTable, null, out config), "Failed to construct arguments"); Configuration = new CommandLineConfiguration(config); Cache = InMemoryCacheFactory.Create(); FileContentTable = FileContentTable.CreateNew(LoggingContext); // Disable defaults that write disk IO but are not critical to correctness or performance Configuration.Logging.StoreFingerprints = false; Configuration.Logging.LogExecution = false; Configuration.Engine.TrackBuildsInUserFolder = false; Configuration.Engine.CleanTempDirectories = false; Configuration.Sandbox.EnsureTempDirectoriesExistenceBeforePipExecution = true; // Skip hash source file pips // Some error becomes a contract exception when SkipHashSourceFile is enabled. // Mostly on methods that traverse graph, e.g., DirectedGraph.GetOutgoingEdges(); // BUG 1472567 // Configuration.Schedule.SkipHashSourceFile = true; // Compute static pip fingerprints for incremental scheduling tests. Configuration.Schedule.ComputePipStaticFingerprints = true; // Disable currently enabled unsafe option. Configuration.Sandbox.UnsafeSandboxConfigurationMutable.IgnoreCreateProcessReport = false; // Populate file system capabilities. // Here, for example, we use copy-on-write instead of hardlinks when Unix file system supports copy-on-write. // Particular tests can override this by setting Configuration.Engine.UseHardlinks. BuildXLEngine.PopulateFileSystemCapabilities(Configuration, Configuration, Context.PathTable, LoggingContext); // Reset pip graph builder to use the populated configuration. ResetPipGraphBuilder(); }
public PipQueueTestExecutionEnvironment(BuildXLContext context, IConfiguration configuration, PipTable pipTable, string tempDirectory, ISandboxConnection SandboxConnection = null) { Contract.Requires(context != null); Contract.Requires(configuration != null); Context = context; LoggingContext = CreateLoggingContextForTest(); Configuration = configuration; FileContentTable = FileContentTable.CreateNew(); ContentFingerprinter = new PipContentFingerprinter( context.PathTable, artifact => State.FileContentManager.GetInputContent(artifact).FileContentInfo, ExtraFingerprintSalts.Default(), pathExpander: PathExpander); PipTable = pipTable; PipFragmentRenderer = this.CreatePipFragmentRenderer(); IpcProvider = IpcFactory.GetProvider(); var tracker = FileChangeTracker.CreateDisabledTracker(LoggingContext); Cache = InMemoryCacheFactory.Create(); LocalDiskContentStore = new LocalDiskContentStore(LoggingContext, context.PathTable, FileContentTable, tracker); m_sandboxConnectionKext = SandboxConnection; m_expectedWrittenContent = new ConcurrentDictionary <FileArtifact, ContentHash>(); m_wellKnownFiles = new ConcurrentDictionary <FileArtifact, ContentHash>(); m_producers = new ConcurrentDictionary <FileArtifact, Pip>(); m_filesystemView = new TestPipGraphFilesystemView(Context.PathTable); var fileSystemView = new FileSystemView(Context.PathTable, m_filesystemView, LocalDiskContentStore); TempCleaner = new TestMoveDeleteCleaner(tempDirectory); State = new PipExecutionState( configuration, cache: new PipTwoPhaseCache(LoggingContext, Cache, context, PathExpander), unsafeConfiguration: configuration.Sandbox.UnsafeSandboxConfiguration, preserveOutputsSalt: ContentHashingUtilities.CreateRandom(), fileAccessWhitelist: FileAccessWhitelist, directoryMembershipFingerprinter: this, pathExpander: PathExpander, executionLog: null, fileSystemView: fileSystemView, fileContentManager: new FileContentManager(this, new NullOperationTracker()), directoryMembershipFinterprinterRuleSet: null); m_sealContentsById = new ConcurrentBigMap <DirectoryArtifact, int[]>(); ProcessInContainerManager = new ProcessInContainerManager(LoggingContext, context.PathTable); }