diff --git a/tests/fsharp/FSharp.Tests.FSharpSuite.fsproj b/tests/fsharp/FSharp.Tests.FSharpSuite.fsproj
index 0efd720bfe..1c52cbf48f 100644
--- a/tests/fsharp/FSharp.Tests.FSharpSuite.fsproj
+++ b/tests/fsharp/FSharp.Tests.FSharpSuite.fsproj
@@ -37,12 +37,21 @@
+
+
+ $(FSharpSourcesRoot)\..\packages\System.Collections.Immutable.$(SystemCollectionsImmutableVersion)\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll
+ True
+
+
+ $(FSharpSourcesRoot)\..\packages\System.Reflection.Metadata.1.4.2\lib\portable-net45+win8\System.Reflection.Metadata.dll
+ True
+
..\..\packages\NUnit.3.5.0\lib\net45\nunit.framework.dll
True
diff --git a/tests/fsharp/app.config b/tests/fsharp/app.config
new file mode 100644
index 0000000000..bd1c9c33df
--- /dev/null
+++ b/tests/fsharp/app.config
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/fsharp/core/signedtests/test-sha1-delay-attributes.bsl b/tests/fsharp/core/signedtests/test-sha1-delay-attributes.bsl
deleted file mode 100644
index 8e2f27b61d..0000000000
--- a/tests/fsharp/core/signedtests/test-sha1-delay-attributes.bsl
+++ /dev/null
@@ -1,4 +0,0 @@
-sn -q stops all output except error messages
-if the output is a valid file no output is produced.
-delay-signed and unsigned produce error messages.
-test-sha1-delay-attributes.exe is a delay-signed or test-signed assembly
diff --git a/tests/fsharp/core/signedtests/test-sha1-delay-cl.bsl b/tests/fsharp/core/signedtests/test-sha1-delay-cl.bsl
deleted file mode 100644
index 3274baa6b1..0000000000
--- a/tests/fsharp/core/signedtests/test-sha1-delay-cl.bsl
+++ /dev/null
@@ -1,4 +0,0 @@
-sn -q stops all output except error messages
-if the output is a valid file no output is produced.
-delay-signed and unsigned produce error messages.
-test-sha1-delay-cl.exe is a delay-signed or test-signed assembly
diff --git a/tests/fsharp/core/signedtests/test-sha1-full-attributes.bsl b/tests/fsharp/core/signedtests/test-sha1-full-attributes.bsl
deleted file mode 100644
index cb14d8045b..0000000000
--- a/tests/fsharp/core/signedtests/test-sha1-full-attributes.bsl
+++ /dev/null
@@ -1,3 +0,0 @@
-sn -q stops all output except error messages
-if the output is a valid file no output is produced.
-delay-signed and unsigned produce error messages.
diff --git a/tests/fsharp/core/signedtests/test-sha1-full-cl.bsl b/tests/fsharp/core/signedtests/test-sha1-full-cl.bsl
deleted file mode 100644
index cb14d8045b..0000000000
--- a/tests/fsharp/core/signedtests/test-sha1-full-cl.bsl
+++ /dev/null
@@ -1,3 +0,0 @@
-sn -q stops all output except error messages
-if the output is a valid file no output is produced.
-delay-signed and unsigned produce error messages.
diff --git a/tests/fsharp/core/signedtests/test-sha1024-delay-attributes.bsl b/tests/fsharp/core/signedtests/test-sha1024-delay-attributes.bsl
deleted file mode 100644
index 27f1e41f67..0000000000
--- a/tests/fsharp/core/signedtests/test-sha1024-delay-attributes.bsl
+++ /dev/null
@@ -1,4 +0,0 @@
-sn -q stops all output except error messages
-if the output is a valid file no output is produced.
-delay-signed and unsigned produce error messages.
-test-sha1024-delay-attributes.exe is a delay-signed or test-signed assembly
diff --git a/tests/fsharp/core/signedtests/test-sha1024-delay-cl.bsl b/tests/fsharp/core/signedtests/test-sha1024-delay-cl.bsl
deleted file mode 100644
index 92eac8caa1..0000000000
--- a/tests/fsharp/core/signedtests/test-sha1024-delay-cl.bsl
+++ /dev/null
@@ -1,4 +0,0 @@
-sn -q stops all output except error messages
-if the output is a valid file no output is produced.
-delay-signed and unsigned produce error messages.
-test-sha1024-delay-cl.exe is a delay-signed or test-signed assembly
diff --git a/tests/fsharp/core/signedtests/test-sha1024-full-attributes.bsl b/tests/fsharp/core/signedtests/test-sha1024-full-attributes.bsl
deleted file mode 100644
index cb14d8045b..0000000000
--- a/tests/fsharp/core/signedtests/test-sha1024-full-attributes.bsl
+++ /dev/null
@@ -1,3 +0,0 @@
-sn -q stops all output except error messages
-if the output is a valid file no output is produced.
-delay-signed and unsigned produce error messages.
diff --git a/tests/fsharp/core/signedtests/test-sha1024-full-cl.bsl b/tests/fsharp/core/signedtests/test-sha1024-full-cl.bsl
deleted file mode 100644
index cb14d8045b..0000000000
--- a/tests/fsharp/core/signedtests/test-sha1024-full-cl.bsl
+++ /dev/null
@@ -1,3 +0,0 @@
-sn -q stops all output except error messages
-if the output is a valid file no output is produced.
-delay-signed and unsigned produce error messages.
diff --git a/tests/fsharp/core/signedtests/test-sha1024-public-cl.bsl b/tests/fsharp/core/signedtests/test-sha1024-public-cl.bsl
deleted file mode 100644
index 71f422b517..0000000000
--- a/tests/fsharp/core/signedtests/test-sha1024-public-cl.bsl
+++ /dev/null
@@ -1,4 +0,0 @@
-sn -q stops all output except error messages
-if the output is a valid file no output is produced.
-delay-signed and unsigned produce error messages.
-Failed to verify assembly -- Strong name validation failed.
diff --git a/tests/fsharp/core/signedtests/test-sha256-delay-attributes.bsl b/tests/fsharp/core/signedtests/test-sha256-delay-attributes.bsl
deleted file mode 100644
index 3b25e77f94..0000000000
--- a/tests/fsharp/core/signedtests/test-sha256-delay-attributes.bsl
+++ /dev/null
@@ -1,4 +0,0 @@
-sn -q stops all output except error messages
-if the output is a valid file no output is produced.
-delay-signed and unsigned produce error messages.
-test-sha256-delay-attributes.exe is a delay-signed or test-signed assembly
diff --git a/tests/fsharp/core/signedtests/test-sha256-delay-cl.bsl b/tests/fsharp/core/signedtests/test-sha256-delay-cl.bsl
deleted file mode 100644
index cd76931846..0000000000
--- a/tests/fsharp/core/signedtests/test-sha256-delay-cl.bsl
+++ /dev/null
@@ -1,4 +0,0 @@
-sn -q stops all output except error messages
-if the output is a valid file no output is produced.
-delay-signed and unsigned produce error messages.
-test-sha256-delay-cl.exe is a delay-signed or test-signed assembly
diff --git a/tests/fsharp/core/signedtests/test-sha256-full-attributes.bsl b/tests/fsharp/core/signedtests/test-sha256-full-attributes.bsl
deleted file mode 100644
index cb14d8045b..0000000000
--- a/tests/fsharp/core/signedtests/test-sha256-full-attributes.bsl
+++ /dev/null
@@ -1,3 +0,0 @@
-sn -q stops all output except error messages
-if the output is a valid file no output is produced.
-delay-signed and unsigned produce error messages.
diff --git a/tests/fsharp/core/signedtests/test-sha256-full-cl.bsl b/tests/fsharp/core/signedtests/test-sha256-full-cl.bsl
deleted file mode 100644
index cb14d8045b..0000000000
--- a/tests/fsharp/core/signedtests/test-sha256-full-cl.bsl
+++ /dev/null
@@ -1,3 +0,0 @@
-sn -q stops all output except error messages
-if the output is a valid file no output is produced.
-delay-signed and unsigned produce error messages.
diff --git a/tests/fsharp/core/signedtests/test-sha512-delay-attributes.bsl b/tests/fsharp/core/signedtests/test-sha512-delay-attributes.bsl
deleted file mode 100644
index 1aef8fa382..0000000000
--- a/tests/fsharp/core/signedtests/test-sha512-delay-attributes.bsl
+++ /dev/null
@@ -1,4 +0,0 @@
-sn -q stops all output except error messages
-if the output is a valid file no output is produced.
-delay-signed and unsigned produce error messages.
-test-sha512-delay-attributes.exe is a delay-signed or test-signed assembly
diff --git a/tests/fsharp/core/signedtests/test-sha512-delay-cl.bsl b/tests/fsharp/core/signedtests/test-sha512-delay-cl.bsl
deleted file mode 100644
index 5e6f979587..0000000000
--- a/tests/fsharp/core/signedtests/test-sha512-delay-cl.bsl
+++ /dev/null
@@ -1,4 +0,0 @@
-sn -q stops all output except error messages
-if the output is a valid file no output is produced.
-delay-signed and unsigned produce error messages.
-test-sha512-delay-cl.exe is a delay-signed or test-signed assembly
diff --git a/tests/fsharp/core/signedtests/test-sha512-full-attributes.bsl b/tests/fsharp/core/signedtests/test-sha512-full-attributes.bsl
deleted file mode 100644
index cb14d8045b..0000000000
--- a/tests/fsharp/core/signedtests/test-sha512-full-attributes.bsl
+++ /dev/null
@@ -1,3 +0,0 @@
-sn -q stops all output except error messages
-if the output is a valid file no output is produced.
-delay-signed and unsigned produce error messages.
diff --git a/tests/fsharp/core/signedtests/test-sha512-full-cl.bsl b/tests/fsharp/core/signedtests/test-sha512-full-cl.bsl
deleted file mode 100644
index cb14d8045b..0000000000
--- a/tests/fsharp/core/signedtests/test-sha512-full-cl.bsl
+++ /dev/null
@@ -1,3 +0,0 @@
-sn -q stops all output except error messages
-if the output is a valid file no output is produced.
-delay-signed and unsigned produce error messages.
diff --git a/tests/fsharp/core/signedtests/test-unsigned.bsl b/tests/fsharp/core/signedtests/test-unsigned.bsl
deleted file mode 100644
index 374becacaa..0000000000
--- a/tests/fsharp/core/signedtests/test-unsigned.bsl
+++ /dev/null
@@ -1,4 +0,0 @@
-sn -q stops all output except error messages
-if the output is a valid file no output is produced.
-delay-signed and unsigned produce error messages.
-test-unsigned.exe does not represent a strongly named assembly
diff --git a/tests/fsharp/packages.config b/tests/fsharp/packages.config
index 3b0ea1fe3f..95311a04cc 100644
--- a/tests/fsharp/packages.config
+++ b/tests/fsharp/packages.config
@@ -1,4 +1,6 @@
+
+
\ No newline at end of file
diff --git a/tests/fsharp/test-framework.fs b/tests/fsharp/test-framework.fs
index 6b9a795ca6..15188de84f 100644
--- a/tests/fsharp/test-framework.fs
+++ b/tests/fsharp/test-framework.fs
@@ -118,7 +118,6 @@ type TestConfig =
FSI_FOR_SCRIPTS : string
fsi_flags : string
ILDASM : string
- SN : string
NGEN : string
PEVERIFY : string
Directory: string
@@ -179,7 +178,6 @@ let config configurationName envVars =
let CSC = requireFile (CORDIR ++ "csc.exe")
let NGEN = requireFile (CORDIR ++ "ngen.exe")
let ILDASM = requireFile (CORSDK ++ "ildasm.exe")
- let SN = requireFile (CORSDK ++ "sn.exe")
let PEVERIFY = requireFile (CORSDK ++ "peverify.exe")
let FSI_FOR_SCRIPTS =
match envVars |> Map.tryFind "_fsiexe" with
@@ -217,7 +215,6 @@ let config configurationName envVars =
FSCBinPath = FSCBinPath |> Commands.pathAddBackslash
FSCOREDLLPATH = FSCOREDLLPATH
ILDASM = ILDASM
- SN = SN
NGEN = NGEN
PEVERIFY = PEVERIFY
CSC = CSC
@@ -452,7 +449,6 @@ let fscAppendErrExpectFail cfg errPath arg = Printf.ksprintf (Commands.fsc cfg.D
let csc cfg arg = Printf.ksprintf (Commands.csc (exec cfg) cfg.CSC) arg
let ildasm cfg arg = Printf.ksprintf (Commands.ildasm (exec cfg) cfg.ILDASM) arg
let peverify cfg = Commands.peverify (exec cfg) cfg.PEVERIFY "/nologo"
-let sn cfg outfile arg = execAppendOutIgnoreExitCode cfg cfg.Directory outfile cfg.SN arg
let peverifyWithArgs cfg args = Commands.peverify (exec cfg) cfg.PEVERIFY args
let fsi cfg = Printf.ksprintf (Commands.fsi (exec cfg) cfg.FSI)
let fsi_script cfg = Printf.ksprintf (Commands.fsi (exec cfg) cfg.FSI_FOR_SCRIPTS)
diff --git a/tests/fsharp/tests.fs b/tests/fsharp/tests.fs
index 81f282abdd..12403565f2 100644
--- a/tests/fsharp/tests.fs
+++ b/tests/fsharp/tests.fs
@@ -11,6 +11,7 @@ module ``FSharp-Tests-Core``
open System
open System.IO
open System.Reflection
+open System.Reflection.PortableExecutable
open NUnit.Framework
open TestFramework
open Scripting
@@ -568,84 +569,88 @@ module CoreTests =
let ``printing-5`` () =
printing "--quiet" "z.output.test.quiet.stdout.txt" "z.output.test.quiet.stdout.bsl" "z.output.test.quiet.stderr.txt" "z.output.test.quiet.stderr.bsl"
+ type SigningType =
+ | DelaySigned
+ | PublicSigned
+ | NotSigned
- let signedtest(args,bslfile) =
+ let signedtest(programId:string, args:string, expectedSigning:SigningType) =
let cfg = testConfig "core/signedtests"
- let cfg = { cfg with fsc_flags=cfg.fsc_flags + " " + args }
-
- let outfile = Path.ChangeExtension(bslfile,"sn.out")
- let exefile = Path.ChangeExtension(bslfile,"exe")
- do File.WriteAllLines(getfullpath cfg outfile,
- ["sn -q stops all output except error messages "
- "if the output is a valid file no output is produced. "
- "delay-signed and unsigned produce error messages. "])
-
- fsc cfg "%s -o:%s" cfg.fsc_flags exefile ["test.fs"]
- sn cfg outfile ("-q -vf "+exefile)
- let diffs = fsdiff cfg outfile bslfile
-
- match diffs with
- | "" -> ()
- | _ -> Assert.Fail (sprintf "'%s' and '%s' differ; %A" outfile bslfile diffs)
+ let newFlags = cfg.fsc_flags + " " + args
+
+ let exefile = programId + ".exe"
+ fsc cfg "%s -o:%s" newFlags exefile ["test.fs"]
+
+ let assemblyPath = Path.Combine(cfg.Directory, exefile)
+ let assemblyName = AssemblyName.GetAssemblyName(assemblyPath)
+ let publicKeyToken = assemblyName.GetPublicKeyToken()
+ let isPublicKeyTokenPresent = not (Array.isEmpty publicKeyToken)
+ use exeStream = new FileStream(assemblyPath, FileMode.Open)
+ let peHeader = PEHeaders(exeStream)
+ let isSigned = peHeader.CorHeader.Flags.HasFlag(CorFlags.StrongNameSigned)
+ let actualSigning =
+ match isSigned, isPublicKeyTokenPresent with
+ | true, true-> SigningType.PublicSigned
+ | true, false -> failwith "unreachable"
+ | false, true -> SigningType.DelaySigned
+ | false, false -> SigningType.NotSigned
+
+ Assert.AreEqual(expectedSigning, actualSigning)
[]
- let ``signedtest-1`` () = signedtest("","test-unsigned.bsl")
+ let ``signedtest-1`` () = signedtest("test-unsigned", "", SigningType.NotSigned)
[]
- let ``signedtest-2`` () = signedtest("--keyfile:sha1full.snk", "test-sha1-full-cl.bsl")
+ let ``signedtest-2`` () = signedtest("test-sha1-full-cl", "--keyfile:sha1full.snk", SigningType.PublicSigned)
[]
- let ``signedtest-3`` () = signedtest("--keyfile:sha256full.snk", "test-sha256-full-cl.bsl")
+ let ``signedtest-3`` () = signedtest("test-sha256-full-cl", "--keyfile:sha256full.snk", SigningType.PublicSigned)
[]
- let ``signedtest-4`` () = signedtest("--keyfile:sha512full.snk", "test-sha512-full-cl.bsl")
+ let ``signedtest-4`` () = signedtest("test-sha512-full-cl", "--keyfile:sha512full.snk", SigningType.PublicSigned)
[]
- let ``signedtest-5`` () = signedtest("--keyfile:sha1024full.snk", "test-sha1024-full-cl.bsl")
+ let ``signedtest-5`` () = signedtest("test-sha1024-full-cl", "--keyfile:sha1024full.snk", SigningType.PublicSigned)
[]
- let ``signedtest-6`` () = signedtest("--keyfile:sha1delay.snk --delaysign", "test-sha1-delay-cl.bsl")
+ let ``signedtest-6`` () = signedtest("test-sha1-delay-cl", "--keyfile:sha1delay.snk --delaysign", SigningType.DelaySigned)
[]
- let ``signedtest-7`` () = signedtest("--keyfile:sha256delay.snk --delaysign", "test-sha256-delay-cl.bsl")
+ let ``signedtest-7`` () = signedtest("test-sha256-delay-cl", "--keyfile:sha256delay.snk --delaysign", SigningType.DelaySigned)
[]
- let ``signedtest-8`` () = signedtest("--keyfile:sha512delay.snk --delaysign", "test-sha512-delay-cl.bsl")
+ let ``signedtest-8`` () = signedtest("test-sha512-delay-cl", "--keyfile:sha512delay.snk --delaysign", SigningType.DelaySigned)
[]
- let ``signedtest-9`` () = signedtest("--keyfile:sha1024delay.snk --delaysign", "test-sha1024-delay-cl.bsl")
+ let ``signedtest-9`` () = signedtest("test-sha1024-delay-cl", "--keyfile:sha1024delay.snk --delaysign", SigningType.DelaySigned)
// Test SHA1 key full signed Attributes
[]
- let ``signedtest-10`` () = signedtest("--define:SHA1","test-sha1-full-attributes.bsl")
+ let ``signedtest-10`` () = signedtest("test-sha1-full-attributes", "--define:SHA1", SigningType.PublicSigned)
// Test SHA1 key delayl signed Attributes
[]
- let ``signedtest-11`` () = signedtest("--keyfile:sha1delay.snk --define:SHA1 --define:DELAY", "test-sha1-delay-attributes.bsl")
+ let ``signedtest-11`` () = signedtest("test-sha1-delay-attributes", "--keyfile:sha1delay.snk --define:SHA1 --define:DELAY", SigningType.DelaySigned)
[]
- let ``signedtest-12`` () = signedtest("--define:SHA256", "test-sha256-full-attributes.bsl")
+ let ``signedtest-12`` () = signedtest("test-sha256-full-attributes", "--define:SHA256", SigningType.PublicSigned)
// Test SHA 256 bit key delay signed Attributes
[]
- let ``signedtest-13`` () = signedtest("--define:SHA256 --define:DELAY", "test-sha256-delay-attributes.bsl")
+ let ``signedtest-13`` () = signedtest("test-sha256-delay-attributes", "--define:SHA256 --define:DELAY", SigningType.DelaySigned)
// Test SHA 512 bit key fully signed Attributes
[]
- let ``signedtest-14`` () = signedtest("--define:SHA512", "test-sha512-full-attributes.bsl")
+ let ``signedtest-14`` () = signedtest("test-sha512-full-attributes", "--define:SHA512", SigningType.PublicSigned)
// Test SHA 512 bit key delay signed Attributes
[]
- let ``signedtest-15`` () = signedtest("--define:SHA512 --define:DELAY", "test-sha512-delay-attributes.bsl")
+ let ``signedtest-15`` () = signedtest("test-sha512-delay-attributes", "--define:SHA512 --define:DELAY", SigningType.DelaySigned)
// Test SHA 1024 bit key fully signed Attributes
[]
- let ``signedtest-16`` () = signedtest("--define:SHA1024", "test-sha1024-full-attributes.bsl")
-
- // Test dumpbin with SHA 1024 bit key public signed CL
- []
- let ``signedtest-17`` () = signedtest("--keyfile:sha1024delay.snk --publicsign", "test-sha1024-public-cl.bsl")
+ let ``signedtest-16`` () = signedtest("test-sha1024-full-attributes", "--define:SHA1024", SigningType.PublicSigned)
#endif
#if !FSHARP_SUITE_DRIVES_CORECLR_TESTS