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); }
protected TemporaryStorageTestBase(ITestOutputHelper output) : base(output) { try { EngineEnvironmentSettings.SkipExtraneousPins.Value = true; string testClassName = LimitPathLength(GetType().Name); // In Xunit we can't really get the test method name. So we just pick an increasing integer. int testMethodNumber = 0; lock (s_temporaryNames) { if (s_temporaryNames.TryGetValue(testClassName, out testMethodNumber)) { testMethodNumber++; s_temporaryNames[testClassName] = testMethodNumber; } else { s_temporaryNames.Add(testClassName, testMethodNumber); } } // C# identifiers are valid path atoms. See IsValidPathAtom and http://msdn.microsoft.com/en-us/library/aa664670(v=vs.71).aspx Contract.Assume(testClassName != null && PathAtom.Validate((StringSegment)testClassName)); m_tempBase = Path.GetFullPath(Path.Combine(GetTempDir(), testClassName, testMethodNumber.ToString(CultureInfo.InvariantCulture))); if (Directory.Exists(m_tempBase)) { FileUtilities.DeleteDirectoryContents(m_tempBase); } Directory.CreateDirectory(m_tempBase); string moveDeleteDirectory = Path.Combine(m_tempBase, TestMoveDeleteCleaner.MoveDeleteDirectoryName); MoveDeleteCleaner = new TestMoveDeleteCleaner(moveDeleteDirectory); } catch (Exception) { Dispose(); throw; } }