Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 15 additions & 9 deletions tests/fsharpqa/Source/MultiTargeting/MultiTargetMatrix.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,31 +25,37 @@ module Helpers =
run compilerPath ["-o:consumer.exe"; "--noframework"; sprintf "\"-r:%s\"" runtime; "-r:author.dll"; source]

let private consumerRunFsi fsiPath source =
let localFSharpCore = Path.Combine(Environment.CurrentDirectory, "FSharp.Core.dll")
if File.Exists(localFSharpCore) then
File.Delete(localFSharpCore)
run fsiPath ["--exec"; source]

/// gets the version of the assembly at the specified path
let getVer dllPath =
let asm = Assembly.ReflectionOnlyLoadFrom(dllPath)
asm.GetName().Version.ToString()

// runs the consumer EXE, handling binding redirects automatically
let private consumerRunExe redirectVer =
let private consumerRunExe consumerRuntime =
if File.Exists("consumer.exe.config") then
File.Delete("consumer.exe.config")


let redirectVer = getVer consumerRuntime
let content = File.ReadAllText("consumer.exe.config.txt").Replace("{ver}", redirectVer)
File.WriteAllText("consumer.exe.config", content)
File.WriteAllText("consumer.exe.config", content)

File.Copy(consumerRuntime, Path.Combine(Environment.CurrentDirectory, "FSharp.Core.dll"), true)

run "consumer.exe" []

/// gets the version of the assembly at the specified path
let getVer dllPath =
let asm = Assembly.ReflectionOnlyLoadFrom(dllPath)
asm.GetName().Version.ToString()

/// runs through the end-to-end scenario of
/// - Author uses [authorComiler] to build DLL targeting [authorRuntime] with source [authorSource]
/// - Consumer uses [consumerCompiler] to build EXE ref'ing above DLL, building EXE targeting [consumerRuntime] with source [consumerSource]
/// - Run the resulting EXE
let testExe authorCompiler authorRuntime consumerCompiler consumerRuntime authorSource consumerSource =
authorCompile authorCompiler authorRuntime authorSource
consumerCompile consumerCompiler consumerRuntime consumerSource
consumerRunExe (getVer consumerRuntime)
consumerRunExe consumerRuntime

/// runs through the end-to-end scenario of
/// - Author uses [authorComiler] to build DLL targeting [authorRuntime] with source [authorSource]
Expand Down
2 changes: 1 addition & 1 deletion tests/fsharpqa/Source/MultiTargeting/env.lst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ NOMONO SOURCE=E_BadPathToFSharpCore.fsx SCFLAGS="--noframework -r %W
# FSharp.Core is checked in for this test to verify a particular error message related to it. It shouldn't be accidentally picked up by other tests since it isn't in the working directory for them
NOMONO SOURCE=E_UseBinaryIncompatibleLibrary.fs SCFLAGS="--noframework -r ..\\Common\\FSharp.Core.dll" # E_UseBinaryIncompatibleLibrary.fs

ReqOpen SOURCE=dummy.fs POSTCMD="\$FSI_PIPE --nologo --quiet --exec .\\MultiTargetMatrix.fsx QuotedCommaTypeName_author.fs QuotedCommaTypeName_consumer.fsx 0,8" # QuotedCommaTypeName
ReqOpen SOURCE=dummy.fs POSTCMD="\$FSI_PIPE --nologo --quiet --exec .\\MultiTargetMatrix.fsx QuotedCommaTypeName_author.fs QuotedCommaTypeName_consumer.fsx" # QuotedCommaTypeName
ReqOpen SOURCE=dummy.fs POSTCMD="\$FSI_PIPE --nologo --quiet --exec .\\MultiTargetMatrix.fsx InlineCoreResource_author.fs InlineCoreResource_consumer.fsx" # InlineCoreResource
ReqOpen SOURCE=dummy.fs POSTCMD="\$FSI_PIPE --nologo --quiet --exec .\\MultiTargetMatrix.fsx OptimizedForLoops_author.fs OptimizedForLoops_consumer.fsx" # OptimizedForLoops