Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9552970

Browse files
committed
Merge remote-tracking branch 'remotes/origin/master' into codelensfixes
2 parents46850a0 +b224a2d commit9552970

File tree

8 files changed

+75
-13
lines changed

8 files changed

+75
-13
lines changed

‎DEVGUIDE.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,8 @@ To do this, build the non-buildfromsource version of FSharp.Compiler.Private (sr
224224
.\build net40
225225
copy /y src\fsharp\FSharp.Compiler.Private\obj\release\net40\FSComp.* src\buildfromsource\FSharp.Compiler.Private\
226226

227+
You can also change build.cmd to default COPY_FSCOMP_RESOURCE_FOR_BUILD_FROM_SOURCES to 1 under ":ARGUMENTS_OK" label.
228+
227229
####Configuring proxy server
228230

229231
If you are behind a proxy server, NuGet client tool must be configured to use it:

‎FSharpBuild.Directory.Build.props‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,9 @@
5454

5555
<!-- SDK targets override-->
5656
<PropertyGroupCondition="'$(Configuration)' != 'Proto'">
57-
<ProtoFSharpTargetsShim>$(ProtoOutputPath)\Microsoft.FSharp.NetSdk.targets</ProtoFSharpTargetsShim>
58-
<FSharpTargetsShimCondition="Exists('$(ProtoFSharpTargetsShim)')">$(ProtoFSharpTargetsShim)</FSharpTargetsShim>
57+
<FSharpPropsShimCondition="Exists('$(ProtoOutputPath)\Microsoft.FSharp.NetSdk.props')">$(ProtoOutputPath)\Microsoft.FSharp.NetSdk.props</FSharpPropsShim>
58+
<FSharpTargetsShimCondition="Exists('$(ProtoOutputPath)\Microsoft.FSharp.NetSdk.targets')">$(ProtoOutputPath)\Microsoft.FSharp.NetSdk.targets</FSharpTargetsShim>
59+
<FSharpOverridesTargetsShimCondition="Exists('$(ProtoOutputPath)\Microsoft.FSharp.Overrides.NetSdk.targets')">$(ProtoOutputPath)\Microsoft.FSharp.Overrides.NetSdk.targets</FSharpOverridesTargetsShim>
5960
</PropertyGroup>
6061

6162
</Project>

‎TESTGUIDE.md‎

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,11 @@ The F# tests are split as follows:
3939
This is compiled using[tests\fsharp\FSharp.Tests.FSharpSuite.fsproj](tests/fsharp/FSharp.Tests.FSharpSuite.fsproj) to a unit test DLL which acts as a driver script. Each individual test is an NUnit test case, and so you can run it like any other NUnit test.
4040

4141
Tests are grouped in folders per area. Each test compiles and executes a`test.fsx|fs` file in its folder using some combination of compiler or FSI flags specified in the FSharpSuite test project.
42-
If the compilation and execution encounter no errors, the test is considered to have passed.
42+
If the compilation and execution encounter no errors, the test is considered to have passed.
43+
44+
There are also negative tests checking code expected to fail compilation.
45+
46+
See note about baseline under "Other Tips" bellow for tests checking expectations against "baseline" files.
4347

4448
###FSharpQA Suite
4549

@@ -81,9 +85,22 @@ All test execution logs and result files will be dropped into the `tests\TestRes
8185

8286
###Other Tips
8387

84-
* Run as Administrator, or a handful of tests will fail
88+
####Run as Administrator
89+
90+
Do this, or a handful of tests will fail.
91+
92+
####Making the tests run faster
93+
94+
* NGen-ing the F# bits (fsc, fsi, FSharp.Core, etc) will result in tests executing much faster. Make sure you run`src\update.cmd` with the`-ngen` flag before running tests.
95+
* The FSharp and FSharpQA suites will run test cases in parallel by default. You can comment out the relevant line (look for`PARALLEL_ARG`) to disable this.
96+
* By default, tests from the FSharpQA suite are run using a persistent, hosted version of the compiler. This speeds up test execution, as there is no need for the`fsc.exe` process to spin up repeatedly. To disable this, uncomment the relevant line (look for`HOSTED_COMPILER`).
97+
98+
####Test outcome against baseline
99+
100+
FSharp Test Suite works with couples of .bsl (or .bslpp) files considered "expected" and called baseline, those are matched against the actual output which resides under .err or .vserr files of same name at the during test execution.
101+
102+
When working on changes generating conflicts with the baseline, you can use the helper script[tests/fsharp/update.base.line.with.actuals.fsx](tests/fsharp/update.base.line.with.actuals.fsx) to update all .bsl based on the matching .err file.
103+
104+
When doing so keep in mind to carefully review the diff before comitting updated baseline files.
85105

86-
* Making the tests run faster
87-
* NGen-ing the F# bits (fsc, fsi, FSharp.Core, etc) will result in tests executing much faster. Make sure you run`src\update.cmd` with the`-ngen` flag before running tests.
88-
* The FSharp and FSharpQA suites will run test cases in parallel by default. You can comment out the relevant line (look for`PARALLEL_ARG`) to disable this.
89-
* By default, tests from the FSharpQA suite are run using a persistent, hosted version of the compiler. This speeds up test execution, as there is no need for the`fsc.exe` process to spin up repeatedly. To disable this, uncomment the relevant line (look for`HOSTED_COMPILER`).
106+
.bslpp (baseline pre-process) files are specially designed to enable substitution of certain tokens to generate the .bsl file. You can look further about the pre-processing logic under[tests/fsharp/TypeProviderTests.fs](tests/fsharp/TypeProviderTests.fs), this is used only for type provider tests for now.

‎build.cmd‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ set TEST_END_2_END=0
7979
setINCLUDE_TEST_SPEC_NUNIT=
8080
setINCLUDE_TEST_TAGS=
8181

82+
setCOPY_FSCOMP_RESOURCE_FOR_BUILD_FROM_SOURCES=0
83+
8284
setSIGN_TYPE=%PB_SIGNTYPE%
8385

8486
REM ------------------ Parse all arguments -----------------------
@@ -156,6 +158,7 @@ if /i "%ARG%" == "net40" (
156158
set_autoselect=0
157159
setBUILD_NET40_FSHARP_CORE=1
158160
setBUILD_NET40=1
161+
setCOPY_FSCOMP_RESOURCE_FOR_BUILD_FROM_SOURCES=1
159162
)
160163

161164
if /i"%ARG%"=="coreclr" (
@@ -175,6 +178,7 @@ if /i "%ARG%" == "vs" (
175178
set_autoselect=0
176179
setBUILD_NET40=1
177180
setBUILD_VS=1
181+
setCOPY_FSCOMP_RESOURCE_FOR_BUILD_FROM_SOURCES=1
178182
)
179183

180184
if /i"%ARG%"=="fcs" (
@@ -191,6 +195,7 @@ if /i "%ARG%" == "nobuild" (
191195
)
192196
if /i"%ARG%"=="all" (
193197
set_autoselect=0
198+
setCOPY_FSCOMP_RESOURCE_FOR_BUILD_FROM_SOURCES=1
194199
setBUILD_PROTO=1
195200
setBUILD_PROTO_WITH_CORECLR_LKG=1
196201
setBUILD_NET40=1
@@ -512,6 +517,9 @@ echo PB_SKIPTESTS=%PB_SKIPTESTS%
512517
echo PB_RESTORESOURCE=%PB_RESTORESOURCE%
513518
echo.
514519
echo SIGN_TYPE=%SIGN_TYPE%
520+
echo.
521+
echo COPY_FSCOMP_RESOURCE_FOR_BUILD_FROM_SOURCES=%COPY_FSCOMP_RESOURCE_FOR_BUILD_FROM_SOURCES%
522+
echo.
515523
echo TEST_FCS=%TEST_FCS%
516524
echo TEST_NET40_COMPILERUNIT_SUITE=%TEST_NET40_COMPILERUNIT_SUITE%
517525
echo TEST_NET40_COREUNIT_SUITE=%TEST_NET40_COREUNIT_SUITE%
@@ -840,6 +848,11 @@ if "%BUILD_NET40_FSHARP_CORE%" == "1" (
840848
call src\update.cmd%BUILD_CONFIG% -ngen
841849
)
842850

851+
if"%COPY_FSCOMP_RESOURCE_FOR_BUILD_FROM_SOURCES%"=="1" (
852+
echo ---------------- copy fscomp resource for build from sources ---------------
853+
copy /y src\fsharp\FSharp.Compiler.Private\obj\%BUILD_CONFIG%\net40\FSComp.* src\buildfromsource\FSharp.Compiler.Private
854+
)
855+
843856
@echo set NUNITPATH=packages\NUnit.Console.3.0.0\tools\
844857
setNUNITPATH=packages\NUnit.Console.3.0.0\tools\
845858
ifnotexist%NUNITPATH%echo Error: Could not find%NUNITPATH%&&goto :failure

‎src/fsharp/CompileOps.fs‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2112,12 +2112,13 @@ type TimeStampCache(defaultTimeStamp: DateTime) =
21122112
letprojects= Dictionary<IProjectReference, DateTime>(HashIdentity.Reference)
21132113
membercache.GetFileTimeStamp fileName=
21142114
letok,v= files.TryGetValue(fileName)
2115-
if okthen velse
2115+
if okthen velse
21162116
letv=
2117-
if FileSystem.SafeExists(fileName)then
2117+
try
21182118
FileSystem.GetLastWriteTimeShim(fileName)
2119-
else
2120-
defaultTimeStamp
2119+
with
2120+
|:? FileNotFoundException->
2121+
defaultTimeStamp
21212122
files.[fileName]<- v
21222123
v
21232124

‎tests/fsharp/FSharp.Tests.FSharpSuite.fsproj‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
<CompileInclude="tests.fs" />
4040
<ContentInclude="packages.config" />
4141
<NoneInclude="app.config" />
42+
<NoneInclude="update.base.line.with.actuals.fsx" />
4243
</ItemGroup>
4344
<ItemGroup>
4445
<ReferenceInclude="mscorlib" />

‎tests/fsharp/test-framework.fs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ type FSLibPaths =
143143
{ FSCOREDLLPATH:string}
144144

145145
letrequireFile nm=
146-
if Commands.fileExists__SOURCE_DIRECTORY__ nm|> Option.isSomethen nmelse failwith(sprintf"couldn't find%s" nm)
146+
if Commands.fileExists__SOURCE_DIRECTORY__ nm|> Option.isSomethen nmelse failwith(sprintf"couldn't find%s. Running 'build test' once might solve this issue" nm)
147147

148148
letconfig configurationName envVars=
149149

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
openSystem.IO
2+
3+
// this script is usefull for tests using a .bsl file (baseline) containing expected compiler output
4+
// which is matched against .vserr or .err file aside once the test has run
5+
// the script replaces all the .bsl/.bslpp with either .err or .vserr
6+
7+
letdirectories=
8+
[
9+
"typecheck/sigs"
10+
"typeProviders/negTests"
11+
]
12+
|> List.map(fun d-> Path.Combine(__SOURCE_DIRECTORY__, d)|> DirectoryInfo)
13+
14+
letextensionPatterns=["*.err";"*.vserr"]
15+
for din directoriesdo
16+
for pin extensionPatternsdo
17+
for errFilein d.GetFiles pdo
18+
letbaseLineFile= FileInfo(Path.ChangeExtension(errFile.FullName,"bsl"))
19+
letbaseLineFilePreProcess= FileInfo(Path.ChangeExtension(errFile.FullName,"bslpp"))
20+
21+
if File.ReadAllText(errFile.FullName)<> File.ReadAllText(baseLineFile.FullName)then
22+
letexpectedFile=
23+
if baseLineFilePreProcess.Existsthen baseLineFilePreProcess
24+
else baseLineFile
25+
26+
printfn"%s not matching, replacing with%s" expectedFile.FullName errFile.FullName
27+
errFile.CopyTo(expectedFile.FullName,true)|> ignore

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp