Skip to content

Commit e1d447b

Browse files
authored
Merge pull request #18470 from dotnet/merge/main-to-release/dev18.0
[automated] Merge branch 'main' => 'release/dev18.0'
2 parents ba3700e + f21ea05 commit e1d447b

File tree

12 files changed

+110
-38
lines changed

12 files changed

+110
-38
lines changed

DEVGUIDE.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,15 @@ For example:
252252
module TimeCritical =
253253
```
254254

255+
For stress testing async code you can use a custom `FSharp.Test.StressAttribute`.
256+
For example, applied to a single xUnit test case:
257+
```fsharp
258+
[<Theory; Stress(Count = 1000)>]
259+
```
260+
it will start it many times at the same time, and execute in parallel.
261+
262+
263+
255264

256265
### Updating FCS surface area baselines
257266

NuGet.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<clear />
99
<!--Begin: Package sources managed by Dependency Flow automation. Do not edit the sources below.-->
1010
<!-- Begin: Package sources from DotNet-msbuild-Trusted -->
11-
<add key="darc-pub-DotNet-msbuild-Trusted-8e42d4a" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/darc-pub-DotNet-msbuild-Trusted-8e42d4a4/nuget/v3/index.json" />
11+
<add key="darc-pub-DotNet-msbuild-Trusted-7a09d5e" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/darc-pub-DotNet-msbuild-Trusted-7a09d5ee/nuget/v3/index.json" />
1212
<!-- End: Package sources from DotNet-msbuild-Trusted -->
1313
<!--End: Package sources managed by Dependency Flow automation. Do not edit the sources above.-->
1414
<add key="dotnet-eng" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json" />

eng/Build.ps1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,8 @@ try {
615615

616616
if ($testDesktop -and $ci) {
617617
$bgJob = TestUsingMSBuild -testProject "$RepoRoot\tests\fsharp\FSharpSuite.Tests.fsproj" -targetFramework $script:desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharpSuite.Tests\" -asBackgroundJob $true
618-
618+
619+
TestUsingMSBuild -testProject "$RepoRoot\tests\FSharp.Test.Utilities\FSharp.Test.Utilities.fsproj" -targetFramework $script:desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Test.Utilities\"
619620
TestUsingMSBuild -testProject "$RepoRoot\tests\FSharp.Compiler.ComponentTests\FSharp.Compiler.ComponentTests.fsproj" -targetFramework $script:desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.ComponentTests\"
620621
TestUsingMSBuild -testProject "$RepoRoot\tests\FSharp.Compiler.Service.Tests\FSharp.Compiler.Service.Tests.fsproj" -targetFramework $script:desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.Service.Tests\"
621622
TestUsingMSBuild -testProject "$RepoRoot\tests\FSharp.Compiler.Private.Scripting.UnitTests\FSharp.Compiler.Private.Scripting.UnitTests.fsproj" -targetFramework $script:desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.Private.Scripting.UnitTests\"

eng/Version.Details.xml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,32 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Dependencies>
33
<ProductDependencies>
4-
<Dependency Name="Microsoft.SourceBuild.Intermediate.source-build-reference-packages" Version="9.0.0-alpha.1.25204.3">
4+
<Dependency Name="Microsoft.SourceBuild.Intermediate.source-build-reference-packages" Version="9.0.0-alpha.1.25209.1">
55
<Uri>https://github.com/dotnet/source-build-reference-packages</Uri>
6-
<Sha>643689c88b1d5a0f1561383972c4189a0c673abe</Sha>
6+
<Sha>7dbf5deea5bdccf513df73cba179c4c0ad106010</Sha>
77
<SourceBuild RepoName="source-build-reference-packages" ManagedOnly="true" />
88
</Dependency>
99
<!-- Intermediate is necessary for source build. -->
10-
<Dependency Name="Microsoft.SourceBuild.Intermediate.msbuild" Version="17.13.23-preview-25208-06">
10+
<Dependency Name="Microsoft.SourceBuild.Intermediate.msbuild" Version="17.13.24-preview-25209-01">
1111
<Uri>https://github.com/dotnet/msbuild</Uri>
12-
<Sha>8e42d4a440e0f85c1e8dce43767e7a50d86aa8ff</Sha>
12+
<Sha>7a09d5ee44eb217e9c1ae0bab242c79c70423577</Sha>
1313
<SourceBuild RepoName="msbuild" ManagedOnly="true" />
1414
</Dependency>
15-
<Dependency Name="Microsoft.Build" Version="17.13.23">
15+
<Dependency Name="Microsoft.Build" Version="17.13.24">
1616
<Uri>https://github.com/dotnet/msbuild</Uri>
17-
<Sha>8e42d4a440e0f85c1e8dce43767e7a50d86aa8ff</Sha>
17+
<Sha>7a09d5ee44eb217e9c1ae0bab242c79c70423577</Sha>
1818
</Dependency>
19-
<Dependency Name="Microsoft.Build.Framework" Version="17.13.23">
19+
<Dependency Name="Microsoft.Build.Framework" Version="17.13.24">
2020
<Uri>https://github.com/dotnet/msbuild</Uri>
21-
<Sha>8e42d4a440e0f85c1e8dce43767e7a50d86aa8ff</Sha>
21+
<Sha>7a09d5ee44eb217e9c1ae0bab242c79c70423577</Sha>
2222
</Dependency>
23-
<Dependency Name="Microsoft.Build.Tasks.Core" Version="17.13.23">
23+
<Dependency Name="Microsoft.Build.Tasks.Core" Version="17.13.24">
2424
<Uri>https://github.com/dotnet/msbuild</Uri>
25-
<Sha>8e42d4a440e0f85c1e8dce43767e7a50d86aa8ff</Sha>
25+
<Sha>7a09d5ee44eb217e9c1ae0bab242c79c70423577</Sha>
2626
</Dependency>
27-
<Dependency Name="Microsoft.Build.Utilities.Core" Version="17.13.23">
27+
<Dependency Name="Microsoft.Build.Utilities.Core" Version="17.13.24">
2828
<Uri>https://github.com/dotnet/msbuild</Uri>
29-
<Sha>8e42d4a440e0f85c1e8dce43767e7a50d86aa8ff</Sha>
29+
<Sha>7a09d5ee44eb217e9c1ae0bab242c79c70423577</Sha>
3030
</Dependency>
3131
<Dependency Name="System.Reflection.Metadata" Version="8.0.0">
3232
<Uri>https://github.com/dotnet/runtime</Uri>

eng/Versions.props

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@
102102
<MicrosoftVisualStudioShellPackagesVersion>17.10.40152</MicrosoftVisualStudioShellPackagesVersion>
103103
<VisualStudioProjectSystemPackagesVersion>17.10.526-pre-g1b474069f5</VisualStudioProjectSystemPackagesVersion>
104104
<MicrosoftVisualStudioThreadingPackagesVersion>17.10.41</MicrosoftVisualStudioThreadingPackagesVersion>
105-
<MicrosoftBuildVersion>17.13.23</MicrosoftBuildVersion>
105+
<MicrosoftBuildVersion>17.13.24</MicrosoftBuildVersion>
106106
<!-- Roslyn packages -->
107107
<MicrosoftCodeAnalysisEditorFeaturesVersion>$(RoslynVersion)</MicrosoftCodeAnalysisEditorFeaturesVersion>
108108
<MicrosoftCodeAnalysisEditorFeaturesTextVersion>$(RoslynVersion)</MicrosoftCodeAnalysisEditorFeaturesTextVersion>
@@ -138,9 +138,9 @@
138138
<MicrosoftVisualStudioShellImmutable150Version>15.0.25123-Dev15Preview</MicrosoftVisualStudioShellImmutable150Version>
139139
<!-- -->
140140
<!-- Microsoft Build packages -->
141-
<MicrosoftBuildFrameworkVersion>17.13.23</MicrosoftBuildFrameworkVersion>
142-
<MicrosoftBuildTasksCoreVersion>17.13.23</MicrosoftBuildTasksCoreVersion>
143-
<MicrosoftBuildUtilitiesCoreVersion>17.13.23</MicrosoftBuildUtilitiesCoreVersion>
141+
<MicrosoftBuildFrameworkVersion>17.13.24</MicrosoftBuildFrameworkVersion>
142+
<MicrosoftBuildTasksCoreVersion>17.13.24</MicrosoftBuildTasksCoreVersion>
143+
<MicrosoftBuildUtilitiesCoreVersion>17.13.24</MicrosoftBuildUtilitiesCoreVersion>
144144
<!-- -->
145145
<!-- Visual Studio Editor packages -->
146146
<MicrosoftVisualStudioCoreUtilityVersion>$(VisualStudioEditorPackagesVersion)</MicrosoftVisualStudioCoreUtilityVersion>

eng/build.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,7 @@ BuildSolution
331331

332332
if [[ "$test_core_clr" == true ]]; then
333333
coreclrtestframework=$tfm
334+
Test --testproject "$repo_root/tests/FSharp.Test.Utilities/FSharp.Test.Utilities.fsproj" --targetframework $coreclrtestframework
334335
Test --testproject "$repo_root/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj" --targetframework $coreclrtestframework
335336
Test --testproject "$repo_root/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.Tests.fsproj" --targetframework $coreclrtestframework
336337
Test --testproject "$repo_root/tests/FSharp.Compiler.Private.Scripting.UnitTests/FSharp.Compiler.Private.Scripting.UnitTests.fsproj" --targetframework $coreclrtestframework

src/Compiler/TypedTree/TypedTreePickle.fs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,14 @@ type NodeOutTable<'Data, 'Node> =
135135
Table = Table<_>.Create nm
136136
}
137137

138+
// Small glossary for future generations:
139+
// o... - output
140+
// i... - input
141+
// os - output stream
142+
// is - input stream
143+
// tab - table
144+
// osgn - output stream graph nodes
145+
138146
[<NoEquality; NoComparison>]
139147
type WriterState =
140148
{
@@ -1937,7 +1945,7 @@ let u_tcref st =
19371945
match tag with
19381946
| 0 -> u_local_item_ref st.ientities st |> ERefLocal
19391947
| 1 -> u_nleref st |> ERefNonLocal
1940-
| _ -> ufailwith st "u_item_ref"
1948+
| _ -> ufailwith st "u_tcref"
19411949

19421950
let u_ucref st =
19431951
let a, b = u_tup2 u_tcref u_string st
@@ -2027,7 +2035,7 @@ let u_vref st =
20272035
match tag with
20282036
| 0 -> u_local_item_ref st.ivals st |> VRefLocal
20292037
| 1 -> u_nonlocal_val_ref st |> VRefNonLocal
2030-
| _ -> ufailwith st "u_item_ref"
2038+
| _ -> ufailwith st "u_vref"
20312039

20322040
let u_vrefs = u_list u_vref
20332041

@@ -3206,7 +3214,7 @@ and u_parentref st =
32063214
match tag with
32073215
| 0 -> ParentNone
32083216
| 1 -> u_tcref st |> Parent
3209-
| _ -> ufailwith st "u_attribkind"
3217+
| _ -> ufailwith st "u_parentref"
32103218

32113219
and u_attribkind st =
32123220
let tag = u_byte st
@@ -3496,7 +3504,7 @@ and u_lval_op_kind st =
34963504
| 1 -> LByrefGet
34973505
| 2 -> LSet
34983506
| 3 -> LByrefSet
3499-
| _ -> ufailwith st "uval_op_kind"
3507+
| _ -> ufailwith st "ulval_op_kind"
35003508

35013509
and p_op x st =
35023510
match x with

tests/FSharp.Compiler.ComponentTests/CompilerService/AsyncMemoize.fs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -422,18 +422,19 @@ let ``Cancel running jobs with the same key`` () =
422422
// detach requests from their running computations
423423
cts.Cancel()
424424

425+
// Cancel the Get requests, leaving the jobs running unawaited.
425426
for job in jobsToCancel do assertTaskCanceled job
426427

428+
// Start another request.
427429
let job = cache.Get(key 11, work) |> Async.StartAsTask
428430

429431
// up til now the jobs should have been running unobserved
430432
let current = eventsWhen events (received Requested)
431433
Assert.Equal(0, current |> countOf Canceled)
432434

433-
// waitUntil events (countOf Canceled >> (=) 10)
434-
435-
waitUntil events (received Started)
435+
waitUntil events (countOf Started >> (=) 11)
436436

437+
// Allow the single current request to finish.
437438
jobCanContinue.Set() |> ignore
438439

439440
job.Wait()

tests/FSharp.Test.Utilities/FSharp.Test.Utilities.fsproj

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
1111
<Optimize>false</Optimize>
1212
<Tailcalls>false</Tailcalls>
13-
<IsTestProject>false</IsTestProject>
13+
<UnitTestType>xunit</UnitTestType>
14+
<IsTestProject>true</IsTestProject>
1415
<OtherFlags>$(OtherFlags) --warnon:1182 --realsig-</OtherFlags>
1516
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
1617
<!--Extra xUnit customizations, not required for the test suite to work, but can speed up local test runs and help with debugging.-->
@@ -23,10 +24,9 @@
2324
</PropertyGroup>
2425

2526
<ItemGroup>
26-
<ProjectCapability Remove="TestContainer" />
27-
</ItemGroup>
28-
29-
<ItemGroup>
27+
<Content Include="xunit.runner.json">
28+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
29+
</Content>
3030
<Compile Include="..\scripts\scriptlib.fsx">
3131
<Link>scriptlib.fsx</Link>
3232
</Compile>
@@ -46,11 +46,10 @@
4646
<Compile Include="ReflectionHelper.fs" />
4747
<Compile Include="SurfaceArea.fs" />
4848
<Compile Include="XunitHelpers.fs" />
49+
<Compile Include="XunitSetup.fs" />
50+
<Compile Include="Tests.fs" />
4951
</ItemGroup>
5052

51-
<ItemGroup>
52-
<None Include="XunitSetup.fs" />
53-
</ItemGroup>
5453

5554
<ItemGroup>
5655
<ProjectReference Include="$(FSharpSourcesRoot)\Compiler\FSharp.Compiler.Service.fsproj" />
@@ -70,11 +69,6 @@
7069
<ProjectReference Include="$(FSharpSourcesRoot)\FSharp.Build\FSharp.Build.fsproj" />
7170
</ItemGroup>
7271

73-
74-
<ItemGroup>
75-
<PackageReference Include="xunit" Version="$(XUnitVersion)" />
76-
</ItemGroup>
77-
7872
<!-- Runtime dependencies. Beware. -->
7973
<ItemGroup>
8074
<PackageReference Include="Microsoft.NETCore.ILDAsm" Version="$(MicrosoftNETCoreILDAsmVersion)" />
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
module FSharp.Test.UtilitiesTests
2+
3+
open System
4+
open System.Threading
5+
open Xunit
6+
open FSharp.Test
7+
8+
type RunOrFail(name) =
9+
let mutable count = 0
10+
member _.Run(shouldFail: bool) =
11+
let count = Interlocked.Increment &count
12+
if shouldFail && count = 42 then
13+
failwith $"{name}, failed as expected on {count}"
14+
else
15+
printfn $"{name}, iteration {count} passed"
16+
count
17+
18+
let passing = RunOrFail "Passing"
19+
let failing = RunOrFail "Failing"
20+
21+
[<Theory(Skip = "Explicit, unskip to run"); Stress(true, Count = 50)>]
22+
let ``Stress attribute should catch intermittent failure`` shouldFail _ =
23+
failing.Run shouldFail
24+
25+
[<Theory; Stress(Count = 5)>]
26+
let ``Stress attribute works`` _ =
27+
passing.Run false
28+
29+
[<Fact>]
30+
let ``TestConsole captures output`` () =
31+
let rnd = Random()
32+
let task n =
33+
async {
34+
use console = new TestConsole.ExecutionCapture()
35+
do! Async.Sleep (rnd.Next 50)
36+
printf $"Hello, world! {n}"
37+
do! Async.Sleep (rnd.Next 50)
38+
eprintf $"Some error {n}"
39+
return console.OutText, console.ErrorText
40+
}
41+
42+
let expected = [ for n in 0 .. 9 -> $"Hello, world! {n}", $"Some error {n}" ]
43+
44+
let results = Seq.init 10 task |> Async.Parallel |> Async.RunSynchronously
45+
Assert.Equal(expected, results)

0 commit comments

Comments
 (0)