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

Experiment, parallelize some tests #17662

Closed
wants to merge 237 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
237 commits
Select commit Hold shift + click to select a range
4471183
fix compile
majocha Sep 4, 2024
932d12c
threadlocal console splitter
majocha Sep 5, 2024
1c945b5
Merge branch 'main' into parallelize-tests
majocha Sep 5, 2024
8ff95d4
fix
majocha Sep 5, 2024
003399a
just to be sure
majocha Sep 5, 2024
219b1de
fix
majocha Sep 5, 2024
c2ec08b
fix failing
majocha Sep 5, 2024
1700504
gaah
majocha Sep 5, 2024
7501dc3
wip
majocha Sep 5, 2024
7f9798f
wip
majocha Sep 5, 2024
c6ab38d
unused?
majocha Sep 5, 2024
4e9e461
wip
majocha Sep 6, 2024
249b1cf
Merge branch 'main' into parallelize-tests
majocha Sep 6, 2024
ef14588
maybe?
majocha Sep 6, 2024
87ad15c
deny appdomain, tests should be isolated already?
majocha Sep 6, 2024
3d32f29
give it some more time
majocha Sep 6, 2024
e8e8413
try to fix some more tests
majocha Sep 7, 2024
67ef5f5
core mailbox > tasks
majocha Sep 7, 2024
6af4cc6
try fix tests
majocha Sep 7, 2024
0980059
mbox,
majocha Sep 7, 2024
5566d20
inc timeout
majocha Sep 7, 2024
3484eb6
fix
majocha Sep 7, 2024
e438909
omg
majocha Sep 7, 2024
57af1fc
unique prj names
majocha Sep 8, 2024
00e5a8c
skip times test for now
majocha Sep 8, 2024
1d42877
break into smaller modules
majocha Sep 8, 2024
a7057e6
Merge branch 'main' into parallelize-tests
majocha Sep 8, 2024
0508ee3
don't check for "test.ok" file existence for now
majocha Sep 8, 2024
54c0d73
run suite tests in separate temp dirs, run typeprovider tests concurr…
majocha Sep 9, 2024
f1fe29f
merge main
majocha Sep 9, 2024
0fee2b9
Merge branch 'main' into parallelize-tests
majocha Sep 9, 2024
e185fb2
skip sdktest for later, fix some
majocha Sep 9, 2024
f9119a9
Merge branch 'main' into parallelize-tests
majocha Sep 9, 2024
06164d8
fix again
majocha Sep 9, 2024
99b5834
Merge branch 'main' into parallelize-tests
vzarytovskii Sep 9, 2024
317e63b
run tests in temp dirs
majocha Sep 10, 2024
177c978
rename
majocha Sep 10, 2024
f528a3d
update comment
majocha Sep 10, 2024
74dd7a7
Merge branch 'main' into test-temp-folders
majocha Sep 10, 2024
1457693
diff
majocha Sep 10, 2024
62f5a4a
use single temp dir for compile
majocha Sep 10, 2024
dfb9dcc
unskip sdktest, naming
majocha Sep 10, 2024
d5c8225
Merge branch 'main' into test-temp-folders
majocha Sep 10, 2024
66f872c
refactor
majocha Sep 10, 2024
ee9cd17
parametrize msbuild in SDKTests
majocha Sep 10, 2024
5b7ceca
Merge branch 'main' into test-temp-folders
majocha Sep 10, 2024
75fffe0
nicer
majocha Sep 10, 2024
128b54b
Merge branch 'main' into parallelize-tests
majocha Sep 10, 2024
b179542
merge test-temp-folders
majocha Sep 10, 2024
46f4b9f
redirect console in FSharpScript
majocha Sep 11, 2024
c4f266a
does this test even do what it advertises?
majocha Sep 11, 2024
933304a
Merge branch 'main' into parallelize-tests
majocha Sep 11, 2024
b1856d6
fix FSharpScript redirection
majocha Sep 11, 2024
4fda023
reusing fsi sessions
majocha Sep 11, 2024
82097c9
exclude depenencymanager
majocha Sep 11, 2024
fe07d6e
Merge branch 'main' into parallelize-tests
majocha Sep 11, 2024
5401109
exclude more
majocha Sep 11, 2024
1710554
exclude CancelDefaultToken
majocha Sep 12, 2024
594c0e4
refactor ScriptHelpers
majocha Sep 12, 2024
c7adebd
remove xunit defaults from xunit.runner.json
majocha Sep 12, 2024
5c4243c
try to further deal with OperationCancelled
majocha Sep 12, 2024
6345fa8
Remove redundant "ok" files in core tests
psfinaki Sep 12, 2024
93aeccb
remove this also
psfinaki Sep 12, 2024
9bd9127
skip shady test
majocha Sep 12, 2024
f5c04f2
Merge branch 'main' into parallelize-tests
majocha Sep 12, 2024
a5ddb60
parametrize ML scripts
majocha Sep 12, 2024
9e20af8
Merge branch 'main' into parallelize-tests
majocha Sep 12, 2024
bc80641
fsi pdb symbols directory per session
majocha Sep 12, 2024
278155e
unblock InteractiveTests
majocha Sep 12, 2024
8f6f351
fantomas
majocha Sep 13, 2024
7c5d38a
try to reduce memory pressure in ci
majocha Sep 13, 2024
3d8807e
fix op cancelled exn in core.unittests
majocha Sep 13, 2024
3b7b9b9
Merge branch 'main' into parallelize-tests
majocha Sep 13, 2024
e1cef65
simplify
majocha Sep 13, 2024
81cf0fc
not needed
majocha Sep 13, 2024
5e7e1e8
try to deal with oom
majocha Sep 13, 2024
ce975d2
improve some task tests
majocha Sep 13, 2024
4f6bf47
fixit
majocha Sep 13, 2024
581b628
merge oknotok
majocha Sep 13, 2024
f02bd73
Merge branch 'main' into parallelize-tests
majocha Sep 13, 2024
cd6a7ef
one thread for now
majocha Sep 13, 2024
e5e01c9
dummy rns
majocha Sep 14, 2024
976d0b1
remove AlreadyLoadedAppDomainResolver
majocha Sep 14, 2024
b847f01
some tests mutate FileSystem (!)
majocha Sep 14, 2024
0e22b65
step up parallelism
majocha Sep 14, 2024
2d90586
redirect logging to MessageSink, refactor
majocha Sep 14, 2024
a7143af
Merge branch 'main' into parallelize-tests
majocha Sep 16, 2024
0b70050
actually, don't write to testframework sink, as it all becomes warnings
majocha Sep 16, 2024
3dae769
improve flakiness situation
majocha Sep 16, 2024
b6423af
Merge branch 'main' into parallelize-tests
majocha Sep 16, 2024
64cca70
default maxthreads
majocha Sep 16, 2024
329cff1
tests again
majocha Sep 16, 2024
06c57c8
Merge branch 'main' into parallelize-tests
majocha Sep 17, 2024
75da7ba
iensure context init with BeforeAfter
majocha Sep 17, 2024
d86d315
sort out collection definitions
majocha Sep 17, 2024
bb407bd
try to run the whole solution
majocha Sep 17, 2024
3e24367
wip
majocha Sep 17, 2024
179786e
restore build.ps1
majocha Sep 17, 2024
3f456b9
exclude this
majocha Sep 17, 2024
2ca5cf5
do not modify stdout
majocha Sep 17, 2024
5cb5c5a
runner again
majocha Sep 17, 2024
a4ff92c
temp disable useTransparentCompiler for global checker
majocha Sep 17, 2024
eaaff9d
fix build
majocha Sep 17, 2024
57db5c8
this is not needed any more
majocha Sep 18, 2024
7bd3aad
refactoring
majocha Sep 18, 2024
db0858e
clean-up
majocha Sep 18, 2024
9665470
preserve original encoding
majocha Sep 18, 2024
b18ad46
Merge branch 'main' into fsc-stdout
majocha Sep 18, 2024
12147df
Merge branch 'main' into parallelize-tests
majocha Sep 18, 2024
ca97cd3
Revert "remove this also"
majocha Sep 18, 2024
25e0f8e
revert oknotok
majocha Sep 18, 2024
fd53253
use stdout instead of test.ok file, wip
majocha Sep 18, 2024
6a5571c
wip
majocha Sep 19, 2024
04e0054
wip
majocha Sep 19, 2024
523ff71
fixfix
majocha Sep 19, 2024
51b2a13
disable parallelization in ci
majocha Sep 19, 2024
6b26789
ah yes
majocha Sep 19, 2024
c5e8d55
or is it like this?
majocha Sep 19, 2024
0249595
unskip
majocha Sep 19, 2024
b3e2f2c
fix
majocha Sep 19, 2024
18be588
clean up
majocha Sep 19, 2024
3cc25cf
DirectoryAttribute temp output dir
majocha Sep 19, 2024
4407cce
restore transparent compiler use
majocha Sep 19, 2024
8fe73de
don't reuse checker
majocha Sep 19, 2024
a86abd1
exclude after all
majocha Sep 19, 2024
ad9ed63
missed
majocha Sep 19, 2024
27d0b13
rn
majocha Sep 19, 2024
00239f8
deal with OpCancelledExn in component tests
majocha Sep 20, 2024
a8bb384
deal with OpCancelledExn in core unittests
majocha Sep 20, 2024
92e0ec3
do flush actual Console synchronized streams
majocha Sep 20, 2024
492d831
MaxParallelThreads=1 in ci
majocha Sep 20, 2024
693b5d7
Revert "preserve original encoding"
majocha Sep 20, 2024
acdea50
add a test
majocha Sep 20, 2024
a5437f5
wip
majocha Sep 20, 2024
bcffaef
fantomas
majocha Sep 20, 2024
88b2a18
add fsi test
majocha Sep 20, 2024
f076559
put collection definitions into each assembly separately
majocha Sep 20, 2024
419cd8f
concurrency issue
majocha Sep 20, 2024
ac7e5ac
to see if it works
majocha Sep 21, 2024
4177685
wip
majocha Sep 21, 2024
1a74c46
fix test
majocha Sep 21, 2024
1936e63
fix skip
majocha Sep 21, 2024
d338a56
don't call dep manager needlessly
majocha Sep 21, 2024
6cbbbf4
exclude core/controlMailbox
majocha Sep 21, 2024
cd0f578
FsiTests
majocha Sep 22, 2024
e8992ef
cleanup
majocha Sep 22, 2024
7743378
try to fix depman test
majocha Sep 22, 2024
430b0aa
log only in debug
majocha Sep 22, 2024
dea2b68
back to business
majocha Sep 22, 2024
fa2872c
sigh
majocha Sep 22, 2024
33b4aa6
restore
majocha Sep 22, 2024
eba1a25
restore
majocha Sep 22, 2024
e459c90
deparallelize linux ci also
majocha Sep 23, 2024
45fa650
xunit logger
majocha Sep 23, 2024
235cc05
what's up with fparsec test?
majocha Sep 23, 2024
5e98984
exempt utilities from dotnet test detection
majocha Sep 23, 2024
260d56e
skip fparsec test on dektop
majocha Sep 23, 2024
22d2cdd
update test result format to xunit
majocha Sep 23, 2024
ad79741
wip
majocha Sep 23, 2024
b19b919
Merge branch 'main' into parallelize-tests
majocha Sep 23, 2024
9806a86
just trying things out
majocha Sep 23, 2024
1ebbbc5
Merge branch 'parallelize-tests' of https://github.com/majocha/fsharp…
majocha Sep 23, 2024
9851e4c
Merge branch 'main' into fsc-stdout
majocha Sep 23, 2024
f9a0ad0
named test runs
majocha Sep 23, 2024
671ed78
capture xml logs from assemblies
majocha Sep 23, 2024
ce391ea
wip
majocha Sep 23, 2024
ae883a9
Merge branch 'main' into parallelize-tests
majocha Sep 23, 2024
914086c
remove dup
majocha Sep 23, 2024
1981299
Merge branch 'parallelize-tests' of https://github.com/majocha/fsharp…
majocha Sep 23, 2024
02ce51a
Merge branch 'main' into fsc-stdout
majocha Sep 23, 2024
358e743
Merge branch 'main' into parallelize-tests
majocha Sep 24, 2024
e338476
Merge branch 'main' into parallelize-tests
majocha Sep 25, 2024
71c3437
Merge branch 'main' into fsc-stdout
majocha Sep 25, 2024
9de5711
concurrency?
majocha Sep 25, 2024
8fc65b9
Merge branch 'parallelize-tests' of https://github.com/majocha/fsharp…
majocha Sep 25, 2024
5c4efe9
Merge branch 'main' into parallelize-tests
psfinaki Sep 26, 2024
1ad3349
not needed
majocha Sep 26, 2024
044396a
--blame-hang-timeout to see what's going on
majocha Sep 26, 2024
496973f
Merge branch 'main' into parallelize-tests
majocha Sep 26, 2024
7ffa352
quick experiment
majocha Sep 26, 2024
e3c95c9
Merge branch 'main' into parallelize-tests
majocha Sep 26, 2024
9d66464
Merge branch 'main' into parallelize-tests
majocha Sep 27, 2024
6695851
-v n
majocha Sep 27, 2024
cc1f24e
.
majocha Sep 27, 2024
b7808ba
simplify
majocha Sep 28, 2024
70e5f12
Merge branch 'main' into parallelize-tests
majocha Sep 29, 2024
f22e7ef
Merge branch 'main' into fsc-stdout
T-Gro Sep 30, 2024
41476a9
Merge branch 'main' into parallelize-tests
majocha Sep 30, 2024
bfabd4b
setup, delete temp folder
majocha Sep 30, 2024
1bdcd87
fix AsyncType
majocha Sep 30, 2024
7191a17
unskip times csv
majocha Sep 30, 2024
4d9805e
Merge branch 'main' into fsc-stdout
majocha Sep 30, 2024
d9cc66e
Merge branch 'main' into parallelize-tests
majocha Sep 30, 2024
00e6f8b
Merge branch 'main' into fsc-stdout
majocha Oct 1, 2024
9f7bd1a
Merge branch 'main' into parallelize-tests
majocha Oct 1, 2024
f975162
smaller diff
majocha Oct 1, 2024
a5f6e02
fix
majocha Oct 1, 2024
b4176f4
don't leak taskCanceledException
majocha Oct 1, 2024
0323d65
BUILDING_USING_DOTNET
majocha Oct 2, 2024
1ec7718
deps missing yet required at runtime
majocha Oct 2, 2024
d36aa93
bump vstest version
majocha Oct 2, 2024
e9c2cd2
try to fix GC test
majocha Oct 2, 2024
c2f7745
dont leave unobserved background tasks, some speedups
majocha Oct 2, 2024
eeb5029
try fix times csv
majocha Oct 3, 2024
7b95e1d
times csv, shared read
majocha Oct 3, 2024
fc5b9fa
disable transparent compiler for a moment again
majocha Oct 3, 2024
ff67a04
merge main
majocha Oct 3, 2024
7119173
Merge branch 'main' into parallelize-tests
majocha Oct 4, 2024
68304f5
Merge branch 'main' into parallelize-tests
majocha Oct 4, 2024
abf9a63
not needed
majocha Oct 4, 2024
d1a672c
try to improve another test
majocha Oct 4, 2024
0a243ea
unskip some old tests
majocha Oct 4, 2024
eb25ca7
init log
majocha Oct 4, 2024
9fe6f3c
add new rudimentary TryScan tests
majocha Oct 4, 2024
026d1fc
disable old flaky TryScan test
majocha Oct 4, 2024
f50bc4c
tune runner
majocha Oct 4, 2024
3d8d2ac
ease up some exclusions
majocha Oct 4, 2024
20ad10f
tune script test run
majocha Oct 4, 2024
fd76eb2
low mem in ci
majocha Oct 5, 2024
736ffc4
unload appdomain
majocha Oct 5, 2024
6936121
mb
majocha Oct 6, 2024
c632695
cpu limit in ci
majocha Oct 6, 2024
0276755
cpu limit in ci
majocha Oct 6, 2024
5d2ccd6
Merge branch 'main' into fsc-stdout
majocha Oct 6, 2024
f961823
merge fsc-stdout
majocha Oct 6, 2024
e75f796
wip
majocha Oct 6, 2024
f77ec61
wip
majocha Oct 6, 2024
0bee824
wip
majocha Oct 6, 2024
76fc354
wip
majocha Oct 7, 2024
346ddb7
that's a funny thing to time out
majocha Oct 7, 2024
5643336
Merge branch 'main' into parallelize-tests
majocha Oct 7, 2024
ae81bd6
.
majocha Oct 7, 2024
601bf47
Merge branch 'main' into parallelize-tests
majocha Oct 7, 2024
22ee1c6
wip
majocha Oct 8, 2024
635ba14
unskip depman test
majocha Oct 8, 2024
aa570c6
Merge branch 'main' into parallelize-tests
majocha Oct 8, 2024
24b6f00
Merge branch 'main' into parallelize-tests
majocha Oct 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions azure-pipelines-PR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,8 @@ stages:
displayName: Publish Test Results
inputs:
testResultsFormat: 'XUnit'
testRunTitle: WindowsCompressedMetadata $(_testKind)
mergeTestResults: true
testResultsFiles: '*.xml'
searchFolder: '$(Build.SourcesDirectory)/artifacts/TestResults/$(_configuration)'
continueOnError: true
Expand Down Expand Up @@ -558,7 +560,9 @@ stages:
displayName: Publish Test Results
inputs:
testResultsFormat: 'XUnit'
testRunTitle: Linux
testResultsFiles: '*.xml'
mergeTestResults: true
searchFolder: '$(Build.SourcesDirectory)/artifacts/TestResults/$(_BuildConfig)'
continueOnError: true
condition: always()
Expand Down Expand Up @@ -602,6 +606,8 @@ stages:
inputs:
testResultsFormat: 'XUnit'
testResultsFiles: '*.xml'
testRunTitle: MacOS
mergeTestResults: true
searchFolder: '$(Build.SourcesDirectory)/artifacts/TestResults/$(_BuildConfig)'
continueOnError: true
condition: always()
Expand Down
2 changes: 2 additions & 0 deletions docs/release-notes/.FSharp.Compiler.Service/9.0.200.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@
### Changed

