Skip to content
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

Moving Libraries Control tests to NUnit #7234

Merged
merged 3 commits into from
Jul 22, 2019
Merged

Moving Libraries Control tests to NUnit #7234

merged 3 commits into from
Jul 22, 2019

Conversation

thinkbeforecoding
Copy link
Contributor

No description provided.

@dnfclas
Copy link

dnfclas commented Jul 14, 2019

CLA assistant check
All CLA requirements met.

Copy link
Contributor

@forki forki left a comment

Choose a reason for hiding this comment

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

Awesome

@thinkbeforecoding
Copy link
Contributor Author

@forki if we all migrate some of those tests, it could quick 😄

@thinkbeforecoding
Copy link
Contributor Author

I started with a small one, to check I got it correctly

@forki
Copy link
Contributor

forki commented Jul 14, 2019

if we all migrate some of those tests, it could quick

Yes that's the idea. Crowdsourcing ftw.

Also it's always nice to have new contributors

@thinkbeforecoding
Copy link
Contributor Author

@forki If moving more tests, is it better to add them to this PR or to create a new PR for each ?

@sergey-tihon
Copy link
Contributor

@thinkbeforecoding I vote for new PRs for each.
Smaller PRs -> fasters merge -> master in better shape -> easier to track what is done and what is missing.

@sergey-tihon
Copy link
Contributor

Looks like the similar error as here #7210 (comment)

Copy link
Contributor

@cartermp cartermp left a comment

Choose a reason for hiding this comment

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

