diff options
author | danmosemsft <danmose@microsoft.com> | 2017-05-03 07:11:00 +0300 |
---|---|---|
committer | danmosemsft <danmose@microsoft.com> | 2017-05-03 07:11:00 +0300 |
commit | 3977680c7af89e055ccd5544fd6d096c1f1e4bd4 (patch) | |
tree | 339bce778f04deb62c387fad70154bdb053dfd57 /src/System.Threading.Thread | |
parent | 30ca89cc8f164b19d1e78cc0d544d043fa124333 (diff) |
Fix threading test for nano
Diffstat (limited to 'src/System.Threading.Thread')
-rw-r--r-- | src/System.Threading.Thread/tests/System.Threading.Thread.Tests.csproj | 3 | ||||
-rw-r--r-- | src/System.Threading.Thread/tests/ThreadTests.cs | 12 |
2 files changed, 14 insertions, 1 deletions
diff --git a/src/System.Threading.Thread/tests/System.Threading.Thread.Tests.csproj b/src/System.Threading.Thread/tests/System.Threading.Thread.Tests.csproj index 273901b62c..45a5c81583 100644 --- a/src/System.Threading.Thread/tests/System.Threading.Thread.Tests.csproj +++ b/src/System.Threading.Thread/tests/System.Threading.Thread.Tests.csproj @@ -15,6 +15,9 @@ <Compile Include="ThreadTests.cs" /> </ItemGroup> <ItemGroup> + <Compile Include="$(CommonTestPath)\System\PlatformDetection.cs"> + <Link>Common\System\PlatformDetection.cs</Link> + </Compile> <Compile Include="$(CommonTestPath)\System\Threading\ThreadTestHelpers.cs"> <Link>CommonTest\System\Threading\ThreadPoolHelpers.cs</Link> </Compile> diff --git a/src/System.Threading.Thread/tests/ThreadTests.cs b/src/System.Threading.Thread/tests/ThreadTests.cs index 4829237467..7a1d9b7cbb 100644 --- a/src/System.Threading.Thread/tests/ThreadTests.cs +++ b/src/System.Threading.Thread/tests/ThreadTests.cs @@ -178,7 +178,17 @@ namespace System.Threading.Threads.Tests Assert.Equal(ApartmentState.STA, getApartmentState(t)); t.Start(); Assert.True(t.Join(UnexpectedTimeoutMilliseconds)); - Assert.Equal(ApartmentState.STA, apartmentStateInThread); + + if (PlatformDetection.IsWindowsNanoServer) + { + // Nano server threads are always MTA. If you set the thread to STA + // it will read back as STA but when the thread starts it will read back as MTA. + Assert.Equal(ApartmentState.MTA, apartmentStateInThread); + } + else + { + Assert.Equal(ApartmentState.STA, apartmentStateInThread); + } } [Theory] |