-
Notifications
You must be signed in to change notification settings - Fork 261
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
[WIP] In assembly parallel #296
Changes from 30 commits
41c9616
621da1b
87c41cb
912cc54
95e912a
9377a41
550b70d
560411e
6262793
69a2392
9bd125b
c442547
93f3d8b
26d68c8
fa60189
4f1dcef
8c5b283
ec72649
053969f
4b37cba
5b51599
7555ed1
7821679
ee36c06
59882e6
a2f5bfc
1b9a78b
fcecc7c
d26387a
575ccc1
4a4637e
2f9c7ba
256151e
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 |
---|---|---|
@@ -0,0 +1,62 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
namespace Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution | ||
{ | ||
using System; | ||
using System.Security; | ||
using Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Helpers; | ||
using Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.ObjectModel; | ||
|
||
internal class TestAssemblySettingsProvider : MarshalByRefObject | ||
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. Should we build an abstraction for The TestSource could be serializable. |
||
{ | ||
private ReflectHelper reflectHelper; | ||
|
||
public TestAssemblySettingsProvider() | ||
: this(new ReflectHelper()) | ||
{ | ||
} | ||
|
||
internal TestAssemblySettingsProvider(ReflectHelper reflectHelper) | ||
{ | ||
this.reflectHelper = reflectHelper; | ||
} | ||
|
||
/// <summary> | ||
/// Returns object to be used for controlling lifetime, null means infinite lifetime. | ||
/// </summary> | ||
/// <returns> | ||
/// The <see cref="object"/>. | ||
/// </returns> | ||
[SecurityCritical] | ||
public override object InitializeLifetimeService() | ||
{ | ||
return null; | ||
} | ||
|
||
internal TestAssemblySettings GetSettings(string source) | ||
{ | ||
var testAssemblySettings = new TestAssemblySettings(); | ||
|
||
// Load the source. | ||
var testAssembly = PlatformServiceProvider.Instance.FileOperations.LoadAssembly(source, isReflectionOnly: false); | ||
|
||
var parallelizeAttribute = this.reflectHelper.GetParallelizeAttribute(testAssembly); | ||
|
||
if (parallelizeAttribute != null) | ||
{ | ||
testAssemblySettings.Workers = parallelizeAttribute.Workers; | ||
testAssemblySettings.Scope = parallelizeAttribute.Scope; | ||
|
||
if (testAssemblySettings.Workers == 0) | ||
{ | ||
testAssemblySettings.Workers = Environment.ProcessorCount; | ||
} | ||
} | ||
|
||
testAssemblySettings.CanParallelizeAssembly = !this.reflectHelper.IsDoNotParallelizeSet(testAssembly); | ||
|
||
return testAssemblySettings; | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should check for
IsAssemblyInitializeExecuted
before attempting to request lock.