From d815f908b149368d8c7d7a3af3ffe0e486254d68 Mon Sep 17 00:00:00 2001 From: Steffen Forkmann Date: Wed, 14 Dec 2016 09:36:50 +0100 Subject: [PATCH] Don't run neg tests in groups --- tests/fsharp/FSharp.Tests.FSharpSuite.fsproj | 1 + tests/fsharp/TypeProviderTests.fs | 302 +++++++++++ tests/fsharp/single-test.fs | 31 +- tests/fsharp/test-framework.fs | 2 +- tests/fsharp/tests.fs | 496 +++++-------------- 5 files changed, 447 insertions(+), 385 deletions(-) create mode 100644 tests/fsharp/TypeProviderTests.fs diff --git a/tests/fsharp/FSharp.Tests.FSharpSuite.fsproj b/tests/fsharp/FSharp.Tests.FSharpSuite.fsproj index fd434962db3..726cd4922ca 100644 --- a/tests/fsharp/FSharp.Tests.FSharpSuite.fsproj +++ b/tests/fsharp/FSharp.Tests.FSharpSuite.fsproj @@ -34,6 +34,7 @@ NunitHelpers.fs + diff --git a/tests/fsharp/TypeProviderTests.fs b/tests/fsharp/TypeProviderTests.fs new file mode 100644 index 00000000000..92ed2727c54 --- /dev/null +++ b/tests/fsharp/TypeProviderTests.fs @@ -0,0 +1,302 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +#if INTERACTIVE +//#r @"../../release/net40/bin/FSharp.Compiler.dll" +#r @"../../packages/NUnit.3.5.0/lib/net45/nunit.framework.dll" +#load "../../src/scripts/scriptlib.fsx" +#load "test-framework.fs" +#load "single-test.fs" +#else +module FSharp.Test.FSharpSuite.TypeProviderTests +#endif + +open System +open System.IO +open System.Reflection +open NUnit.Framework +open TestFramework +open Scripting +open SingleTest + +#if FSHARP_SUITE_DRIVES_CORECLR_TESTS +// Use these lines if you want to test CoreCLR +let FSC_BASIC = FSC_CORECLR +let FSI_BASIC = FSI_CORECLR +#else +let FSC_BASIC = FSC_OPT_PLUS_DEBUG +let FSI_BASIC = FSI_FILE +#endif + +[] +let diamondAssembly () = + let cfg = testConfig "typeProviders/diamondAssembly" + + rm cfg "provider.dll" + + fsc cfg "%s" "--out:provided.dll -a" [".." ++ "helloWorld" ++ "provided.fs"] + + fsc cfg "%s" "--out:provider.dll -a" [".." ++ "helloWorld" ++ "provider.fsx"] + + fsc cfg "%s --debug+ -r:provider.dll --optimize- -o:test1.dll -a" cfg.fsc_flags ["test1.fsx"] + + fsc cfg "%s --debug+ -r:provider.dll --optimize- -o:test2a.dll -a -r:test1.dll" cfg.fsc_flags ["test2a.fsx"] + + fsc cfg "%s --debug+ -r:provider.dll --optimize- -o:test2b.dll -a -r:test1.dll" cfg.fsc_flags ["test2b.fsx"] + + fsc cfg "%s --debug+ -r:provider.dll --optimize- -o:test3.exe -r:test1.dll -r:test2a.dll -r:test2b.dll" cfg.fsc_flags ["test3.fsx"] + + peverify cfg "test1.dll" + + peverify cfg "test2a.dll" + + peverify cfg "test2b.dll" + + peverify cfg "test3.exe" + + exec cfg ("." ++ "test3.exe") "" + + use testOkFile = fileguard cfg "test.ok" + + fsi cfg "%s" cfg.fsi_flags ["test3.fsx"] + + testOkFile.CheckExists() + +[] +let globalNamespace () = + let cfg = testConfig "typeProviders/globalNamespace" + + csc cfg """/out:globalNamespaceTP.dll /debug+ /target:library /r:"%s" """ cfg.FSCOREDLLPATH ["globalNamespaceTP.cs"] + + fsc cfg "%s /debug+ /r:globalNamespaceTP.dll /optimize-" cfg.fsc_flags ["test.fsx"] + +let helloWorld p = + let cfg = testConfig "typeProviders/helloWorld" + + fsc cfg "%s" "--out:provided1.dll -g -a" [".." ++ "helloWorld" ++ "provided.fs"] + + fsc cfg "%s" "--out:provided2.dll -g -a" [".." ++ "helloWorld" ++ "provided.fs"] + + fsc cfg "%s" "--out:provided3.dll -g -a" [".." ++ "helloWorld" ++ "provided.fs"] + + fsc cfg "%s" "--out:provided4.dll -g -a" [".." ++ "helloWorld" ++ "provided.fs"] + + fsc cfg "%s" "--out:providedJ.dll -g -a" [".." ++ "helloWorld" ++ "providedJ.fs"] + + fsc cfg "%s" "--out:providedK.dll -g -a" [".." ++ "helloWorld" ++ "providedK.fs"] + + fsc cfg "%s" "--out:providedNullAssemblyName.dll -g -a" [".." ++ "helloWorld" ++ "providedNullAssemblyName.fsx"] + + fsc cfg "--out:provided.dll -a" [".." ++ "helloWorld" ++ "provided.fs"] + + fsc cfg "--out:providedJ.dll -a" [".." ++ "helloWorld" ++ "providedJ.fs"] + + fsc cfg "--out:providedK.dll -a" [".." ++ "helloWorld" ++ "providedK.fs"] + + fsc cfg "--out:provider.dll -a" ["provider.fsx"] + + SingleTest.singleTestBuildAndRunAux cfg p + + + rm cfg "provider_with_binary_compat_changes.dll" + + mkdir cfg "bincompat1" + + log "pushd bincompat1" + let bincompat1 = getfullpath cfg "bincompat1" + + Directory.EnumerateFiles(bincompat1 ++ "..", "*.dll") + |> Seq.iter (fun from -> Commands.copy_y bincompat1 from ("." ++ Path.GetFileName(from)) |> ignore) + + fscIn cfg bincompat1 "%s" "-g -a -o:test_lib.dll -r:provider.dll" [".." ++ "test.fsx"] + + fscIn cfg bincompat1 "%s" "-r:test_lib.dll -r:provider.dll" [".." ++ "testlib_client.fsx"] + + log "popd" + + mkdir cfg "bincompat2" + + log "pushd bincompat2" + let bincompat2 = getfullpath cfg "bincompat2" + + Directory.EnumerateFiles(bincompat2 ++ ".." ++ "bincompat1", "*.dll") + |> Seq.iter (fun from -> Commands.copy_y bincompat2 from ("." ++ Path.GetFileName(from)) |> ignore) + + fscIn cfg bincompat2 "%s" "--define:ADD_AN_OPTIONAL_STATIC_PARAMETER --define:USE_IMPLICIT_ITypeProvider2 --out:provider.dll -g -a" [".." ++ "provider.fsx"] + + fscIn cfg bincompat2 "-g -a -o:test_lib_recompiled.dll -r:provider.dll" [".." ++ "test.fsx"] + + fscIn cfg bincompat2 "%s" "--define:ADD_AN_OPTIONAL_STATIC_PARAMETER -r:test_lib.dll -r:provider.dll" [".." ++ "testlib_client.fsx"] + + peverify cfg (bincompat2 ++ "provider.dll") + + peverify cfg (bincompat2 ++ "test_lib.dll") + + peverify cfg (bincompat2 ++ "test_lib_recompiled.dll") + + peverify cfg (bincompat2 ++ "testlib_client.exe") + +[] +let ``helloWorld fsc`` () = helloWorld FSC_BASIC + +[] +let ``helloWorld fsi`` () = helloWorld FSI_STDIN + + +[] +let helloWorldCSharp () = + let cfg = testConfig "typeProviders/helloWorldCSharp" + + rm cfg "magic.dll" + + fsc cfg "%s" "--out:magic.dll -a --keyfile:magic.snk" ["magic.fs "] + + rm cfg "provider.dll" + + csc cfg """/out:provider.dll /target:library "/r:%s" /r:magic.dll""" cfg.FSCOREDLLPATH ["provider.cs"] + + fsc cfg "%s /debug+ /r:provider.dll /optimize-" cfg.fsc_flags ["test.fsx"] + + peverify cfg "magic.dll" + + peverify cfg "provider.dll" + + peverify cfg "test.exe" + + exec cfg ("." ++ "test.exe") "" + + +[] +[] +[] +[] +[] +[] +[] +[] +[] +[] +[] +[] +[] +[] +[] +[] +[] +[] +[] +[] +[] +[] +[] +[] +[] +[] +[] +let ``negative type provider tests`` (name:string) = + let cfg = testConfig "typeProviders/negTests" + let dir = cfg.Directory + + if requireENCulture () then + + let fileExists = Commands.fileExists dir >> Option.isSome + + rm cfg "provided.dll" + + fsc cfg "--out:provided.dll -a" [".." ++ "helloWorld" ++ "provided.fs"] + + rm cfg "providedJ.dll" + + fsc cfg "--out:providedJ.dll -a" [".." ++ "helloWorld" ++ "providedJ.fs"] + + rm cfg "providedK.dll" + + fsc cfg "--out:providedK.dll -a" [".." ++ "helloWorld" ++ "providedK.fs"] + + rm cfg "provider.dll" + + fsc cfg "--out:provider.dll -a" ["provider.fsx"] + + fsc cfg "--out:provider_providerAttributeErrorConsume.dll -a" ["providerAttributeError.fsx"] + + fsc cfg "--out:provider_ProviderAttribute_EmptyConsume.dll -a" ["providerAttribute_Empty.fsx"] + + rm cfg "helloWorldProvider.dll" + + fsc cfg "--out:helloWorldProvider.dll -a" [".." ++ "helloWorld" ++ "provider.fsx"] + + rm cfg "MostBasicProvider.dll" + + fsc cfg "--out:MostBasicProvider.dll -a" ["MostBasicProvider.fsx"] + + let preprocess name pref = + let dirp = (dir |> Commands.pathAddBackslash) + do + File.ReadAllText(sprintf "%s%s.%sbslpp" dirp name pref) + .Replace("", getfullpath cfg (sprintf "provider_%s.dll" name)) + .Replace("",sprintf "file:///%s" dirp) + |> fun txt -> File.WriteAllText(sprintf "%s%s.%sbsl" dirp name pref,txt) + + if name = "ProviderAttribute_EmptyConsume" || name = "providerAttributeErrorConsume" then () + else fsc cfg "--define:%s --out:provider_%s.dll -a" name name ["provider.fsx"] + + if fileExists (sprintf "%s.bslpp" name) then preprocess name "" + + if fileExists (sprintf "%s.vsbslpp" name) then preprocess name "vs" + + SingleTest.singleNegTest cfg name + +[] +let splitAssembly () = + let cfg = testConfig "typeProviders/splitAssembly" + + fsc cfg "--out:provider.dll -a" ["provider.fs"] + + fsc cfg "--out:providerDesigner.dll -a" ["providerDesigner.fsx"] + + SingleTest.singleTestBuildAndRunAux cfg FSC_BASIC + +[] +let wedgeAssembly () = + let cfg = testConfig "typeProviders/wedgeAssembly" + + rm cfg "provider.dll" + + rm cfg "provided.dll" + + fsc cfg "%s" "--out:provided.dll -a" [".." ++ "helloWorld" ++ "provided.fs"] + + rm cfg "providedJ.dll" + + fsc cfg "%s" "--out:providedJ.dll -a" [".." ++ "helloWorld" ++ "providedJ.fs"] + + rm cfg "providedK.dll" + + fsc cfg "%s" "--out:providedK.dll -a" [".." ++ "helloWorld" ++ "providedK.fs"] + + fsc cfg "%s" "--out:provider.dll -a" [".." ++ "helloWorld" ++ "provider.fsx"] + + fsc cfg "%s --debug+ -r:provider.dll --optimize- -o:test2a.dll -a" cfg.fsc_flags ["test2a.fs"] + + fsc cfg "%s --debug+ -r:provider.dll --optimize- -o:test2b.dll -a" cfg.fsc_flags ["test2b.fs"] + + fsc cfg "%s --debug+ -r:provider.dll --optimize- -o:test3.exe" cfg.fsc_flags ["test3.fsx"] + + fsc cfg "%s --debug+ -r:provider.dll --optimize- -o:test2a-with-sig.dll -a" cfg.fsc_flags ["test2a.fsi"; "test2a.fs"] + + fsc cfg "%s --debug+ -r:provider.dll --optimize- -o:test2b-with-sig.dll -a" cfg.fsc_flags ["test2b.fsi"; "test2b.fs"] + + fsc cfg "%s --debug+ -r:provider.dll --optimize- -o:test3-with-sig.exe --define:SIGS" cfg.fsc_flags ["test3.fsx"] + + fsc cfg "%s --debug+ -r:provider.dll --optimize- -o:test2a-with-sig-restricted.dll -a" cfg.fsc_flags ["test2a-restricted.fsi"; "test2a.fs"] + + fsc cfg "%s --debug+ -r:provider.dll --optimize- -o:test2b-with-sig-restricted.dll -a"cfg.fsc_flags ["test2b-restricted.fsi"; "test2b.fs"] + + fsc cfg "%s --debug+ -r:provider.dll --optimize- -o:test3-with-sig-restricted.exe --define:SIGS_RESTRICTED" cfg.fsc_flags ["test3.fsx"] + + peverify cfg "test2a.dll" + + peverify cfg "test2b.dll" + + peverify cfg "test3.exe" + + exec cfg ("." ++ "test3.exe") "" diff --git a/tests/fsharp/single-test.fs b/tests/fsharp/single-test.fs index dd4b42e0a4a..0d4d71a119f 100644 --- a/tests/fsharp/single-test.fs +++ b/tests/fsharp/single-test.fs @@ -182,25 +182,24 @@ let singleNegTest (cfg: TestConfig) testname = fscAppendErrExpectFail cfg (sprintf "%s.err" testname) """%s --vserrors --warnaserror --nologo --maxerrors:10000 -a -o:%s.dll""" cfg.fsc_flags testname sources - let testnameDiff = fsdiff cfg (sprintf "%s.err" testname) (sprintf "%s.bsl" testname) - - match testnameDiff with - | "" -> () - | l -> - log "***** %s.err %s.bsl differed: a bug or baseline may need updating" testname testname - failwithf "%s.err %s.bsl differ; %A" testname testname l - - log "Good, output %s.err matched %s.bsl" testname testname + let diff = fsdiff cfg (sprintf "%s.err" testname) (sprintf "%s.bsl" testname) fscAppendErrExpectFail cfg (sprintf "%s.vserr" testname) "%s --test:ContinueAfterParseFailure --vserrors --warnaserror --nologo --maxerrors:10000 -a -o:%s.dll" cfg.fsc_flags testname sources - let testnameDiff = fsdiff cfg (sprintf "%s.vserr" testname) VSBSLFILE + let vbslDiff = fsdiff cfg (sprintf "%s.vserr" testname) VSBSLFILE - match testnameDiff with - | "" -> () - | l -> + match diff,vbslDiff with + | "","" -> + log "Good, output %s.err matched %s.bsl" testname testname + log "Good, output %s.vserr matched %s" testname VSBSLFILE + | l,"" -> + log "***** %s.err %s.bsl differed: a bug or baseline may need updating" testname testname + failwithf "%s.err %s.bsl differ; %A" testname testname l + | "",l -> + log "Good, output %s.err matched %s.bsl" testname testname log "***** %s.vserr %s differed: a bug or baseline may need updating" testname VSBSLFILE failwithf "%s.vserr %s differ; %A" testname VSBSLFILE l - - log "Good, output %s.vserr matched %s" testname VSBSLFILE - + | l1,l2 -> + log "***** %s.err %s.bsl differed: a bug or baseline may need updating" testname testname + log "***** %s.vserr %s differed: a bug or baseline may need updating" testname VSBSLFILE + failwithf "%s.err %s.bsl differ; %A; %s.vserr %s differ; %A" testname testname l1 testname VSBSLFILE l2 diff --git a/tests/fsharp/test-framework.fs b/tests/fsharp/test-framework.fs index f18bcc14abe..43088301a7e 100644 --- a/tests/fsharp/test-framework.fs +++ b/tests/fsharp/test-framework.fs @@ -485,7 +485,7 @@ let fsdiff cfg a b = let expectedFile = System.IO.Path.Combine(cfg.Directory, b) let errorText = System.IO.File.ReadAllText (System.IO.Path.Combine(cfg.Directory, a)) - let result = diff false actualFile expectedFile + let result = diff false expectedFile actualFile if result <> "" then log "%s" result log "New error file:" diff --git a/tests/fsharp/tests.fs b/tests/fsharp/tests.fs index f03632ef36c..7215332f42c 100644 --- a/tests/fsharp/tests.fs +++ b/tests/fsharp/tests.fs @@ -1699,375 +1699,135 @@ module TypecheckTests = let cfg = testConfig "typecheck/sigs" fsc cfg "%s -a -o:pos05.dll" cfg.fsc_flags ["pos05.fs"] - let negGroup negs = + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + let ``type check signatures`` (groupName:string,testName:string) = + log "Group: %s" groupName let cfg = testConfig "typecheck/sigs" - for n in negs do singleNegTest cfg n - - [] - let ``sigs neg group1`` () = negGroup ["neg97"] - - [] - let ``sigs neg group1a`` () = negGroup ["neg96"; ] - - [] - let ``sigs neg group1b`` () = negGroup ["neg93"; ] - - [] - let ``sigs neg group1c`` () = negGroup [ "neg91" ] - - [] - let ``sigs neg group1d`` () = negGroup ["neg92" ] - - [] - let ``sigs neg group1e`` () = negGroup ["neg94"; ] - - [] - let ``sigs neg group1f`` () = negGroup ["neg95"; ] - - [] - let ``sigs neg group2`` () = negGroup ["neg90"; "neg89"; ] - - [] - let ``sigs neg group2a`` () = negGroup ["neg88"; "neg35" ] - - [] - let ``sigs neg group3`` () = negGroup ["neg87"; "neg86"; "neg85"; "neg84"; "neg83"; "neg82"; ] - - [] - let ``sigs neg group3a`` () = negGroup [ "neg81"; "neg80"; "neg79"; "neg78"; "neg77"; "neg76"; "neg75"; ] - - [] - let ``sigs neg group4`` () = negGroup ["neg74"; "neg73"; "neg72"; "neg71"; "neg70"; "neg68"; ] - - [] - let ``sigs neg group4a`` () = negGroup ["neg69"; ] - - [] - let ``sigs neg group4b`` () = negGroup [ "neg64"; "neg61"; "neg63"; ] - - [] - let ``sigs neg group4c`` () = negGroup [ "neg67"; "neg66"; "neg65" ] - - [] - let ``sigs neg group5`` () = negGroup ["neg60"; "neg59"; "neg58"; "neg57"; "neg56"; "neg56_a"; "neg56_b" ] - - [] - let ``sigs neg group5a`` () = negGroup ["neg62"; "neg20"; "neg24"; "neg32"; "neg37"; "neg37_a"; ] - - [] - let ``sigs neg group6`` () = negGroup ["neg49"; "neg48"; "neg47"; "neg46"; "neg10"; "neg10_a"; "neg45"; ] - - [] - let ``sigs neg group6a`` () = negGroup ["neg55"; "neg54"; "neg53"; "neg52"; "neg51"; "neg50"; ] - - [] - let ``sigs neg group7`` () = negGroup ["neg44"; "neg43"; "neg38"; "neg39"; "neg40"; "neg41"; "neg42"] - - [] - let ``sigs neg group8`` () = negGroup ["neg34"; "neg33"; "neg30"; "neg31" ] - - [] - let ``sigs neg group8a`` () = negGroup ["neg29"; "neg28"; "neg07"; "neg_byref_20"; ] - - [] - let ``sigs neg group9`` () = negGroup [ "neg_byref_1"; "neg_byref_2"; "neg_byref_3"; "neg_byref_4"; ] - - [] - let ``sigs neg group9a`` () = negGroup [ "neg_byref_5"; "neg_byref_6"; "neg_byref_7"; "neg_byref_8"; ] - - [] - let ``sigs neg group10`` () = negGroup ["neg_byref_10"; "neg_byref_11"; "neg_byref_12"; "neg_byref_13"; "neg_byref_14"; "neg_byref_15"; "neg_byref_16"; ] - - [] - let ``sigs neg group11`` () = negGroup [ "neg_byref_17"; "neg_byref_18"; "neg_byref_19"; "neg_byref_21"; "neg_byref_22"; "neg_byref_23"; "neg36"; "neg17"; "neg26"; ] - - [] - let ``sigs neg group12`` () = negGroup [ "neg27"; "neg25"; "neg03"; "neg23"; "neg22"; "neg21" ] - - [] - let ``sigs neg group12a`` () = negGroup [ "neg04"; "neg05"; "neg06"; "neg06_a"; "neg06_b"; "neg08"; "neg09"; ] - - [] - let ``sigs neg group13`` () = negGroup [ "neg11"; "neg12"; "neg13"; "neg14"; "neg16" ] - - [] - let ``sigs neg group13a`` () = negGroup [ "neg18"; "neg19"; "neg01"; "neg02"; "neg15" ] - -module TypeProviders = - - [] - let diamondAssembly () = - let cfg = testConfig "typeProviders/diamondAssembly" - - rm cfg "provider.dll" - - fsc cfg "%s" "--out:provided.dll -a" [".." ++ "helloWorld" ++ "provided.fs"] - - fsc cfg "%s" "--out:provider.dll -a" [".." ++ "helloWorld" ++ "provider.fsx"] - - fsc cfg "%s --debug+ -r:provider.dll --optimize- -o:test1.dll -a" cfg.fsc_flags ["test1.fsx"] - - fsc cfg "%s --debug+ -r:provider.dll --optimize- -o:test2a.dll -a -r:test1.dll" cfg.fsc_flags ["test2a.fsx"] - - fsc cfg "%s --debug+ -r:provider.dll --optimize- -o:test2b.dll -a -r:test1.dll" cfg.fsc_flags ["test2b.fsx"] - - fsc cfg "%s --debug+ -r:provider.dll --optimize- -o:test3.exe -r:test1.dll -r:test2a.dll -r:test2b.dll" cfg.fsc_flags ["test3.fsx"] - - peverify cfg "test1.dll" - - peverify cfg "test2a.dll" - - peverify cfg "test2b.dll" - - peverify cfg "test3.exe" - - exec cfg ("." ++ "test3.exe") "" - - use testOkFile = fileguard cfg "test.ok" - - fsi cfg "%s" cfg.fsi_flags ["test3.fsx"] - - testOkFile.CheckExists() - - [] - let globalNamespace () = - let cfg = testConfig "typeProviders/globalNamespace" - - csc cfg """/out:globalNamespaceTP.dll /debug+ /target:library /r:"%s" """ cfg.FSCOREDLLPATH ["globalNamespaceTP.cs"] - - fsc cfg "%s /debug+ /r:globalNamespaceTP.dll /optimize-" cfg.fsc_flags ["test.fsx"] - - let helloWorld p = - let cfg = testConfig "typeProviders/helloWorld" - - fsc cfg "%s" "--out:provided1.dll -g -a" [".." ++ "helloWorld" ++ "provided.fs"] - - fsc cfg "%s" "--out:provided2.dll -g -a" [".." ++ "helloWorld" ++ "provided.fs"] - - fsc cfg "%s" "--out:provided3.dll -g -a" [".." ++ "helloWorld" ++ "provided.fs"] - - fsc cfg "%s" "--out:provided4.dll -g -a" [".." ++ "helloWorld" ++ "provided.fs"] - - fsc cfg "%s" "--out:providedJ.dll -g -a" [".." ++ "helloWorld" ++ "providedJ.fs"] - - fsc cfg "%s" "--out:providedK.dll -g -a" [".." ++ "helloWorld" ++ "providedK.fs"] - - fsc cfg "%s" "--out:providedNullAssemblyName.dll -g -a" [".." ++ "helloWorld" ++ "providedNullAssemblyName.fsx"] - - fsc cfg "--out:provided.dll -a" [".." ++ "helloWorld" ++ "provided.fs"] - - fsc cfg "--out:providedJ.dll -a" [".." ++ "helloWorld" ++ "providedJ.fs"] - - fsc cfg "--out:providedK.dll -a" [".." ++ "helloWorld" ++ "providedK.fs"] - - fsc cfg "--out:provider.dll -a" ["provider.fsx"] - - SingleTest.singleTestBuildAndRunAux cfg p - - - rm cfg "provider_with_binary_compat_changes.dll" - - mkdir cfg "bincompat1" - - log "pushd bincompat1" - let bincompat1 = getfullpath cfg "bincompat1" - - Directory.EnumerateFiles(bincompat1 ++ "..", "*.dll") - |> Seq.iter (fun from -> Commands.copy_y bincompat1 from ("." ++ Path.GetFileName(from)) |> ignore) - - fscIn cfg bincompat1 "%s" "-g -a -o:test_lib.dll -r:provider.dll" [".." ++ "test.fsx"] - - fscIn cfg bincompat1 "%s" "-r:test_lib.dll -r:provider.dll" [".." ++ "testlib_client.fsx"] - - log "popd" - - mkdir cfg "bincompat2" - - log "pushd bincompat2" - let bincompat2 = getfullpath cfg "bincompat2" - - Directory.EnumerateFiles(bincompat2 ++ ".." ++ "bincompat1", "*.dll") - |> Seq.iter (fun from -> Commands.copy_y bincompat2 from ("." ++ Path.GetFileName(from)) |> ignore) - - fscIn cfg bincompat2 "%s" "--define:ADD_AN_OPTIONAL_STATIC_PARAMETER --define:USE_IMPLICIT_ITypeProvider2 --out:provider.dll -g -a" [".." ++ "provider.fsx"] - - fscIn cfg bincompat2 "-g -a -o:test_lib_recompiled.dll -r:provider.dll" [".." ++ "test.fsx"] - - fscIn cfg bincompat2 "%s" "--define:ADD_AN_OPTIONAL_STATIC_PARAMETER -r:test_lib.dll -r:provider.dll" [".." ++ "testlib_client.fsx"] - - peverify cfg (bincompat2 ++ "provider.dll") - - peverify cfg (bincompat2 ++ "test_lib.dll") - - peverify cfg (bincompat2 ++ "test_lib_recompiled.dll") - - peverify cfg (bincompat2 ++ "testlib_client.exe") - - [] - let ``helloWorld fsc`` () = helloWorld FSC_BASIC - - [] - let ``helloWorld fsi`` () = helloWorld FSI_STDIN - - - [] - let helloWorldCSharp () = - let cfg = testConfig "typeProviders/helloWorldCSharp" - - rm cfg "magic.dll" - - fsc cfg "%s" "--out:magic.dll -a --keyfile:magic.snk" ["magic.fs "] - - rm cfg "provider.dll" - - csc cfg """/out:provider.dll /target:library "/r:%s" /r:magic.dll""" cfg.FSCOREDLLPATH ["provider.cs"] - - fsc cfg "%s /debug+ /r:provider.dll /optimize-" cfg.fsc_flags ["test.fsx"] - - peverify cfg "magic.dll" - - peverify cfg "provider.dll" - - peverify cfg "test.exe" - - exec cfg ("." ++ "test.exe") "" - - - - - let testsSimple = - ["neg2h"; "neg4"; "neg1"; "neg1_a"; "neg2"; "neg2c"; "neg2e"; "neg2g"; "neg6"] - @ ["InvalidInvokerExpression"; "providerAttributeErrorConsume"; "ProviderAttribute_EmptyConsume"] - - let testsWithDefine = [ - "EVIL_PROVIDER_GetNestedNamespaces_Exception"; - "EVIL_PROVIDER_NamespaceName_Exception"; - "EVIL_PROVIDER_NamespaceName_Empty"; - "EVIL_PROVIDER_GetTypes_Exception"; - "EVIL_PROVIDER_ResolveTypeName_Exception"; - "EVIL_PROVIDER_GetNamespaces_Exception"; - "EVIL_PROVIDER_GetStaticParameters_Exception"; - "EVIL_PROVIDER_GetInvokerExpression_Exception"; - "EVIL_PROVIDER_GetTypes_Null"; - "EVIL_PROVIDER_ResolveTypeName_Null"; - "EVIL_PROVIDER_GetNamespaces_Null"; - "EVIL_PROVIDER_GetStaticParameters_Null"; - "EVIL_PROVIDER_GetInvokerExpression_Null"; - "EVIL_PROVIDER_DoesNotHaveConstructor"; - "EVIL_PROVIDER_ConstructorThrows"; - "EVIL_PROVIDER_ReturnsTypeWithIncorrectNameFromApplyStaticArguments" ] - - - [] - let negTests () = - for name in (testsSimple @ testsWithDefine) do - let cfg = testConfig "typeProviders/negTests" - let dir = cfg.Directory - - if requireENCulture () then - - let fileExists = Commands.fileExists dir >> Option.isSome - - rm cfg "provided.dll" - - fsc cfg "--out:provided.dll -a" [".." ++ "helloWorld" ++ "provided.fs"] - - rm cfg "providedJ.dll" - - fsc cfg "--out:providedJ.dll -a" [".." ++ "helloWorld" ++ "providedJ.fs"] - - rm cfg "providedK.dll" - - fsc cfg "--out:providedK.dll -a" [".." ++ "helloWorld" ++ "providedK.fs"] - - rm cfg "provider.dll" - - fsc cfg "--out:provider.dll -a" ["provider.fsx"] - - fsc cfg "--out:provider_providerAttributeErrorConsume.dll -a" ["providerAttributeError.fsx"] - - fsc cfg "--out:provider_ProviderAttribute_EmptyConsume.dll -a" ["providerAttribute_Empty.fsx"] - - rm cfg "helloWorldProvider.dll" - - fsc cfg "--out:helloWorldProvider.dll -a" [".." ++ "helloWorld" ++ "provider.fsx"] - - rm cfg "MostBasicProvider.dll" - - fsc cfg "--out:MostBasicProvider.dll -a" ["MostBasicProvider.fsx"] - - let preprocess name pref = - let dirp = (dir |> Commands.pathAddBackslash) - do - File.ReadAllText(sprintf "%s%s.%sbslpp" dirp name pref) - .Replace("", getfullpath cfg (sprintf "provider_%s.dll" name)) - .Replace("",sprintf "file:///%s" dirp) - |> fun txt -> File.WriteAllText(sprintf "%s%s.%sbsl" dirp name pref,txt) - - if name = "ProviderAttribute_EmptyConsume" || name = "providerAttributeErrorConsume" then () - else fsc cfg "--define:%s --out:provider_%s.dll -a" name name ["provider.fsx"] - - if fileExists (sprintf "%s.bslpp" name) then preprocess name "" - - if fileExists (sprintf "%s.vsbslpp" name) then preprocess name "vs" - - SingleTest.singleNegTest cfg name - - [] - let splitAssembly () = - let cfg = testConfig "typeProviders/splitAssembly" - - fsc cfg "--out:provider.dll -a" ["provider.fs"] - - fsc cfg "--out:providerDesigner.dll -a" ["providerDesigner.fsx"] - - SingleTest.singleTestBuildAndRunAux cfg FSC_BASIC - - [] - let wedgeAssembly () = - let cfg = testConfig "typeProviders/wedgeAssembly" - - rm cfg "provider.dll" - - rm cfg "provided.dll" - - fsc cfg "%s" "--out:provided.dll -a" [".." ++ "helloWorld" ++ "provided.fs"] - - rm cfg "providedJ.dll" - - fsc cfg "%s" "--out:providedJ.dll -a" [".." ++ "helloWorld" ++ "providedJ.fs"] - - rm cfg "providedK.dll" - - fsc cfg "%s" "--out:providedK.dll -a" [".." ++ "helloWorld" ++ "providedK.fs"] - - fsc cfg "%s" "--out:provider.dll -a" [".." ++ "helloWorld" ++ "provider.fsx"] - - fsc cfg "%s --debug+ -r:provider.dll --optimize- -o:test2a.dll -a" cfg.fsc_flags ["test2a.fs"] - - fsc cfg "%s --debug+ -r:provider.dll --optimize- -o:test2b.dll -a" cfg.fsc_flags ["test2b.fs"] - - fsc cfg "%s --debug+ -r:provider.dll --optimize- -o:test3.exe" cfg.fsc_flags ["test3.fsx"] - - fsc cfg "%s --debug+ -r:provider.dll --optimize- -o:test2a-with-sig.dll -a" cfg.fsc_flags ["test2a.fsi"; "test2a.fs"] - - fsc cfg "%s --debug+ -r:provider.dll --optimize- -o:test2b-with-sig.dll -a" cfg.fsc_flags ["test2b.fsi"; "test2b.fs"] - - fsc cfg "%s --debug+ -r:provider.dll --optimize- -o:test3-with-sig.exe --define:SIGS" cfg.fsc_flags ["test3.fsx"] - - fsc cfg "%s --debug+ -r:provider.dll --optimize- -o:test2a-with-sig-restricted.dll -a" cfg.fsc_flags ["test2a-restricted.fsi"; "test2a.fs"] - - fsc cfg "%s --debug+ -r:provider.dll --optimize- -o:test2b-with-sig-restricted.dll -a"cfg.fsc_flags ["test2b-restricted.fsi"; "test2b.fs"] - - fsc cfg "%s --debug+ -r:provider.dll --optimize- -o:test3-with-sig-restricted.exe --define:SIGS_RESTRICTED" cfg.fsc_flags ["test3.fsx"] - - peverify cfg "test2a.dll" - - peverify cfg "test2b.dll" - - peverify cfg "test3.exe" - - exec cfg ("." ++ "test3.exe") "" + singleNegTest cfg testName module FscTests = []