Skip to content

Commit d0afeee

Browse files
authored
reenable tp tests (dotnet#9021)
1 parent 1d43a19 commit d0afeee

File tree

12 files changed

+71
-81
lines changed

12 files changed

+71
-81
lines changed

src/scripts/scriptlib.fsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ module Scripting =
172172

173173
let redirectToLog () = redirectTo System.Console.Out
174174

175-
#if !FSHARP_SUITE_DRIVES_CORECLR_TESTS
175+
#if !NETCOREAPP
176176
let defaultPlatform =
177177
match Environment.OSVersion.Platform, Environment.Is64BitOperatingSystem with
178178
| PlatformID.MacOSX, true -> "osx.10.11-x64"

tests/fsharp/Compiler/CompilerAssert.fs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,7 @@ type CompilerAssert private () =
8585
static let _ = config |> ignore
8686

8787
// Do a one time dotnet sdk build to compute the proper set of reference assemblies to pass to the compiler
88-
#if !NETCOREAPP
89-
#else
88+
#if NETCOREAPP
9089
static let projectFile = """
9190
<Project Sdk="Microsoft.NET.Sdk">
9291
@@ -189,12 +188,12 @@ let main argv = 0"""
189188
ProjectFileName = "Z:\\test.fsproj"
190189
ProjectId = None
191190
SourceFiles = [|"test.fs"|]
192-
#if !NETCOREAPP
193-
OtherOptions = [|"--preferreduilang:en-US";"--warn:5"|]
194-
#else
191+
#if NETCOREAPP
195192
OtherOptions =
196193
let assemblies = getNetCoreAppReferences |> Array.map (fun x -> sprintf "-r:%s" x)
197194
Array.append [|"--preferreduilang:en-US"; "--targetprofile:netcore"; "--noframework";"--warn:5"|] assemblies
195+
#else
196+
OtherOptions = [|"--preferreduilang:en-US";"--warn:5"|]
198197
#endif
199198
ReferencedProjects = [||]
200199
IsIncompleteTypeCheckEnvironment = false
@@ -554,10 +553,10 @@ let main argv = 0"""
554553

555554
// Build command line arguments & start FSI session
556555
let argv = [| "C:\\fsi.exe" |]
557-
#if !NETCOREAPP
558-
let args = Array.append argv [|"--noninteractive"|]
559-
#else
556+
#if NETCOREAPP
560557
let args = Array.append argv [|"--noninteractive"; "--targetprofile:netcore"|]
558+
#else
559+
let args = Array.append argv [|"--noninteractive"|]
561560
#endif
562561
let allArgs = Array.append args options
563562

tests/fsharp/FSharpSuite.Tests.fsproj

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@
1515
<UnitTestType>nunit</UnitTestType>
1616
</PropertyGroup>
1717

18-
<PropertyGroup Condition="$(TargetFramework.StartsWith('netstandard')) OR $(TargetFramework.StartsWith('netcoreapp'))">
19-
<DefineConstants>$(DefineConstants);FSHARP_SUITE_DRIVES_CORECLR_TESTS</DefineConstants>
20-
</PropertyGroup>
21-
2218
<ItemGroup>
2319
<Compile Include="..\..\src\scripts\scriptlib.fsx">
2420
<Link>scriptlib.fsx</Link>

tests/fsharp/TypeProviderTests.fs

Lines changed: 36 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,18 @@ open TestFramework
1919
open Scripting
2020
open SingleTest
2121

22-
#if FSHARP_SUITE_DRIVES_CORECLR_TESTS
22+
#if !NETCOREAPP
23+
// All tests which do a manual invoke of the F# compiler are disabled
24+
25+
#if NETCOREAPP
2326
// Use these lines if you want to test CoreCLR
2427
let FSC_BASIC = FSC_CORECLR
2528
let FSI_BASIC = FSI_CORECLR
26-
let FSIANYCPU_BASIC = FSI_CORECLR
2729
#else
2830
let FSC_BASIC = FSC_OPT_PLUS_DEBUG
2931
let FSI_BASIC = FSI_FILE
3032
#endif
3133

32-
(*
3334
[<Test>]
3435
let diamondAssembly () =
3536
let cfg = testConfig "typeProviders/diamondAssembly"
@@ -143,9 +144,10 @@ let helloWorld p =
143144
[<Test>]
144145
let ``helloWorld fsc`` () = helloWorld FSC_BASIC
145146

147+
#if !NETCOREAPP
146148
[<Test>]
147149
let ``helloWorld fsi`` () = helloWorld FSI_STDIN
148-
150+
#endif
149151

150152
[<Test>]
151153
let helloWorldCSharp () =
@@ -238,6 +240,7 @@ let ``negative type provider tests`` (name:string) =
238240
do
239241
File.ReadAllText(sprintf "%s%s.%sbslpp" dirp name pref)
240242
.Replace("<ASSEMBLY>", getfullpath cfg (sprintf "provider_%s.dll" name))
243+
.Replace("<FILEPATH>",dirp)
241244
.Replace("<URIPATH>",sprintf "file:///%s" dirp)
242245
|> fun txt -> File.WriteAllText(sprintf "%s%s.%sbsl" dirp name pref,txt)
243246

@@ -267,13 +270,22 @@ let splitAssembly subdir project =
267270

268271
fsc cfg "--out:providerDesigner.dll -a" ["providerDesigner.fsx"]
269272

270-
SingleTest.singleTestBuildAndRunAux cfg FSC_BASIC
273+
fsc cfg "--out:test.exe -r:provider.dll" ["test.fsx"]
271274

272-
SingleTest.singleTestBuildAndRunAux cfg FSI_BASIC
275+
begin
276+
use testOkFile = fileguard cfg "test.ok"
273277

274-
#if !FSHARP_SUITE_DRIVES_CORECLR_TESTS
275-
SingleTest.singleTestBuildAndRunAux cfg FSIANYCPU_BASIC
276-
#endif
278+
exec cfg ("." ++ "test.exe") ""
279+
280+
testOkFile.CheckExists()
281+
end
282+
283+
begin
284+
use testOkFile = fileguard cfg "test.ok"
285+
286+
fsi cfg "%s" cfg.fsi_flags ["test.fsx"]
287+
testOkFile.CheckExists()
288+
end
277289

278290
// Do the same thing with different load locations for the type provider design-time component
279291

@@ -289,23 +301,30 @@ let splitAssembly subdir project =
289301

290302
for dir in someLoadPaths do
291303

304+
printfn ""
305+
printfn "Checking load path '%s'" dir
292306
clean()
293307

294308
// put providerDesigner.dll into a different place
295309
mkdir cfg dir
296310
fsc cfg "--out:%s/providerDesigner.dll -a" dir ["providerDesigner.fsx"]
297311

298-
SingleTest.singleTestBuildAndRunAux cfg FSC_BASIC
312+
fsc cfg "--out:test.exe -r:provider.dll" ["test.fsx"]
299313

300-
for dir in someLoadPaths do
314+
begin
315+
use testOkFile = fileguard cfg "test.ok"
301316

302-
clean()
317+
exec cfg ("." ++ "test.exe") ""
303318

304-
// put providerDesigner.dll into a different place
305-
mkdir cfg dir
306-
fsc cfg "--out:%s/providerDesigner.dll -a" dir ["providerDesigner.fsx"]
319+
testOkFile.CheckExists()
320+
end
321+
322+
begin
323+
use testOkFile = fileguard cfg "test.ok"
307324

308-
SingleTest.singleTestBuildAndRunAux cfg FSI_BASIC
325+
fsi cfg "%s" cfg.fsi_flags ["test.fsx"]
326+
testOkFile.CheckExists()
327+
end
309328

310329
clean()
311330

@@ -360,4 +379,4 @@ let wedgeAssembly () =
360379
peverify cfg "test3.exe"
361380

362381
exec cfg ("." ++ "test3.exe") ""
363-
*)
382+
#endif

tests/fsharp/readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ test cases look similar to:
1616
This test case builds and runs the test case in the folder core/array
1717

1818
this #define is used to exclude from the build tests that run will not run correctly on the coreclr
19-
__#if !FSHARP_SUITE_DRIVES_CORECLR_TESTS__
19+
__#if !NETCOREAPP__
2020

2121
There are some older tests in this section that looks similar to:
2222
````

tests/fsharp/single-test.fs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ type Permutation =
1111
| FSC_CORECLR
1212
| FSC_CORECLR_BUILDONLY
1313
| FSI_CORECLR
14-
#if !FSHARP_SUITE_DRIVES_CORECLR_TESTS
14+
#if !NETCOREAPP
1515
| FSI_FILE
1616
| FSI_STDIN
1717
| GENERATED_SIGNATURE
@@ -309,7 +309,7 @@ let singleTestBuildAndRunCore cfg copyFiles p languageVersion =
309309
| FSC_CORECLR_BUILDONLY -> executeSingleTestBuildAndRun OutputType.Exe "coreclr" "netcoreapp3.0" true true
310310
| FSI_CORECLR -> executeSingleTestBuildAndRun OutputType.Script "coreclr" "netcoreapp3.0" true false
311311

312-
#if !FSHARP_SUITE_DRIVES_CORECLR_TESTS
312+
#if !NETCOREAPP
313313
| FSC_BUILDONLY -> executeSingleTestBuildAndRun OutputType.Exe "net40" "net472" false true
314314
| FSC_OPT_PLUS_DEBUG -> executeSingleTestBuildAndRun OutputType.Exe "net40" "net472" true false
315315
| FSC_OPT_MINUS_DEBUG -> executeSingleTestBuildAndRun OutputType.Exe "net40" "net472" false false

tests/fsharp/test-framework.fs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,13 @@ module Commands =
8282
CmdResult.ErrorLevel (msg, err)
8383
#else
8484
ignore workDir
85-
#if !FSHARP_SUITE_DRIVES_CORECLR_TESTS
85+
#if NETCOREAPP
86+
exec dotNetExe (fscExe + " " + args)
87+
#else
8688
ignore dotNetExe
8789
printfn "fscExe: %A" fscExe
8890
printfn "args: %A" args
8991
exec fscExe args
90-
#else
91-
exec dotNetExe (fscExe + " " + args)
9292
#endif
9393
#endif
9494

@@ -127,7 +127,7 @@ type TestConfig =
127127
fsc_flags : string
128128
FSCOREDLLPATH : string
129129
FSI : string
130-
#if !FSHARP_SUITE_DRIVES_CORECLR_TESTS
130+
#if !NETCOREAPP
131131
FSIANYCPU : string
132132
#endif
133133
FSI_FOR_SCRIPTS : string
@@ -204,7 +204,7 @@ let config configurationName envVars =
204204
File.Copy(coreclrdll, Path.GetDirectoryName(ILASM) ++ "coreclr.dll", overwrite=true)
205205

206206
let FSI = requireFile (FSI_FOR_SCRIPTS)
207-
#if !FSHARP_SUITE_DRIVES_CORECLR_TESTS
207+
#if !NETCOREAPP
208208
let FSIANYCPU = requireFile (artifactsBinPath ++ "fsiAnyCpu" ++ configurationName ++ "net472" ++ "fsiAnyCpu.exe")
209209
#endif
210210
let FSC = requireFile (artifactsBinPath ++ "fsc" ++ configurationName ++ fscArchitecture ++ "fsc.exe")
@@ -226,7 +226,7 @@ let config configurationName envVars =
226226
BUILD_CONFIG = configurationName
227227
FSC = FSC
228228
FSI = FSI
229-
#if !FSHARP_SUITE_DRIVES_CORECLR_TESTS
229+
#if !NETCOREAPP
230230
FSIANYCPU = FSIANYCPU
231231
#endif
232232
FSI_FOR_SCRIPTS = FSI_FOR_SCRIPTS
@@ -250,7 +250,7 @@ let logConfig (cfg: TestConfig) =
250250
log "fsc_flags =%s" cfg.fsc_flags
251251
log "FSCOREDLLPATH =%s" cfg.FSCOREDLLPATH
252252
log "FSI =%s" cfg.FSI
253-
#if !FSHARP_SUITE_DRIVES_CORECLR_TESTS
253+
#if !NETCOREAPP
254254
log "FSIANYCPU =%s" cfg.FSIANYCPU
255255
#endif
256256
log "fsi_flags =%s" cfg.fsi_flags
@@ -466,7 +466,7 @@ let ilasm cfg arg = Printf.ksprintf (Commands.ilasm (exec cfg) cfg.ILASM) arg
466466
let peverify cfg = Commands.peverify (exec cfg) cfg.PEVERIFY "/nologo"
467467
let peverifyWithArgs cfg args = Commands.peverify (exec cfg) cfg.PEVERIFY args
468468
let fsi cfg = Printf.ksprintf (Commands.fsi (exec cfg) cfg.FSI)
469-
#if !FSHARP_SUITE_DRIVES_CORECLR_TESTS
469+
#if !NETCOREAPP
470470
let fsiAnyCpu cfg = Printf.ksprintf (Commands.fsi (exec cfg) cfg.FSIANYCPU)
471471
#endif
472472
let fsi_script cfg = Printf.ksprintf (Commands.fsi (exec cfg) cfg.FSI_FOR_SCRIPTS)

tests/fsharp/tests.fs

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ open Scripting
1818
open SingleTest
1919
open HandleExpects
2020

21-
#if FSHARP_SUITE_DRIVES_CORECLR_TESTS
21+
#if NETCOREAPP
2222
// Use these lines if you want to test CoreCLR
2323
let FSC_BASIC = FSC_CORECLR
2424
let FSC_BUILDONLY = FSC_CORECLR_BUILDONLY
@@ -234,7 +234,7 @@ module CoreTests =
234234
let cfg = testConfig "SDKTests"
235235
exec cfg cfg.DotNetExe ("msbuild " + Path.Combine(cfg.Directory, "AllSdkTargetsTests.proj"))
236236

237-
#if !FSHARP_SUITE_DRIVES_CORECLR_TESTS
237+
#if !NETCOREAPP
238238
[<Test>]
239239
let ``attributes-FSC_BASIC`` () = singleTestBuildAndRun "core/attributes" FSC_BASIC
240240

@@ -476,7 +476,7 @@ module CoreTests =
476476
[<Test>]
477477
let ``enum-FSI_BASIC`` () = singleTestBuildAndRun "core/enum" FSI_BASIC
478478

479-
#if !FSHARP_SUITE_DRIVES_CORECLR_TESTS
479+
#if !NETCOREAPP
480480

481481
// Requires winforms will not run on coreclr
482482
[<Test>]
@@ -956,7 +956,7 @@ module CoreTests =
956956
let ``signedtest-16`` () = signedtest("test-sha1024-full-attributes", "--define:SHA1024", SigningType.PublicSigned)
957957
#endif
958958

959-
#if !FSHARP_SUITE_DRIVES_CORECLR_TESTS
959+
#if !NETCOREAPP
960960
[<Test>]
961961
let quotes () =
962962
let cfg = testConfig "core/quotes"
@@ -1355,7 +1355,7 @@ module CoreTests =
13551355
[<Test>]
13561356
let ``fsi_load-FSI_BASIC`` () = singleTestBuildAndRun "core/fsi-load" FSI_BASIC
13571357

1358-
#if !FSHARP_SUITE_DRIVES_CORECLR_TESTS
1358+
#if !NETCOREAPP
13591359
[<Test>]
13601360
let ``measures-AS_DLL`` () = singleTestBuildAndRun "core/measures" AS_DLL
13611361

@@ -1586,7 +1586,7 @@ module CoreTests =
15861586
[<Test>]
15871587
let ``reflect-FSI_BASIC`` () = singleTestBuildAndRun "core/reflect" FSI_BASIC
15881588

1589-
#if !FSHARP_SUITE_DRIVES_CORECLR_TESTS
1589+
#if !NETCOREAPP
15901590
[<Test>]
15911591
let refnormalization () =
15921592
let cfg = testConfig "core/refnormalization"
@@ -1835,7 +1835,7 @@ module VersionTests =
18351835
[<Test>]
18361836
let ``nameof-fsi``() = singleTestBuildAndRunVersion "core/nameof/preview" FSI_BASIC "preview"
18371837

1838-
#if !FSHARP_SUITE_DRIVES_CORECLR_TESTS
1838+
#if !NETCOREAPP
18391839
module ToolsTests =
18401840

18411841
// This test is disabled in coreclr builds dependent on fixing : https://github.com/Microsoft/visualfsharp/issues/2600
@@ -1885,7 +1885,7 @@ module RegressionTests =
18851885
[<Test >]
18861886
let ``tuple-bug-1-FSC_BASIC`` () = singleTestBuildAndRun "regression/tuple-bug-1" FSC_BASIC
18871887

1888-
#if !FSHARP_SUITE_DRIVES_CORECLR_TESTS
1888+
#if !NETCOREAPP
18891889
[<Test>]
18901890
let ``SRTP doesn't handle calling member hiding hinherited members`` () =
18911891
let cfg = testConfig "regression/5531"
@@ -1920,7 +1920,7 @@ module RegressionTests =
19201920
[<Test >]
19211921
let ``321`` () = singleTestBuildAndRun "regression/321" FSC_BASIC
19221922

1923-
#if !FSHARP_SUITE_DRIVES_CORECLR_TESTS
1923+
#if !NETCOREAPP
19241924
// This test is disabled in coreclr builds dependent on fixing : https://github.com/Microsoft/visualfsharp/issues/2600
19251925
[<Test>]
19261926
let ``655`` () =
@@ -1950,7 +1950,7 @@ module RegressionTests =
19501950
peverify cfg "pack.exe"
19511951
#endif
19521952

1953-
#if !FSHARP_SUITE_DRIVES_CORECLR_TESTS
1953+
#if !NETCOREAPP
19541954
// Requires WinForms
19551955
[<Test>]
19561956
let ``83`` () = singleTestBuildAndRun "regression/83" FSC_BASIC
@@ -1973,7 +1973,7 @@ module RegressionTests =
19731973
[<Test >]
19741974
let ``struct-tuple-bug-1-FSI_BASIC`` () = singleTestBuildAndRun "regression/struct-tuple-bug-1" FSI_BASIC
19751975

1976-
#if !FSHARP_SUITE_DRIVES_CORECLR_TESTS
1976+
#if !NETCOREAPP
19771977
// This test is disabled in coreclr builds dependent on fixing : https://github.com/Microsoft/visualfsharp/issues/2600
19781978
[<Test>]
19791979
let ``struct-measure-bug-1`` () =
@@ -1982,8 +1982,7 @@ module RegressionTests =
19821982
fsc cfg "%s --optimize- -o:test.exe -g" cfg.fsc_flags ["test.fs"]
19831983

19841984
peverify cfg "test.exe"
1985-
#endif
1986-
#if !FSHARP_SUITE_DRIVES_CORECLR_TESTS
1985+
19871986
module OptimizationTests =
19881987

19891988
[<Test>]
@@ -2126,7 +2125,7 @@ module TypecheckTests =
21262125
[<Test>]
21272126
let misc () = singleTestBuildAndRun "typecheck/misc" FSC_BASIC
21282127

2129-
#if !FSHARP_SUITE_DRIVES_CORECLR_TESTS
2128+
#if !NETCOREAPP
21302129

21312130
[<Test>]
21322131
let ``sigs pos26`` () =
@@ -2953,7 +2952,7 @@ module GeneratedSignatureTests =
29532952
let ``measures-GENERATED_SIGNATURE`` () = singleTestBuildAndRun "core/measures" GENERATED_SIGNATURE
29542953
#endif
29552954

2956-
#if !FSHARP_SUITE_DRIVES_CORECLR_TESTS
2955+
#if !NETCOREAPP
29572956
module OverloadResolution =
29582957
module ``fsharpqa migrated tests`` =
29592958
let [<Test>] ``Conformance\Expressions\SyntacticSugar (E_Slices01.fs)`` () = singleNegTest (testConfig "conformance/expressions/syntacticsugar") "E_Slices01"

tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_ReturnsTypeWithIncorrectNameFromApplyStaticArguments.bsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ EVIL_PROVIDER_ReturnsTypeWithIncorrectNameFromApplyStaticArguments.fsx(6,39,6,14
55

66
EVIL_PROVIDER_ReturnsTypeWithIncorrectNameFromApplyStaticArguments.fsx(8,41,8,58): typecheck error FS0039: The type 'TheGeneratedTypeJ' is not defined.
77

8-
EVIL_PROVIDER_ReturnsTypeWithIncorrectNameFromApplyStaticArguments.fsx(8,79,8,96): typecheck error FS0039: The field, constructor or member 'TheGeneratedTypeJ' is not defined.
8+
EVIL_PROVIDER_ReturnsTypeWithIncorrectNameFromApplyStaticArguments.fsx(8,79,8,96): typecheck error FS0039: The type 'Object' does not define the field, constructor or member 'TheGeneratedTypeJ'.

0 commit comments

Comments
 (0)