From 054f1a46dde0db94225f59db0913d9ef8f20dd05 Mon Sep 17 00:00:00 2001 From: Kevin Ransom Date: Thu, 1 Jun 2023 01:23:28 -0700 Subject: [PATCH 1/3] determinismtests --- .../fsc/determinism/PathMap1/pathmap.fs | 0 .../fsc/determinism/PathMap2/pathmap.fs | 0 .../fsc/determinism/binaryCompare.fsx | 0 .../fsc/determinism/copyArtifacts.fsx | 0 .../fsc/determinism/determinism.fs | 141 ++++++++++++++++++ .../determinism/pathmapRequiresPortablePdb.fs | 0 .../fsc/determinism/pathmapValid.fs | 0 .../CompilerOptions/fsc/highentropyva.fs | 8 +- .../FSharp.Compiler.ComponentTests.fsproj | 1 + tests/FSharp.Test.Utilities/Compiler.fs | 66 +++++++- .../DirectoryAttribute.fs | 41 +---- .../CompilerOptions/fsc/determinism/dummy.fs | 3 - .../CompilerOptions/fsc/determinism/env.lst | 45 ------ .../CompilerOptions/fsc/determinism/keep.lst | 1 - .../fsc/determinism/portablePdbOnly.fs | 3 - .../determinism/specificVersionSpecifed.fs | 4 - .../determinism/wildcardVersionSpecifed.fs | 4 - tests/fsharpqa/Source/test.lst | 4 - 18 files changed, 211 insertions(+), 110 deletions(-) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/CompilerOptions/fsc/determinism/PathMap1/pathmap.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/CompilerOptions/fsc/determinism/PathMap2/pathmap.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/CompilerOptions/fsc/determinism/binaryCompare.fsx (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/CompilerOptions/fsc/determinism/copyArtifacts.fsx (100%) create mode 100644 tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/determinism/determinism.fs rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/CompilerOptions/fsc/determinism/pathmapRequiresPortablePdb.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/CompilerOptions/fsc/determinism/pathmapValid.fs (100%) delete mode 100644 tests/fsharpqa/Source/CompilerOptions/fsc/determinism/dummy.fs delete mode 100644 tests/fsharpqa/Source/CompilerOptions/fsc/determinism/env.lst delete mode 100644 tests/fsharpqa/Source/CompilerOptions/fsc/determinism/keep.lst delete mode 100644 tests/fsharpqa/Source/CompilerOptions/fsc/determinism/portablePdbOnly.fs delete mode 100644 tests/fsharpqa/Source/CompilerOptions/fsc/determinism/specificVersionSpecifed.fs delete mode 100644 tests/fsharpqa/Source/CompilerOptions/fsc/determinism/wildcardVersionSpecifed.fs diff --git a/tests/fsharpqa/Source/CompilerOptions/fsc/determinism/PathMap1/pathmap.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/determinism/PathMap1/pathmap.fs similarity index 100% rename from tests/fsharpqa/Source/CompilerOptions/fsc/determinism/PathMap1/pathmap.fs rename to tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/determinism/PathMap1/pathmap.fs diff --git a/tests/fsharpqa/Source/CompilerOptions/fsc/determinism/PathMap2/pathmap.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/determinism/PathMap2/pathmap.fs similarity index 100% rename from tests/fsharpqa/Source/CompilerOptions/fsc/determinism/PathMap2/pathmap.fs rename to tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/determinism/PathMap2/pathmap.fs diff --git a/tests/fsharpqa/Source/CompilerOptions/fsc/determinism/binaryCompare.fsx b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/determinism/binaryCompare.fsx similarity index 100% rename from tests/fsharpqa/Source/CompilerOptions/fsc/determinism/binaryCompare.fsx rename to tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/determinism/binaryCompare.fsx diff --git a/tests/fsharpqa/Source/CompilerOptions/fsc/determinism/copyArtifacts.fsx b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/determinism/copyArtifacts.fsx similarity index 100% rename from tests/fsharpqa/Source/CompilerOptions/fsc/determinism/copyArtifacts.fsx rename to tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/determinism/copyArtifacts.fsx diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/determinism/determinism.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/determinism/determinism.fs new file mode 100644 index 00000000000..492b8501301 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/determinism/determinism.fs @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. +namespace FSharp.Compiler.ComponentTests.CompilerOptions + +open Xunit +open FSharp.Test +open FSharp.Test.Compiler +open System +open System.IO + +module determinism = + + let areSame first second = + let load = System.IO.File.ReadAllBytes + if not ((load first) = (load second)) then + raise (new Exception "Pathmap1 and PathMap2 do not match") + + let compileSource options compilation = + compilation + |> asLibrary + |> withOptionsString options + |> compile + + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + let ``smoketest options`` options = + FSharp """ +module Determinism +""" + |> compileSource options + |> shouldSucceed + + [] + [] + [] + [] + let ``Confirm specific version allowed`` options = + FSharp """ +module Determinism +[] +do() +""" + |> compileSource options + |> shouldSucceed + + [] + [] + let ``Confirm wildcard version allowed`` options = + FSharp """ +module Determinism +[] +do () +""" + |> compileSource options + |> shouldSucceed + + [] + [] + let ``Confirm wildcard version not allowed`` options = + FSharp """ +module Determinism +[] +do () +""" + |> compileSource options + |> shouldFail + |> withDiagnostics [ + (Error 2025, Line 1, Col 1, Line 1, Col 1, "An AssemblyVersionAttribute specified version '2.3.4.*', but this value is a wildcard, and you have requested a deterministic build, these are in conflict.") + ] + + [] + let ``Invalid pathmap value`` () = + FSharp """ +module Determinism +""" + |> compileSource @"--pathmap:C:\NoOtherPath;--debug:embedded" + |> shouldFail + |> withDiagnostics [ + (Error 2028, Line 0, Col 1, Line 0, Col 1, "Invalid path map. Mappings must be comma separated and of the format 'path=sourcePath'") + ] + + [] + let ``pathmap with Embedded Pdbs`` () = + let thisTestDirectory = getTestOutputDirectory __SOURCE_DIRECTORY__ (getCurrentMethodName()) "" + let pathMap1 = + let compilation = + FsFromPath (Path.Combine(__SOURCE_DIRECTORY__, @"PathMap1\pathmap.fs")) + |> withOutputDirectory thisTestDirectory + compilation + |> withOptionsString $"""--pathmap:{compilation.OutputDirectory}\PathMap1=/src,F:\=/etc;--deterministic;--embed;--debug:embedded""" + |> asExe + |> compile + + let pathMap2 = + let compilation = + FsFromPath (Path.Combine(__SOURCE_DIRECTORY__, @"PathMap2\pathmap.fs")) + |> withOutputDirectory thisTestDirectory + compilation + |> withOptionsString $"""--pathmap:{compilation.OutputDirectory}\PathMap2=/src,F:\=/etc;--deterministic;--embed;--debug:embedded""" + |> asExe + |> compile + + match pathMap1.Output.OutputPath, pathMap2.Output.OutputPath with + | Some exename1, Some exename2 -> + areSame exename1 exename2 + | _ -> raise (new Exception "Pathmap1 and PathMap2 do not match") + + [] + let ``pathmap with Portable Pdbs`` () = + let thisTestDirectory = getTestOutputDirectory __SOURCE_DIRECTORY__ (getCurrentMethodName()) "" + let pathMap1 = + let compilation = + FsFromPath (Path.Combine(__SOURCE_DIRECTORY__, @"PathMap1\pathmap.fs")) + |> withOutputDirectory thisTestDirectory + compilation + |> withOptionsString $"""--pathmap:{compilation.OutputDirectory}\PathMap1=/src,F:\=/etc;--deterministic;--embed;--debug:portable""" + |> asExe + |> compile + + let pathMap2 = + let compilation = + FsFromPath (Path.Combine(__SOURCE_DIRECTORY__, @"PathMap2\pathmap.fs")) + |> withOutputDirectory thisTestDirectory + compilation + |> withOptionsString $"""--pathmap:{compilation.OutputDirectory}\PathMap2=/src,F:\=/etc;--deterministic;--embed;--debug:portable""" + |> asExe + |> compile + + match pathMap1.Output.OutputPath, pathMap2.Output.OutputPath with + | Some exename1, Some exename2 -> + areSame exename1 exename2 + areSame (Path.ChangeExtension(exename1, "pdb")) (Path.ChangeExtension(exename2, "pdb")) + | _ -> raise (new Exception "Pathmap1 and PathMap2 do not match") + diff --git a/tests/fsharpqa/Source/CompilerOptions/fsc/determinism/pathmapRequiresPortablePdb.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/determinism/pathmapRequiresPortablePdb.fs similarity index 100% rename from tests/fsharpqa/Source/CompilerOptions/fsc/determinism/pathmapRequiresPortablePdb.fs rename to tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/determinism/pathmapRequiresPortablePdb.fs diff --git a/tests/fsharpqa/Source/CompilerOptions/fsc/determinism/pathmapValid.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/determinism/pathmapValid.fs similarity index 100% rename from tests/fsharpqa/Source/CompilerOptions/fsc/determinism/pathmapValid.fs rename to tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/determinism/pathmapValid.fs diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/highentropyva.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/highentropyva.fs index bef3f6ff8b9..9c205f213a7 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/highentropyva.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/highentropyva.fs @@ -28,11 +28,11 @@ module highentropyva = [] [] [] - let shouldNotGenerateHighEntropyVirtualAddressSpace platform option = + let shouldNotGenerateHighEntropyVirtualAddressSpace platform options = Fs """printfn "Hello, World!!!" """ |> asExe |> withPlatform platform - |> withOptions (if String.IsNullOrWhiteSpace option then [] else [option]) + |> withOptions (if String.IsNullOrWhiteSpace options then [] else [options]) |> compile |> shouldSucceed |> withPeReader(fun rdr -> rdr.PEHeaders.PEHeader.DllCharacteristics) @@ -47,11 +47,11 @@ module highentropyva = [] [] [] - let shouldGenerateHighEntropyVirtualAddressSpace platform option = + let shouldGenerateHighEntropyVirtualAddressSpace platform options = Fs """printfn "Hello, World!!!" """ |> asExe |> withPlatform platform - |> withOptions (if String.IsNullOrWhiteSpace option then [] else [option]) + |> withOptions (if String.IsNullOrWhiteSpace options then [] else [options]) |> compile |> shouldSucceed |> withPeReader(fun rdr -> rdr.PEHeaders.PEHeader.DllCharacteristics) diff --git a/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj b/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj index dcc966aface..1ac6062d5bf 100644 --- a/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj +++ b/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj @@ -213,6 +213,7 @@ + diff --git a/tests/FSharp.Test.Utilities/Compiler.fs b/tests/FSharp.Test.Utilities/Compiler.fs index a4d59f296f7..59cb4faac1a 100644 --- a/tests/FSharp.Test.Utilities/Compiler.fs +++ b/tests/FSharp.Test.Utilities/Compiler.fs @@ -25,7 +25,15 @@ open System.Reflection.PortableExecutable open FSharp.Test.CompilerAssertHelpers open TestFramework +open System.Runtime.CompilerServices +open System.Runtime.InteropServices + + module rec Compiler = + [] + type SourceUtilities () = + static member getCurrentMethodName([] memberName: string) = memberName + type BaselineFile = { FilePath: string @@ -49,6 +57,15 @@ module rec Compiler = | CS of CSharpCompilationSource | IL of ILCompilationSource override this.ToString() = match this with | FS fs -> fs.ToString() | _ -> (sprintf "%A" this ) + member this.OutputDirectory = + let toString diOpt = + match diOpt: DirectoryInfo option with + | Some di -> di.FullName + | None -> "" + match this with + | FS fs -> fs.OutputDirectory |> toString + | CS cs -> cs.OutputDirectory |> toString + | _ -> raise (Exception "Not supported for this compilation type") member this.WithStaticLink(staticLink: bool) = match this with | FS fs -> FS { fs with StaticLink = staticLink } | cu -> cu type FSharpCompilationSource = @@ -191,6 +208,47 @@ module rec Compiler = let private defaultOptions : string list = [] + let normalizePathSeparator (text:string) = text.Replace(@"\", "/") + + let normalizeName name = + let invalidPathChars = Array.concat [Path.GetInvalidPathChars(); [| ':'; '\\'; '/'; ' '; '.' |]] + let result = invalidPathChars |> Array.fold(fun (acc:string) (c:char) -> acc.Replace(string(c), "_")) name + result + + let getTestOutputDirectory dir testCaseName extraDirectory = + // If the executing assembly has 'artifacts\bin' in it's path then we are operating normally in the CI or dev tests + // Thus the output directory will be in a subdirectory below where we are executing. + // The subdirectory will be relative to the source directory containing the test source file, + // E.g + // When the source code is in: + // $(repo-root)\tests\FSharp.Compiler.ComponentTests\Conformance\PseudoCustomAttributes + // and the test is running in the FSharp.Compiler.ComponentTeststest library + // The output directory will be: + // artifacts\bin\FSharp.Compiler.ComponentTests\$(Flavour)\$(TargetFramework)\tests\FSharp.Compiler.ComponentTests\Conformance\PseudoCustomAttributes + // + // If we can't find anything then we execute in the directory containing the source + // + try + let testlibraryLocation = normalizePathSeparator (Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)) + let pos = testlibraryLocation.IndexOf("artifacts/bin",StringComparison.OrdinalIgnoreCase) + if pos > 0 then + // Running under CI or dev build + let testRoot = Path.Combine(testlibraryLocation.Substring(0, pos), @"tests/") + let testSourceDirectory = + let dirInfo = normalizePathSeparator (Path.GetFullPath(dir)) + let testPaths = dirInfo.Replace(testRoot, "").Split('/') + testPaths[0] <- "tests" + Path.Combine(testPaths) + let n = Path.Combine(testlibraryLocation, testSourceDirectory.Trim('/'), normalizeName testCaseName, extraDirectory) + let outputDirectory = new DirectoryInfo(n) + Some outputDirectory + else + raise (new InvalidOperationException($"Failed to find the test output directory:\nTest Library Location: '{testlibraryLocation}'\n Pos: {pos}")) + None + + with | e -> + raise (new InvalidOperationException($" '{e.Message}'. Can't get the location of the executing assembly")) + // Not very safe version of reading stuff from file, but we want to fail fast for now if anything goes wrong. let private getSource (src: TestType) : string = match src with @@ -408,9 +466,13 @@ module rec Compiler = let withOptions (options: string list) (cUnit: CompilationUnit) : CompilationUnit = withOptionsHelper options "withOptions is only supported for F#" cUnit - let withOutputDirectory (path: string) (cUnit: CompilationUnit) : CompilationUnit = + let withOptionsString (options: string) (cUnit: CompilationUnit) : CompilationUnit = + let options = if String.IsNullOrWhiteSpace options then [] else (options.Split([|';'|])) |> Array.toList + withOptionsHelper options "withOptionsString is only supported for F#" cUnit + + let withOutputDirectory (path: DirectoryInfo option) (cUnit: CompilationUnit) : CompilationUnit = match cUnit with - | FS fs -> FS { fs with OutputDirectory = Some (DirectoryInfo(path)) } + | FS fs -> FS { fs with OutputDirectory = path } | _ -> failwith "withOutputDirectory is only supported on F#" let withBufferWidth (width: int)(cUnit: CompilationUnit) : CompilationUnit = diff --git a/tests/FSharp.Test.Utilities/DirectoryAttribute.fs b/tests/FSharp.Test.Utilities/DirectoryAttribute.fs index a02727d6ad2..39b1065fe01 100644 --- a/tests/FSharp.Test.Utilities/DirectoryAttribute.fs +++ b/tests/FSharp.Test.Utilities/DirectoryAttribute.fs @@ -21,47 +21,8 @@ type DirectoryAttribute(dir: string) = if String.IsNullOrWhiteSpace(dir) then invalidArg "dir" "Directory cannot be null, empty or whitespace only." - let normalizePathSeparator (text:string) = text.Replace(@"\", "/") - - let normalizeName name = - let invalidPathChars = Array.concat [Path.GetInvalidPathChars(); [| ':'; '\\'; '/'; ' '; '.' |]] - let result = invalidPathChars |> Array.fold(fun (acc:string) (c:char) -> acc.Replace(string(c), "_")) name - result - let dirInfo = normalizePathSeparator (Path.GetFullPath(dir)) - let outputDirectory methodName extraDirectory = - // If the executing assembly has 'artifacts\bin' in it's path then we are operating normally in the CI or dev tests - // Thus the output directory will be in a subdirectory below where we are executing. - // The subdirectory will be relative to the source directory containing the test source file, - // E.g - // When the source code is in: - // $(repo-root)\tests\FSharp.Compiler.ComponentTests\Conformance\PseudoCustomAttributes - // and the test is running in the FSharp.Compiler.ComponentTeststest library - // The output directory will be: - // artifacts\bin\FSharp.Compiler.ComponentTests\$(Flavour)\$(TargetFramework)\tests\FSharp.Compiler.ComponentTests\Conformance\PseudoCustomAttributes - // - // If we can't find anything then we execute in the directory containing the source - // - try - let testlibraryLocation = normalizePathSeparator (Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)) - let pos = testlibraryLocation.IndexOf("artifacts/bin",StringComparison.OrdinalIgnoreCase) - if pos > 0 then - // Running under CI or dev build - let testRoot = Path.Combine(testlibraryLocation.Substring(0, pos), @"tests/") - let testSourceDirectory = - let testPaths = dirInfo.Replace(testRoot, "").Split('/') - testPaths[0] <- "tests" - Path.Combine(testPaths) - let n = Path.Combine(testlibraryLocation, testSourceDirectory.Trim('/'), normalizeName methodName, extraDirectory) - let outputDirectory = new DirectoryInfo(n) - Some outputDirectory - else - raise (new InvalidOperationException($"Failed to find the test output directory:\nTest Library Location: '{testlibraryLocation}'\n Pos: {pos}")) - None - - with | e -> - raise (new InvalidOperationException($" '{e.Message}'. Can't get the location of the executing assembly")) - + let outputDirectory methodName extraDirectory = getTestOutputDirectory dir methodName extraDirectory let mutable baselineSuffix = "" let mutable includes = Array.empty diff --git a/tests/fsharpqa/Source/CompilerOptions/fsc/determinism/dummy.fs b/tests/fsharpqa/Source/CompilerOptions/fsc/determinism/dummy.fs deleted file mode 100644 index a6ada9f55fa..00000000000 --- a/tests/fsharpqa/Source/CompilerOptions/fsc/determinism/dummy.fs +++ /dev/null @@ -1,3 +0,0 @@ -// #NoMT #CompilerOptions #Deterministic -module TestDeterministicCompilation -exit 0 diff --git a/tests/fsharpqa/Source/CompilerOptions/fsc/determinism/env.lst b/tests/fsharpqa/Source/CompilerOptions/fsc/determinism/env.lst deleted file mode 100644 index 082e76dec6a..00000000000 --- a/tests/fsharpqa/Source/CompilerOptions/fsc/determinism/env.lst +++ /dev/null @@ -1,45 +0,0 @@ -# Path mapping with embedded PDBs - SOURCE=PathMap1\\pathmap.fs SCFLAGS="--pathmap:\$CWD\\PathMap1=/src,F:\\=/etc --deterministic --embed --debug:embedded --out:PathMap1\\pathmap.exe" - SOURCE=PathMap2\\pathmap.fs SCFLAGS="--pathmap:\$CWD\\PathMap2=/src,F:\\=/etc --deterministic --embed --debug:embedded --out:PathMap2\\pathmap.exe" POSTCMD="\$FSI_PIPE --nologo --quiet --exec binaryCompare.fsx PathMap1\\pathmap.exe PathMap2\\pathmap.exe" - -# Path mapping with portable PDBs - SOURCE=PathMap1\\pathmap.fs SCFLAGS="--pathmap:\$CWD\\PathMap1=/src,F:\\=/etc --deterministic --embed --debug:portable --pdb:PathMap1\\pathmap.pdb --out:PathMap1\\pathmap.exe" - SOURCE=PathMap2\\pathmap.fs SCFLAGS="--pathmap:\$CWD\\PathMap2=/src,F:\\=/etc --deterministic --embed --debug:portable --pdb:PathMap2\\pathmap.pdb --out:PathMap2\\pathmap.exe" POSTCMD="\$FSI_PIPE --nologo --quiet --exec binaryCompare.fsx PathMap1\\pathmap.exe PathMap2\\pathmap.exe PathMap1\\pathmap.pdb PathMap2\\pathmap.pdb" - -# Confirm only portable and embedded debug PDBs are supported with pathmap, not full or pdbonly - SOURCE=pathmapRequiresPortablePdb.fs SCFLAGS="--pathmap:C:\\=/ --debug:full" - SOURCE=pathmapRequiresPortablePdb.fs SCFLAGS="--pathmap:C:\\=/ --debug:pdbonly" - -# Pathmap argument requires maps to be of the format 'path=sourcePath' - SOURCE=pathmapValid.fs SCFLAGS="--pathmap:C:\\NoOtherPath --debug:embedded" - -# Sanity check - simply check that the option is valid - SOURCE=dummy.fs SCFLAGS="--deterministic" - SOURCE=dummy.fs SCFLAGS="--deterministic+" - SOURCE=dummy.fs SCFLAGS="--deterministic-" - SOURCE=dummy.fs SCFLAGS="--deterministic" FSIMODE=EXEC COMPILE_ONLY=1 - SOURCE=dummy.fs SCFLAGS="--deterministic+" FSIMODE=EXEC COMPILE_ONLY=1 - SOURCE=dummy.fs SCFLAGS="--deterministic-" FSIMODE=EXEC COMPILE_ONLY=1 - -# Confirm wildcard versions are not allowed - SOURCE=wildcardVersionSpecifed.fs SCFLAGS="--deterministic" - -# Confirm specific versions are allowed - SOURCE=specificVersionSpecifed.fs SCFLAGS="--deterministic" - -# Confirm in normal not-deterministic mode, the same file compiled twice leads to different exes & pdbs -# NOTE: we need to use the timeout because non-determinism in fsc is due to datetime, so we need to guarentee at least 1 sec difference - SOURCE=dummy.fs PRECMD="\$FSC_PIPE dummy.fs && \$FSI_PIPE copyArtifacts.fsx" POSTCMD="\$FSI_PIPE --nologo --quiet --exec binaryCompare.fsx false" - SOURCE=dummy.fs SCFLAGS="--debug:full" PRECMD="\$FSC_PIPE --debug:full dummy.fs && \$FSI_PIPE copyArtifacts.fsx" POSTCMD="\$FSI_PIPE --nologo --quiet --exec binaryCompare.fsx false" - SOURCE=dummy.fs SCFLAGS="--debug:pdbonly" PRECMD="\$FSC_PIPE --debug:pdbonly dummy.fs && \$FSI_PIPE copyArtifacts.fsx" POSTCMD="\$FSI_PIPE --nologo --quiet --exec binaryCompare.fsx false" - SOURCE=dummy.fs SCFLAGS="--debug:portable" PRECMD="\$FSC_PIPE --debug:portable dummy.fs && \$FSI_PIPE copyArtifacts.fsx" POSTCMD="\$FSI_PIPE --nologo --quiet --exec binaryCompare.fsx false" - SOURCE=dummy.fs SCFLAGS="--debug:embedded" PRECMD="\$FSC_PIPE --debug:embedded dummy.fs && \$FSI_PIPE copyArtifacts.fsx" POSTCMD="\$FSI_PIPE --nologo --quiet --exec binaryCompare.fsx false" - -# Confirm in deterministic mode, the same file compiled twice leads to exactly the same exe & pdbs - SOURCE=dummy.fs SCFLAGS="--deterministic" PRECMD="\$FSC_PIPE --deterministic dummy.fs && \$FSI_PIPE copyArtifacts.fsx" POSTCMD="\$FSI_PIPE --nologo --quiet --exec binaryCompare.fsx true" - SOURCE=dummy.fs SCFLAGS="--deterministic --debug:portable" PRECMD="\$FSC_PIPE --deterministic --debug:portable dummy.fs && \$FSI_PIPE copyArtifacts.fsx" POSTCMD="\$FSI_PIPE --nologo --quiet --exec binaryCompare.fsx true" - SOURCE=dummy.fs SCFLAGS="--deterministic --debug:embedded" PRECMD="\$FSC_PIPE --deterministic --debug:embedded dummy.fs && \$FSI_PIPE copyArtifacts.fsx" POSTCMD="\$FSI_PIPE --nologo --quiet --exec binaryCompare.fsx true" - -# Confirm only portable and embedded debug PDBs are supported under deterministic build, not full or pdbonly - SOURCE=portablePdbOnly.fs SCFLAGS="--deterministic --debug:full" - SOURCE=portablePdbOnly.fs SCFLAGS="--deterministic --debug:pdbonly" diff --git a/tests/fsharpqa/Source/CompilerOptions/fsc/determinism/keep.lst b/tests/fsharpqa/Source/CompilerOptions/fsc/determinism/keep.lst deleted file mode 100644 index f59ec20aabf..00000000000 --- a/tests/fsharpqa/Source/CompilerOptions/fsc/determinism/keep.lst +++ /dev/null @@ -1 +0,0 @@ -* \ No newline at end of file diff --git a/tests/fsharpqa/Source/CompilerOptions/fsc/determinism/portablePdbOnly.fs b/tests/fsharpqa/Source/CompilerOptions/fsc/determinism/portablePdbOnly.fs deleted file mode 100644 index d5c358b34f6..00000000000 --- a/tests/fsharpqa/Source/CompilerOptions/fsc/determinism/portablePdbOnly.fs +++ /dev/null @@ -1,3 +0,0 @@ -// #NoMT #CompilerOptions #Determinism -//Deterministic builds only support portable PDBs -exit 0 diff --git a/tests/fsharpqa/Source/CompilerOptions/fsc/determinism/specificVersionSpecifed.fs b/tests/fsharpqa/Source/CompilerOptions/fsc/determinism/specificVersionSpecifed.fs deleted file mode 100644 index e9199e9a12f..00000000000 --- a/tests/fsharpqa/Source/CompilerOptions/fsc/determinism/specificVersionSpecifed.fs +++ /dev/null @@ -1,4 +0,0 @@ -// #NoMT #CompilerOptions #Determinism -// -[] -exit 0 diff --git a/tests/fsharpqa/Source/CompilerOptions/fsc/determinism/wildcardVersionSpecifed.fs b/tests/fsharpqa/Source/CompilerOptions/fsc/determinism/wildcardVersionSpecifed.fs deleted file mode 100644 index 10f82d79aeb..00000000000 --- a/tests/fsharpqa/Source/CompilerOptions/fsc/determinism/wildcardVersionSpecifed.fs +++ /dev/null @@ -1,4 +0,0 @@ -// #NoMT #CompilerOptions #Determinism -//this value is a wildcard, and you have requested a deterministic build, these are in conflict. -[] -exit 0 diff --git a/tests/fsharpqa/Source/test.lst b/tests/fsharpqa/Source/test.lst index 3c3f91f031b..7d700adc076 100644 --- a/tests/fsharpqa/Source/test.lst +++ b/tests/fsharpqa/Source/test.lst @@ -5,13 +5,9 @@ # ReqNOCov -- skip this test/suite if we are doing a code coverage run # ReqENU -- skip this test/suite if we are running on non-ENU (useful to exclude hard-to-localize tests) -CompilerOptions01,NoMT CompilerOptions\fsc\crossoptimize -CompilerOptions01,NoMT,Determinism CompilerOptions\fsc\determinism CompilerOptions01,NoMT CompilerOptions\fsc\dumpAllCommandLineOptions CompilerOptions01,NoMT CompilerOptions\fsc\flaterrors CompilerOptions02,NoMT,gcc CompilerOptions\fsc\gccerrors -CompilerOptions01,NoMT CompilerOptions\fsc\highentropyva -CompilerOptions01,NoMT CompilerOptions\fsc\langversion CompilerOptions01,NoMT CompilerOptions\fsc\lib CompilerOptions01,NoMT CompilerOptions\fsc\noframework CompilerOptions01,NoMT CompilerOptions\fsc\nologo From bb49c59cd338720aa10daff9b2a3570e93c74568 Mon Sep 17 00:00:00 2001 From: Kevin Ransom Date: Thu, 1 Jun 2023 11:56:47 -0700 Subject: [PATCH 2/3] PathMap path seperator --- .../CompilerOptions/fsc/determinism/determinism.fs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/determinism/determinism.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/determinism/determinism.fs index 492b8501301..d271a3ce238 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/determinism/determinism.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/determinism/determinism.fs @@ -120,13 +120,13 @@ module Determinism FsFromPath (Path.Combine(__SOURCE_DIRECTORY__, @"PathMap1\pathmap.fs")) |> withOutputDirectory thisTestDirectory compilation - |> withOptionsString $"""--pathmap:{compilation.OutputDirectory}\PathMap1=/src,F:\=/etc;--deterministic;--embed;--debug:portable""" + |> withOptionsString $"""--pathmap:{compilation.OutputDirectory}/PathMap1=/src,F:\=/etc;--deterministic;--embed;--debug:portable""" |> asExe |> compile let pathMap2 = let compilation = - FsFromPath (Path.Combine(__SOURCE_DIRECTORY__, @"PathMap2\pathmap.fs")) + FsFromPath (Path.Combine(__SOURCE_DIRECTORY__, @"PathMap2/pathmap.fs")) |> withOutputDirectory thisTestDirectory compilation |> withOptionsString $"""--pathmap:{compilation.OutputDirectory}\PathMap2=/src,F:\=/etc;--deterministic;--embed;--debug:portable""" From a3d97a485351c225f9f39d1d77ed97180b37d90b Mon Sep 17 00:00:00 2001 From: Kevin Ransom Date: Thu, 1 Jun 2023 12:20:47 -0700 Subject: [PATCH 3/3] PathMap path seperator --- .../CompilerOptions/fsc/determinism/determinism.fs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/determinism/determinism.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/determinism/determinism.fs index d271a3ce238..85941cafccc 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/determinism/determinism.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/determinism/determinism.fs @@ -91,19 +91,19 @@ module Determinism let thisTestDirectory = getTestOutputDirectory __SOURCE_DIRECTORY__ (getCurrentMethodName()) "" let pathMap1 = let compilation = - FsFromPath (Path.Combine(__SOURCE_DIRECTORY__, @"PathMap1\pathmap.fs")) + FsFromPath (Path.Combine(__SOURCE_DIRECTORY__, @"PathMap1/pathmap.fs")) |> withOutputDirectory thisTestDirectory compilation - |> withOptionsString $"""--pathmap:{compilation.OutputDirectory}\PathMap1=/src,F:\=/etc;--deterministic;--embed;--debug:embedded""" + |> withOptionsString $"""--pathmap:{compilation.OutputDirectory}/PathMap1=/src,F:\=/etc;--deterministic;--embed;--debug:embedded""" |> asExe |> compile let pathMap2 = let compilation = - FsFromPath (Path.Combine(__SOURCE_DIRECTORY__, @"PathMap2\pathmap.fs")) + FsFromPath (Path.Combine(__SOURCE_DIRECTORY__, @"PathMap2/pathmap.fs")) |> withOutputDirectory thisTestDirectory compilation - |> withOptionsString $"""--pathmap:{compilation.OutputDirectory}\PathMap2=/src,F:\=/etc;--deterministic;--embed;--debug:embedded""" + |> withOptionsString $"""--pathmap:{compilation.OutputDirectory}/PathMap2=/src,F:\=/etc;--deterministic;--embed;--debug:embedded""" |> asExe |> compile @@ -117,7 +117,7 @@ module Determinism let thisTestDirectory = getTestOutputDirectory __SOURCE_DIRECTORY__ (getCurrentMethodName()) "" let pathMap1 = let compilation = - FsFromPath (Path.Combine(__SOURCE_DIRECTORY__, @"PathMap1\pathmap.fs")) + FsFromPath (Path.Combine(__SOURCE_DIRECTORY__, @"PathMap1/pathmap.fs")) |> withOutputDirectory thisTestDirectory compilation |> withOptionsString $"""--pathmap:{compilation.OutputDirectory}/PathMap1=/src,F:\=/etc;--deterministic;--embed;--debug:portable""" @@ -129,7 +129,7 @@ module Determinism FsFromPath (Path.Combine(__SOURCE_DIRECTORY__, @"PathMap2/pathmap.fs")) |> withOutputDirectory thisTestDirectory compilation - |> withOptionsString $"""--pathmap:{compilation.OutputDirectory}\PathMap2=/src,F:\=/etc;--deterministic;--embed;--debug:portable""" + |> withOptionsString $"""--pathmap:{compilation.OutputDirectory}/PathMap2=/src,F:\=/etc;--deterministic;--embed;--debug:portable""" |> asExe |> compile