* Make ILTypeDef interface impls calculation lazy. ([PR #17392](https://github.com/dotnet/fsharp/pull/17392))
* Adjustments to better run in parallel testing ([PR #17662](https://github.com/dotnet/fsharp/pull/17662))
* Remove non-functional useSyntaxTreeCache option. ([PR #17768](https://github.com/dotnet/fsharp/pull/17768))
* Better ranges for CE `let!` and `use!` error reporting. ([PR #17712](https://github.com/dotnet/fsharp/pull/17712))
* Better ranges for CE `do!` error reporting. ([PR #17779](https://github.com/dotnet/fsharp/pull/17779))
* Better ranges for CE `return, yield, return! and yield!` error reporting. ([PR #17792](https://github.com/dotnet/fsharp/pull/17792))
* Better ranges for CE `match!`. ([PR #17789](https://github.com/dotnet/fsharp/pull/17789))
* Better ranges for CE `use` error reporting. ([PR #17811](https://github.com/dotnet/fsharp/pull/17811))


### Breaking Changes
48 changes: 25 additions & 23 deletions eng/Build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ function TestUsingMSBuild([string] $testProject, [string] $targetFramework, [str
$testLogPath = "$ArtifactsDir\TestResults\$configuration\${projectName}_$targetFramework.xml"
$testBinLogPath = "$LogDir\${projectName}_$targetFramework.binlog"
$args = "test $testProject -c $configuration -f $targetFramework -v n --test-adapter-path $testadapterpath --logger ""xunit;LogFilePath=$testLogPath"" /bl:$testBinLogPath"
$args += " --blame --results-directory $ArtifactsDir\TestResults\$configuration -p:vstestusemsbuildoutput=false"
$args += " --blame --blame-hang-timeout 5minutes --results-directory $ArtifactsDir\TestResults\$configuration -p:vstestusemsbuildoutput=false"

if (-not $noVisualStudio -or $norestore) {
$args += " --no-restore"
Expand All @@ -395,6 +395,28 @@ function TestUsingMSBuild([string] $testProject, [string] $targetFramework, [str
}
}

function TestSolutionUsingMSBuild([string] $testSolution, [string] $targetFramework, [string] $testadapterpath) {
$dotnetPath = InitializeDotNetCli
$dotnetExe = Join-Path $dotnetPath "dotnet.exe"
$solutionName = [System.IO.Path]::GetFileNameWithoutExtension($testSolution)
$testLogPath = "$ArtifactsDir\TestResults\$configuration\{assembly}.{framework}.xml"
$testBinLogPath = "$LogDir\${solutionName}_$targetFramework.binlog"

$args = "test $testSolution -c $configuration -f $targetFramework --test-adapter-path $testadapterpath -v minimal --logger ""xunit;LogFilePath=$testLogPath"" /bl:$testBinLogPath"
$args += " --blame-hang-timeout 5minutes --results-directory $ArtifactsDir\TestResults\$configuration /p:VsTestUseMSBuildOutput=true"

if (-not $noVisualStudio -or $norestore) {
$args += " --no-restore"
}

if (-not $noVisualStudio) {
$args += " --no-build"
}

Write-Host("$args")
Exec-Console $dotnetExe $args
}

function Prepare-TempDir() {
Copy-Item (Join-Path $RepoRoot "tests\Resources\Directory.Build.props") $TempDir
Copy-Item (Join-Path $RepoRoot "tests\Resources\Directory.Build.targets") $TempDir
Expand Down Expand Up @@ -589,31 +611,11 @@ try {
$script:BuildMessage = "Failure running tests"

if ($testCoreClr) {
$bgJob = TestUsingMSBuild -testProject "$RepoRoot\tests\fsharp\FSharpSuite.Tests.fsproj" -targetFramework $script:coreclrTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharpSuite.Tests\" -asBackgroundJob $true

TestUsingMSBuild -testProject "$RepoRoot\tests\FSharp.Compiler.ComponentTests\FSharp.Compiler.ComponentTests.fsproj" -targetFramework $script:coreclrTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.ComponentTests\"
TestUsingMSBuild -testProject "$RepoRoot\tests\FSharp.Compiler.Service.Tests\FSharp.Compiler.Service.Tests.fsproj" -targetFramework $script:coreclrTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.Service.Tests\"
TestUsingMSBuild -testProject "$RepoRoot\tests\FSharp.Compiler.Private.Scripting.UnitTests\FSharp.Compiler.Private.Scripting.UnitTests.fsproj" -targetFramework $script:coreclrTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.Private.Scripting.UnitTests\"
TestUsingMSBuild -testProject "$RepoRoot\tests\FSharp.Build.UnitTests\FSharp.Build.UnitTests.fsproj" -targetFramework $script:coreclrTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Build.UnitTests\"
TestUsingMSBuild -testProject "$RepoRoot\tests\FSharp.Core.UnitTests\FSharp.Core.UnitTests.fsproj" -targetFramework $script:coreclrTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Core.UnitTests\"

# Collect output from background jobs
Wait-job $bgJob | out-null
Receive-Job $bgJob -ErrorAction Stop
TestSolutionUsingMSBuild -testSolution "$RepoRoot\FSharp.sln" -targetFramework $script:coreclrTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.ComponentTests\"
}

if ($testDesktop) {
$bgJob = TestUsingMSBuild -testProject "$RepoRoot\tests\fsharp\FSharpSuite.Tests.fsproj" -targetFramework $script:desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharpSuite.Tests\" -asBackgroundJob $true

TestUsingMSBuild -testProject "$RepoRoot\tests\FSharp.Compiler.ComponentTests\FSharp.Compiler.ComponentTests.fsproj" -targetFramework $script:desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.ComponentTests\"
TestUsingMSBuild -testProject "$RepoRoot\tests\FSharp.Compiler.Service.Tests\FSharp.Compiler.Service.Tests.fsproj" -targetFramework $script:desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.Service.Tests\"
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\"
TestUsingMSBuild -testProject "$RepoRoot\tests\FSharp.Build.UnitTests\FSharp.Build.UnitTests.fsproj" -targetFramework $script:desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Build.UnitTests\"
TestUsingMSBuild -testProject "$RepoRoot\tests\FSharp.Core.UnitTests\FSharp.Core.UnitTests.fsproj" -targetFramework $script:desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Core.UnitTests\"

# Collect output from background jobs
Wait-job $bgJob | out-null
Receive-Job $bgJob -ErrorAction Stop
TestSolutionUsingMSBuild -testSolution "$RepoRoot\FSharp.sln" -targetFramework $script:desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.ComponentTests\"
}

if ($testFSharpQA) {
Expand Down
2 changes: 1 addition & 1 deletion eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@
<MicrosoftNETCoreAppRefVersion>3.1.0</MicrosoftNETCoreAppRefVersion>
<MicrosoftNETCoreILDAsmVersion>5.0.0-preview.7.20364.11</MicrosoftNETCoreILDAsmVersion>
<MicrosoftNETCoreILAsmVersion>5.0.0-preview.7.20364.11</MicrosoftNETCoreILAsmVersion>
<MicrosoftNETTestSdkVersion>17.4.0</MicrosoftNETTestSdkVersion>
<MicrosoftNETTestSdkVersion>17.11.1</MicrosoftNETTestSdkVersion>
<NewtonsoftJsonVersion>13.0.3</NewtonsoftJsonVersion>
<RoslynToolsSignToolVersion>1.0.0-beta2-dev3</RoslynToolsSignToolVersion>
<StreamJsonRpcVersion>2.18.48</StreamJsonRpcVersion>
Expand Down
2 changes: 1 addition & 1 deletion eng/build.sh
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ function Test() {
projectname=$(basename -- "$testproject")
projectname="${projectname%.*}"
testlogpath="$artifacts_dir/TestResults/$configuration/${projectname}_$targetframework.xml"
args="test \"$testproject\" --no-restore --no-build -c $configuration -f $targetframework --test-adapter-path . --logger \"xunit;LogFilePath=$testlogpath\" --blame --results-directory $artifacts_dir/TestResults/$configuration -p:vstestusemsbuildoutput=false"
args="test \"$testproject\" --no-restore --no-build -c $configuration -f $targetframework --test-adapter-path . --logger \"xunit;LogFilePath=$testlogpath\" --blame-hang-timeout 5minutes --results-directory $artifacts_dir/TestResults/$configuration -p:vstestusemsbuildoutput=false"
"$DOTNET_INSTALL_DIR/dotnet" $args || exit $?
}

Expand Down
24 changes: 11 additions & 13 deletions src/Compiler/Driver/fsc.fs
Original file line number Diff line number Diff line change
Expand Up @@ -273,9 +273,6 @@ let SetProcessThreadLocals tcConfigB =
| Some s -> Thread.CurrentThread.CurrentUICulture <- CultureInfo(s)
| None -> ()

if tcConfigB.utf8output then
Console.OutputEncoding <- Encoding.UTF8

let ProcessCommandLineFlags (tcConfigB: TcConfigBuilder, lcidFromCodePage, argv) =
let mutable inputFilesRef = []

Expand Down Expand Up @@ -550,6 +547,17 @@ let main1
| Some parallelReferenceResolution -> tcConfigB.parallelReferenceResolution <- parallelReferenceResolution
| None -> ()

if tcConfigB.utf8output && Console.OutputEncoding <> Encoding.UTF8 then
let previousEncoding = Console.OutputEncoding
Console.OutputEncoding <- Encoding.UTF8

disposables.Register(
{ new IDisposable with
member _.Dispose() =
Console.OutputEncoding <- previousEncoding
}
)

// Display the banner text, if necessary
if not bannerAlreadyPrinted then
Console.Write(GetBannerText tcConfigB)
Expand Down Expand Up @@ -1242,16 +1250,6 @@ let CompileFromCommandLineArguments
) =

use disposables = new DisposablesTracker()
let savedOut = Console.Out

use _ =
{ new IDisposable with
member _.Dispose() =
try
Console.SetOut(savedOut)
with _ ->
()
}

main1 (
ctok,
Expand Down
22 changes: 16 additions & 6 deletions src/Compiler/Interactive/fsi.fs
Original file line number Diff line number Diff line change
Expand Up @@ -846,7 +846,7 @@ type internal FsiStdinSyphon(errorWriter: TextWriter) =
/// Encapsulates functions used to write to outWriter and errorWriter
type internal FsiConsoleOutput(tcConfigB, outWriter: TextWriter, errorWriter: TextWriter) =

let nullOut = new StreamWriter(Stream.Null) :> TextWriter
let nullOut = TextWriter.Null

let fprintfnn (os: TextWriter) fmt =
Printf.kfprintf
Expand Down Expand Up @@ -1203,11 +1203,6 @@ type internal FsiCommandLineOptions(fsi: FsiEvaluationSessionHostConfig, argv: s
if tcConfigB.clearResultsCache then
dependencyProvider.ClearResultsCache(tcConfigB.compilerToolPaths, getOutputDir tcConfigB, reportError rangeCmdArgs)

if tcConfigB.utf8output then
let prev = Console.OutputEncoding
Console.OutputEncoding <- Encoding.UTF8
System.AppDomain.CurrentDomain.ProcessExit.Add(fun _ -> Console.OutputEncoding <- prev)

do
let firstArg =
match sourceFiles with
Expand Down Expand Up @@ -4646,6 +4641,20 @@ type FsiEvaluationSession
with e ->
warning (e)

let restoreEncoding =
if tcConfigB.utf8output && Console.OutputEncoding <> Text.Encoding.UTF8 then
let previousEncoding = Console.OutputEncoding
Console.OutputEncoding <- Encoding.UTF8

Some(
{ new IDisposable with
member _.Dispose() =
Console.OutputEncoding <- previousEncoding
}
)
else
None

do
updateBannerText () // resetting banner text after parsing options

Expand Down Expand Up @@ -4789,6 +4798,7 @@ type FsiEvaluationSession
member _.Dispose() =
(tcImports :> IDisposable).Dispose()
uninstallMagicAssemblyResolution.Dispose()
restoreEncoding |> Option.iter (fun x -> x.Dispose())

/// Load the dummy interaction, load the initial files, and,
/// if interacting, start the background thread to read the standard input.
Expand Down
8 changes: 0 additions & 8 deletions src/Compiler/Service/service.fs
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,6 @@ module CompileHelpers =

diagnostics.ToArray(), result

let setOutputStreams execute =
// Set the output streams, if requested
match execute with
| Some(writer, error) ->
Console.SetOut writer
Console.SetError error
| None -> ()

[<Sealed; AutoSerializable(false)>]
// There is typically only one instance of this type in an IDE process.
type FSharpChecker
Expand Down
30 changes: 14 additions & 16 deletions src/Compiler/Utilities/Activity.fs
Original file line number Diff line number Diff line change
Expand Up @@ -237,38 +237,36 @@ module internal Activity =

sb.ToString()

let addCsvFileListener (pathToFile:string) =
if pathToFile |> File.Exists |> not then
File.WriteAllLines(
pathToFile,
[
"Name,StartTime,EndTime,Duration(s),Id,ParentId,RootId,"
+ String.concat "," Tags.AllKnownTags
]
)

let sw = new StreamWriter(path = pathToFile, append = true)
let addCsvFileListener (pathToFile: string) =
let newFile = pathToFile |> File.Exists |> not
// FileShare.Read to avoid sporadic file locking during tests.
let stream = new FileStream(pathToFile, FileMode.Append, FileAccess.Write, FileShare.Read)
let csvWriter = new StreamWriter(stream)

if newFile then csvWriter.WriteLine(
"Name,StartTime,EndTime,Duration(s),Id,ParentId,RootId,"
+ String.concat "," Tags.AllKnownTags)

let msgQueue =
MailboxProcessor<string>.Start(fun inbox ->
async {
while true do
let! msg = inbox.Receive()
do! sw.WriteLineAsync(msg) |> Async.AwaitTask
do! csvWriter.WriteLineAsync(msg) |> Async.AwaitTask
})

let l =
let listener =
new ActivityListener(
ShouldListenTo = (fun a ->ActivityNames.AllRelevantNames |> Array.contains a.Name),
Sample = (fun _ -> ActivitySamplingResult.AllData),
ActivityStopped = (fun a -> msgQueue.Post(createCsvRow a))
)

ActivitySource.AddActivityListener(l)
ActivitySource.AddActivityListener(listener)

{ new IDisposable with
member this.Dispose() =
l.Dispose() // Unregister from listening new activities first
listener.Dispose() // Unregister from listening new activities first
(msgQueue :> IDisposable).Dispose() // Wait for the msg queue to be written out
sw.Dispose() // Only then flush the messages and close the file
csvWriter.Dispose() // Only then flush the messages and close the file
}
2 changes: 1 addition & 1 deletion src/Compiler/Utilities/illib.fs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ module internal PervasiveAutoOpens =
type Async with

static member RunImmediate(computation: Async<'T>, ?cancellationToken) =
let cancellationToken = defaultArg cancellationToken Async.DefaultCancellationToken
let cancellationToken = defaultArg cancellationToken CancellationToken.None
Copy link
Member

Choose a reason for hiding this comment

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

What's the reason for this change? It might be a good idea in general, just asking how did you stumble on it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is out of desperation. I'm seeing OperationCancelledException in various test cases. We do a lot of RunSychronously / RunImmediate in the tests but also in FCS. I have no idea how to debug this, because it's very random, but my intuition is that Async.CancelDefaultToken() called in some test cases kills the asyncs in the same process? I have no idea if this makes sense, so this one is just experimental.

Copy link
Member

Choose a reason for hiding this comment

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

@vzarytovskii you might have some knowledge here?


let ts = TaskCompletionSource<'T>()

Expand Down
10 changes: 0 additions & 10 deletions src/fsi/fsimain.fs
Original file line number Diff line number Diff line change
Expand Up @@ -358,16 +358,6 @@ let evaluateSession (argv: string[]) =
let MainMain argv =
ignore argv
let argv = System.Environment.GetCommandLineArgs()
let savedOut = Console.Out

use __ =
{ new IDisposable with
member _.Dispose() =
try
Console.SetOut(savedOut)
with _ ->
()
}

let timesFlag = argv |> Array.exists (fun x -> x = "/times" || x = "--times")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<PackagePath>content\myfiles\</PackagePath>
</Content>
<PackageReference Include="BasicProvider" Version="1.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
</ItemGroup>

<Target Name="RemovePackagesFromCache" BeforeTargets="Restore">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
</None>

<PackageReference Include="ComboProvider" Version="1.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />

</ItemGroup>

<Target Name="RemovePackagesFromCache" BeforeTargets="Restore">
Expand Down
11 changes: 10 additions & 1 deletion tests/FSharp.Build.UnitTests/FSharp.Build.UnitTests.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,26 @@

<PropertyGroup>
<TargetFrameworks>net472;$(FSharpNetCoreProductTargetFramework)</TargetFrameworks>
<TargetFrameworks Condition="'$(OS)' == 'Unix'">$(FSharpNetCoreProductTargetFramework)</TargetFrameworks>
<TargetFrameworks Condition="'$(OS)' == 'Unix' or '$(BUILDING_USING_DOTNET)' == 'true'">$(FSharpNetCoreProductTargetFramework)</TargetFrameworks>
<OutputType>Library</OutputType>
<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
<UnitTestType>xunit</UnitTestType>
</PropertyGroup>

<ItemGroup>
<Compile Include="..\FSharp.Test.Utilities\XunitSetup.fs">
<Link>XunitSetup.fs</Link>
</Compile>
<Compile Include="WriteCodeFragmentTests.fs" />
<Compile Include="MapSourceRootsTests.fs" />
</ItemGroup>

<ItemGroup>
<Content Include="xunit.runner.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="$(FSharpSourcesRoot)\FSharp.Build\FSharp.Build.fsproj" />
<ProjectReference Include="$(FSharpSourcesRoot)\FSharp.Core\FSharp.Core.fsproj" />
Expand Down
5 changes: 5 additions & 0 deletions tests/FSharp.Build.UnitTests/xunit.runner.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"$schema": "https://xunit.net/schema/current/xunit.runner.schema.json",
"appDomain": "denied",
"parallelizeAssembly": true
}
Loading
Loading