-
Notifications
You must be signed in to change notification settings - Fork 341
Add background option for testhosts #3772
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -337,6 +337,7 @@ public void Initialize(IMessageLogger logger, string runsettingsXml) | |
|
|
||
| Shared = !runConfiguration.DisableAppDomain; | ||
| _hostExitedEventRaised = false; | ||
|
|
||
| IsInitialized = true; | ||
| } | ||
|
|
||
|
|
@@ -506,20 +507,24 @@ private bool LaunchHost(TestProcessStartInfo testHostStartInfo, CancellationToke | |
| return false; | ||
| } | ||
|
|
||
| SetProcessPriority(_testHostProcess, _environmentVariableHelper); | ||
| AdjustProcessPriorityBasedOnSettings(_testHostProcess, testHostStartInfo.EnvironmentVariables); | ||
| OnHostLaunched(new HostProviderEventArgs("Test Runtime launched", 0, _testHostProcess.Id)); | ||
|
|
||
| return true; | ||
| } | ||
|
|
||
| internal static void SetProcessPriority(Process testHostProcess, IEnvironmentVariableHelper environmentVariableHelper) | ||
| internal static void AdjustProcessPriorityBasedOnSettings(Process testHostProcess, IDictionary<string, string?>? testHostEnvironmentVariables) | ||
| { | ||
| ProcessPriorityClass testHostPriority = ProcessPriorityClass.BelowNormal; | ||
| try | ||
| { | ||
| testHostPriority = environmentVariableHelper.GetEnvironmentVariableAsEnum("VSTEST_HOST_INTERNAL_PRIORITY", testHostPriority); | ||
| testHostProcess.PriorityClass = testHostPriority; | ||
| EqtTrace.Verbose("Setting test host process priority to {0}", testHostProcess.PriorityClass); | ||
| if (testHostEnvironmentVariables is not null | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Evangelink @nohwnd I am not familiar with the code base - but is DefaultTestHostManager also used when parallel is not in play? Just want to make sure that it is possible to create low prio test hosts - Also if the answer to b) above is yes, then it may be better to rename this to something more general like VSTEST_BACKGROUND_OPERATION or VSTEST_BACKGROUND_PRIORITY :)
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes that code is used even in "sequential". This is used to decide on the level of parallelism (including sequential) to use. |
||
| && testHostEnvironmentVariables.TryGetValue("VSTEST_BACKGROUND_DISCOVERY", out var isBackgroundDiscoveryEnabled) | ||
| && isBackgroundDiscoveryEnabled == "1") | ||
| { | ||
| testHostProcess.PriorityClass = testHostPriority; | ||
| EqtTrace.Verbose("Setting test host process priority to {0}", testHostProcess.PriorityClass); | ||
| } | ||
| } | ||
| // Setting the process Priority can fail with Win32Exception, NotSupportedException or InvalidOperationException. | ||
| catch (Exception ex) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.