Looks good overall, some minor changes for comments (in case we have to go in later and determine what's going on), and some questions for @dsyme

tests/fsharp/Libraries/ControlTests.fs Outdated Show resolved Hide resolved
tests/fsharp/Libraries/ControlTests.fs Outdated Show resolved Hide resolved
tests/fsharp/Libraries/ControlTests.fs Outdated Show resolved Hide resolved
tests/fsharp/Libraries/ControlTests.fs Outdated Show resolved Hide resolved
@forki
Copy link
Contributor

forki commented Jul 14, 2019 via email

@cartermp
Copy link
Contributor

Additionally, it might be helpful to rename the folder to Async and the main file to AsyncTests, since the "control" name has since been deprecated and each piece of it was broken into a separate file in FSharp.Core.

@thinkbeforecoding
Copy link
Contributor Author

On netcore, tests are failing, with a

Method not found: 'Microsoft.FSharp.Control.FSharpAsync`1<...>'

It seems it's because CompilerAssert.CompileExeAndRun isn't prepared to run with build FSharp.Core.dll

@thinkbeforecoding
Copy link
Contributor Author

For folder, something like:

Libraries/
    + Async/
          + AsyncTests.fs

?

@cartermp
Copy link
Contributor

@thinkbeforecoding Yep!

@cartermp
Copy link
Contributor

Also @KevinRansom the failure is interesting, the project file looks fine to me though: https://github.com/dotnet/fsharp/blob/master/tests/fsharp/FSharpSuite.Tests.fsproj

@thinkbeforecoding
Copy link
Contributor Author

Looks like the similar error as here #7210 (comment)

Yes looks like the same issue

@thinkbeforecoding
Copy link
Contributor Author

@cartermp It seems the error occurs when running the exe built by the test when it uses FSharp.Core.

@thinkbeforecoding
Copy link
Contributor Author

I managed to reproduce the error locally.. investigation under way

@thinkbeforecoding
Copy link
Contributor Author

@cartermp could it be due to the fact that there is no .deps.json file created along the generated exe ?

@thinkbeforecoding
Copy link
Contributor Author

adding a .deps.json doesn't seem to solve the issue 🤨

@forki
Copy link
Contributor

forki commented Jul 15, 2019 via email

@thinkbeforecoding
Copy link
Contributor Author

thinkbeforecoding commented Jul 15, 2019

I tried copying the netsandard1.6 version of Fsharp.Core along the exe.. But getting the same error.

And actually the the fsharp.core is already present during the test. as well as a .runtimeconfig.json that seem valid.

When executing from the cmd line dotnet C:\Users\x\AppData\Local\Temp\tmpECF1.exe manually I get the same error, so the problem is not in the exe invocation code.

@thinkbeforecoding
Copy link
Contributor Author

I've also inspected the .exe and FSharp.Core.dll, and they seem ok and the method exists in FSharp.Core.dll ...

@forki
Copy link
Contributor

forki commented Jul 15, 2019 via email

@thinkbeforecoding
Copy link
Contributor Author

It's working with net framework but not with dotnet core on windows...
To test, is swapped the fx in from test project to put netcorapp2.1 first. This way tests are run in netcoreapp2.1 and failing

@thinkbeforecoding
Copy link
Contributor Author

@cartermp @TIHan ? Any idea 😶 ?

@thinkbeforecoding
Copy link
Contributor Author

Still trying to understand...
In the test compiled code, it fails on Async.RunSynchronously, but if I replace it with Async.Start, it doesn't cause the method not found exception...

@thinkbeforecoding
Copy link
Contributor Author

I could attach a debugger inside the generated exe, and the attached FSharp.Core is the correct on, and has a method:

T RunSynchronously[T](Microsoft.FSharp.Control.FSharpAsync`1[T], Microsoft.FSharp.Core.FSharpOption`1[System.Int32], Microsoft.FSharp.Core.FSharpOption`1[System.Threading.CancellationToken])

and the error says it tries to find:

!!0 Microsoft.FSharp.Control.FSharpAsync.RunSynchronously(Microsoft.FSharp.Control.FSharpAsync`1<!!0>, Microsoft.FSharp.Core.FSharpOption`1<System.Int32>, Microsoft.FSharp.Core.FSharpOption`1<System.Threading.CancellationToken>)

where !!0 seems to be the generic type. The only difference I see is that the second one does not show that the method is generic...

@thinkbeforecoding
Copy link
Contributor Author

The problem definitely occurs only with Generic methods !

@thinkbeforecoding
Copy link
Contributor Author

this is the ILSpy of the line that cause the exception:

	IL_0015: call !!0 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync::RunSynchronously<valuetype [System.Private.CoreLib]System.Int32[]>(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1<!!0>, class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1<valuetype [System.Private.CoreLib]System.Int32>, class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1<valuetype [System.Private.CoreLib]System.Threading.CancellationToken>)
	IL_001a: ret

@thinkbeforecoding
Copy link
Contributor Author

This is the module information for the loaded FSharp.Core while running:

FSharp.Core.dll
FSharp.Core.dll
C:\Users\x\AppData\Local\Temp\FSharp.Core.dll
No
N/A
Symbols loaded. C:\Development\fsharp\artifacts\obj\FSharp.Core\Debug\netstandard1.6\FSharp.Core.pdb
4
42.42.42.42424
17/09/2105 11:10
00000217689E0000-0000021768D10000
[24384] dotnet.exe
[1] clrhost

The module timestamp is really strange.

@cartermp
Copy link
Contributor

@KevinRansom any ideas?

@thinkbeforecoding
Copy link
Contributor Author

We managed with @Tarmil to make a minimal repro 👍

This is passing:

        CompilerAssert.CompileExeAndRun
            """
module M
let v = List.head [1;2]
()
            """

and this is not passing:

    CompilerAssert.CompileExeAndRun
          """
module M
let v = List.item 1 [1;2]
()
          """

Any call to an FSharp.Core method that takes an Int32 raise the 'MissingMethodException' error.
It's been tested with exit RunSynchronously (takes an optional int timeout), and List.item (takes an int).
Other tested methods that dont take an int (Async.Ignore, Async.Start, List.head) work correctly.

Is there a mismatch in the corelib references ?

@KevinRansom
Copy link
Member

@cartermp do the changes meet your expectations?

@cartermp cartermp merged commit d53a38c into dotnet:master Jul 22, 2019
TIHan pushed a commit to TIHan/visualfsharp that referenced this pull request Jul 31, 2019
* Copy sources from Versions.props to NuGet.config (dotnet#7191)

* Only check distinct errors (dotnet#7140)

* Use 1-based column numbers in tests (dotnet#7141)

* Use 1-based column numbers in tests

* Helper that can check for multiple type errors

* Update dependencies from https://github.com/dotnet/arcade build 20190710.8 (dotnet#7200)

- Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19360.8

* Better record and value formatting in tools (dotnet#7021)

* Remove semicolons from record tooltips

* Update to put a space between braces

* Update formatting as best I can, plus some tests I guess

* More baseline updates

* Anonymous records

* Update anon records tests

* Add vsbsl lol

* Update baselines and reduce a simple filter

* Update baselines maybe last time

* Update fsharpqa test

* make tests pass

* Add formatting for values

* Update tests

* Update test

* Update fsharpqa tests

* tryit

* lol

* get yote

* shlerp

* Update tests again I guess

* more update

* mother of pearl

* this is a real turd

* fix portable PDBs for anon records (dotnet#7099)

* fix portable PDBs for anon records (dotnet#7099)

* Moving ElseBranchHasWrongTypeTests over to NUnit (dotnet#7104)

* Port tests for missing else branch to NUnit (dotnet#7209)

* Update dependencies from https://github.com/dotnet/arcade build 20190711.7 (dotnet#7216)

- Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19361.7

* Update dependencies from https://github.com/dotnet/arcade build 20190712.5

- Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19362.5

* Fix Supplementary Character / Surrogate Pair info (no code changes) (dotnet#7221)

Terminology and info regarding Supplementary Characters / Surrogate Pairs is either incorrect, or at least incomplete (which then leads to incorrect statements and/or code).

1. Introduce the term "Supplementary Character" since that is often what we are dealing with, not "surrogate pairs" since that is an encoding-specific concept (UTF-16 only).

2. Add comment re: Supplementary Character code point range, which helps to explain the `elif high > 0x10 then Invalid` condition (line 173).

3. Fix URI for Unicode Standard PDF, Chapter 3, and specify the name of the section (i.e. "Surrogates") instead of the section number (i.e. 3.8) since the section number was 3.7 but is now 3.8 (line 174).

4. Add comment for definition of a valid "surrogate pair" because why make the reader guess or have to go look it up when it will never change? (line 175)

5. Correct and expand comment with example long Unicode escape sequence (line 64): `"\UDEADBEEF"` is _not_ a valid escape sequence. Usage of the `\U` escape has been misstated from the very beginning, both in this documentation as well as the C# Specification documentation, and the language references for "String" for both F# and C#:
    1. `\U` is used to specify a Unicode code point (or UTF-32 code unit, which maps 1:1 with all Unicode code points, hence they are synonymous), not surrogate pairs. Hence the valid range is `00000000` - `0010FFFF`, hence the first two digits are static `0`s, and the third digit can only ever be a `0` or `1`. This escape sequence can specify either a BMP character or a Supplementary character. Supplementary characters are then encoded as a surrogate pair in UTF-16 only, not in UTF-8 or UTF-32. If you want to specify an actual surrogate pair, then use the `\u` escape, e.g. `\uD83D\uDC7D` == `\U0001F47D`.
    2. Even if you could specify a surrogate pair using `\U`, "DEADBEEF" is not valid. U+DEAD is a valid surrogate, _but_ it's a low surrogate code point and cannot be specified first in the pair (meaning, at best one could use `\UxxxxDEAD`). Also, U+BEEF is _not_ a valid surrogate code point, high or low. Surrogate code points are in the range of U+D800 to U+DFFF.

For more info, please see:

https://sqlquantumleap.com/2019/06/26/unicode-escape-sequences-across-various-languages-and-platforms-including-supplementary-characters/#fsharp

* Update IlxGen.fs (dotnet#7227)

* Check for exit code in compiler tests (dotnet#7211)

* Moving AccessOfTypeAbbreviationTests over to NUnit (dotnet#7226)

* Moving AccessOfTypeAbbreviationTests over to NUnit

* ha! now I know what this `1` means =)

* Error range updated and removed `exit 0`

* Error message prefixed by "This construct is deprecated."

* Error messages changed based on current state of FSI

* Moving ConstructorTests over to NUnit (dotnet#7236)

* [master] Update dependencies from dotnet/arcade (dotnet#7233)

* Update dependencies from https://github.com/dotnet/arcade build 20190713.1

- Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19363.1

* Update dependencies from https://github.com/dotnet/arcade build 20190714.1

- Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19364.1

* Update dependencies from https://github.com/dotnet/arcade build 20190715.4 (dotnet#7240)

- Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19365.4

* Moving UpcastDowncastTests over to NUnit (dotnet#7229)

* Moving UpcastDowncastTests over to NUnit

* missing new line

* Update dependencies from https://github.com/dotnet/arcade build 20190716.4 (dotnet#7245)

- Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19366.4

* Move ErrorMessages/NameResolution Tests to NUnit (dotnet#7237)

* Mark name resoltion error message tests for port to NUnit

* Add Nunit tests for FieldNotInRecord, RecordFieldProposal, and GlobalQualifierAfterDot

* Fix expected error message in FieldNotInRecord Compiler test

* Change global Qualifier after dot test back to original fsharpqa version.
Needs seperate assert function for parsing errors instead of typechecking

* Remove unnecessary double ticks from NameResolution tests

* Moving WarnExpressionTests over to NUnit (dotnet#7232)

* move some error and warning tests to NUnit (dotnet#7244)

* move some error and warning tests to NUnit

* CompilerAssert.ParseWithErrors now uses ParseFile instead of ParseAndCheckFileInProject

* merge conflicts

* Update dependencies from https://github.com/dotnet/arcade build 20190717.8

- Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19367.8

* Move UnitGenericAbstractType To Nunit (dotnet#7257)

* Update dependencies from https://github.com/dotnet/arcade build 20190718.7 (dotnet#7256)

- Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19368.7

* Moving TypeMismatchTests over to NUnit (dotnet#7250)

* Moving TypeMismatchTests over to NUnit

* ci restart

* publish pdbs in FSharp.Core.nupkg (dotnet#7255)

Also publish native symbols so they can be archived later.

* Enable hash algorithm selection (dotnet#7252)

* Enable hash algorithm selection

* Feedback

* More feedback

* Revert "Feedback"

This reverts commit 6ab1b07.

* feedback

* Update dependencies from https://github.com/dotnet/arcade build 20190719.2 (dotnet#7260)

- Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19369.2

* Improve netcore reference selection (dotnet#7263)

* Improve netcore reference selection

* Update baselines

* Moving Libraries Control tests to NUnit (dotnet#7234)

* Moving Libraries Control tests to NUnit

* Names tests as Async instead of Control

* Member constraints and PrimitiveConstraints (dotnet#7210)

* Update dependencies from https://github.com/dotnet/arcade build 20190722.10 (dotnet#7268)

- Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19372.10

* fixes issue dotnet#6832 (dotnet#7259)

* fixes issue dotnet#6832

* Fix comment

* Forgot to remove pdbs from fsharp.compiler.nuget

* Rename Program.fs and exclude FSharpSdk from checks

* Embedded doesn't need to verify tmp or obj directories.

* typo

* typo

* Don't check FSharpSdk for hash

* Make comment match code

* Empty commit to force rebuild

* Color nameof as intrinsic (dotnet#7273)

* [master] Update dependencies from dotnet/arcade (dotnet#7269)

* Update dependencies from https://github.com/dotnet/arcade build 20190723.6

- Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19373.6

* Update dependencies from https://github.com/dotnet/arcade build 20190724.2

- Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19374.2

* Update dependencies from https://github.com/dotnet/arcade build 20190725.2

- Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19375.2

* Update dependencies from https://github.com/dotnet/arcade build 20190725.15 (dotnet#7282)

- Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19375.15

* Fix test assert (dotnet#7283)

* disablewarningtests

* code cleanup prior to optional interop improvements (dotnet#7276)

* add test cases we need to make work

* cleanup method call argument processing

* Update dependencies from https://github.com/dotnet/arcade build 20190726.18 (dotnet#7285)

- Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19376.18

* Moving ClassesTests over to NUnit (dotnet#7264)

* Moving ClassesTests over to NUnit

* Fixed assertion for ParseWithErrors test

* Move Basic Constants to NUnit (dotnet#7262)

* Move BasicConstants.fs Tests To Nunit

* fix typo

* Another typo

* Moved  Don't Suggest Tests over to NUnit (dotnet#7288)

* [master] Update dependencies from dotnet/arcade (dotnet#7287)

* Update dependencies from https://github.com/dotnet/arcade build 20190727.2

- Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19377.2

* Update dependencies from https://github.com/dotnet/arcade build 20190728.1

- Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19378.1

* Fix langversion with multiple projects (dotnet#7293)

* Resolve merge issues, and take care of Test Framework incompatabilities

* Tweak tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants