Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Enable tests to compile with netstandard #15956

Merged
merged 7 commits into from Feb 8, 2017
Merged

Conversation

tarekgh
Copy link
Member

@tarekgh tarekgh commented Feb 8, 2017

Most of the tests have netstandard configurations and it doesn't compile. the changes here is to fix the configurations and the tests to compile.
This is important step to get netfx tests compile too as we are in most of the time netfx fallback to netstandard configuration

The changes include some fixes to compile teh sources too.

Most of the tests have netstandard configurations and it doesn't compile. the changes here is to fix the configurations and the tests to compile.
This is important step to get netfx tests compile too as we are in most of the time netfx fallback to netstandard configuration

The changes include some fixes to compile teh sources too.
@tarekgh
Copy link
Member Author

tarekgh commented Feb 8, 2017

@weshaggard could you please have a look?

Note this step to get the tests compile fine with netstandard but I believe we need to have a look later to the projects which not having netstandard configurations and decide if we need to enable it to other configurations (e.g netfx).

FYI to @danmosemsft

@@ -2,7 +2,6 @@
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<BuildConfigurations>
netstandard;
Copy link
Member Author

@tarekgh tarekgh Feb 8, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@weshaggard ignore removing this one. I'll try to get this back as I am ifdef the code specific to netcoreapp

@tarekgh
Copy link
Member Author

tarekgh commented Feb 8, 2017

test Innerloop Windows_NT Debug Build and Test please

@tarekgh tarekgh self-assigned this Feb 8, 2017
@JeremyKuhne
Copy link
Member

it looks the System.IO.Prots tests not stable.

Thanks for the heads up. @willdean We should open specific issues for the tests and work through them. I'll disable this particular one.

12:08:09         ERROR!!! Read Method ReadByte timed out in 637ms expected something less then 100ms
12:08:09         Expected: True
12:08:09         Actual:   False
12:08:09         Stack Trace:
12:08:09            D:\j\workspace\windows_nt_de---4526f5ff\src\System.IO.Ports\tests\Legacy\Support\PortsTest.cs(24,0): at System.IO.PortsTests.PortsTest.Fail(String format, Object[] args)
12:08:09            D:\j\workspace\windows_nt_de---4526f5ff\src\System.IO.Ports\tests\Legacy\SerialPort\ReadTimeout.cs(301,0): at ReadTimeout_Property.VerifyZeroTimeout(SerialPort com, ReadMethodDelegate readMethod)
12:08:09            D:\j\workspace\windows_nt_de---4526f5ff\src\System.IO.Ports\tests\Legacy\SerialPort\ReadTimeout.cs(243,0): at ReadTimeout_Property.VerifyZeroTimeoutBeforeOpen(ReadMethodDelegate readMethod)
12:08:09            D:\j\workspace\windows_nt_de---4526f5ff\src\System.IO.Ports\tests\Legacy\SerialPort\ReadTimeout.cs(127,0): at ReadTimeout_Property.ReadTimeout_0_ReadByte_BeforeOpen()

@tarekgh
Copy link
Member Author

tarekgh commented Feb 8, 2017

@JeremyKuhne the failed are 3 tests.

ReadTimeout_Property.ReadTimeout_0_ReadByte_BeforeOpen
ReadTimeout_Property.ReadTimeout_0_Read_byte_int_int_AfterOpen
ReadTimeout_Property.ReadTimeout_0_Read_byte_int_int_BeforeOpen

@JeremyKuhne
Copy link
Member

I'm going to put all of the ReadTimeout tests in an issue. I assume we need to have very generous thresholds and as such they'll need to move (at least in part) to outer loop.

@@ -18,7 +18,7 @@
-->
<Target Name="ConstructTestingHost"
BeforeTargets="Build;BuildAllProjects"
Condition="!Exists('$(ConstructSharedFxSem)') OR '$(ReconstructSharedFx)' == 'true'" >
Condition="(!Exists('$(ConstructSharedFxSem)') OR '$(ReconstructSharedFx)' == 'true') And '$(TargetGroup)' != 'netfx'" >
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I recently deleted this file so you can undo this change.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am seeing the conflict :-)

netstandard;
netstandard1.1;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you figure out why the netstandard1.1 configuration was picked? I'm mainly interested because we might need to add it back at some point.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't look at this yet but I'll try later as I am curious too.

@@ -2,7 +2,6 @@
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<BuildConfigurations>
net45-Windows_NT;
netstandard1.1;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you are removing the netstandard1.1 ref you should probably do the same for the src.

@willdean
Copy link
Contributor

willdean commented Feb 8, 2017

@JeremyKuhne There are loads of tests playing games with StopWatch which might have this problem if the VM decides to run very slowly - I hadn't seen any sign of this particular group causing problems on previous CI runs, but to have an issue to dump slow tests into seems like a good idea.

In reality we could relax the max time limits in these test without necessarily making the tests run any slower on average, they would just have more room if the VM did go slow.

@@ -62,6 +62,7 @@ public static IEnumerable<object[]> Parse_TestData()
yield return new object[] { "1", false, UInt64Enum.One };
yield return new object[] { "5", false, (UInt64Enum)5 };

#if netcoreapp
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these #ifdef'ed because of missing APIs or because of differences in behavior? If it is API this is fine but we should consider splitting them into another file instead of a ton of #ifdef's. If it is behavior differences then we need to file bugs and get them investigated further as we shouldn't blindly disable large sets of tests for that.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is because missing APIs. do you want me split the test in this PR or we can do it later?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I split the code to its own files

@@ -6,15 +6,17 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<NoWarn>1718</NoWarn>
<DefineConstants Condition="'$(TargetGroup)'=='netstandard'">$(DefineConstants);netstandard17</DefineConstants>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still need netstandard17 in this project?

@tarekgh
Copy link
Member Author

tarekgh commented Feb 8, 2017

@weshaggard I am merging this one. if you have any more comments I can address it in another PR. thanks for reviewing it.

@tarekgh tarekgh merged commit 15b4f51 into dotnet:master Feb 8, 2017
@karelz karelz modified the milestone: 2.0.0 Feb 9, 2017
@tarekgh tarekgh deleted the NetFXTests branch October 27, 2017 17:49
macrogreg pushed a commit to open-telemetry/opentelemetry-dotnet-instrumentation that referenced this pull request Sep 24, 2020
* Enable tests to compile with netstandard

Most of the tests have netstandard configurations and it doesn't compile. the changes here is to fix the configurations and the tests to compile.
This is important step to get netfx tests compile too as we are in most of the time netfx fallback to netstandard configuration

The changes include some fixes to compile teh sources too.

* Fix System.Collections.Immutable

* update src configuration

* remove netstandard17 defines

* Split netcoreapp code to its own files

* Remove 17 from the test class name


Commit migrated from dotnet/corefx@15b4f51
picenka21 pushed a commit to picenka21/runtime that referenced this pull request Feb 18, 2022
* Enable tests to compile with netstandard

Most of the tests have netstandard configurations and it doesn't compile. the changes here is to fix the configurations and the tests to compile.
This is important step to get netfx tests compile too as we are in most of the time netfx fallback to netstandard configuration

The changes include some fixes to compile teh sources too.

* Fix System.Collections.Immutable

* update src configuration

* remove netstandard17 defines

* Split netcoreapp code to its own files

* Remove 17 from the test class name


Commit migrated from dotnet/corefx@15b4f51
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
6 participants