diff --git a/FSharpTests.Directory.Build.targets b/FSharpTests.Directory.Build.targets index 075321e3fb5..2e0b335b411 100644 --- a/FSharpTests.Directory.Build.targets +++ b/FSharpTests.Directory.Build.targets @@ -7,33 +7,35 @@ Returns="" DependsOnTargets="$(CoreCompileDependsOn)" > - - - + + + + <_CoreCompileResourceInputs Remove="@(_CoreCompileResourceInputs)" /> diff --git a/src/FSharp.Build/Fsi.fs b/src/FSharp.Build/Fsi.fs index 4e7bd9c4e0a..dc362420db0 100644 --- a/src/FSharp.Build/Fsi.fs +++ b/src/FSharp.Build/Fsi.fs @@ -161,6 +161,34 @@ type public Fsi() as this = builder + let mutable bufferLimit = None + + let textOutput = + lazy System.Collections.Generic.Queue<_>(defaultArg bufferLimit 1024) + + override this.LogEventsFromTextOutput(line, msgImportance) = + if this.CaptureTextOutput then + textOutput.Value.Enqueue line + + match bufferLimit with + | Some limit when textOutput.Value.Count > limit -> textOutput.Value.Dequeue() |> ignore + | _ -> () + + base.LogEventsFromTextOutput(line, msgImportance) + + member _.BufferLimit + with get () = defaultArg bufferLimit 0 + and set limit = bufferLimit <- if limit = 0 then None else Some limit + + member val CaptureTextOutput = false with get, set + + [] + member this.TextOutput = + if this.CaptureTextOutput then + textOutput.Value |> String.concat Environment.NewLine + else + String.Empty + // --codepage : Specify the codepage to use when opening source files member _.CodePage with get () = codePage diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/MigratedTest02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/MigratedTest02.fs index c34bd114f35..9c166a47aac 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/MigratedTest02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/MigratedTest02.fs @@ -57,4 +57,4 @@ module Tests = let test3 () = StaticTest.Test2 // is passing, but probably shouldn't be -printfn "Test Passed" +printf "TEST PASSED OK" diff --git a/tests/FSharp.Compiler.ComponentTests/Miscellaneous/FsharpSuiteMigrated.fs b/tests/FSharp.Compiler.ComponentTests/Miscellaneous/FsharpSuiteMigrated.fs index 2490e301e05..3f17e0cfa11 100644 --- a/tests/FSharp.Compiler.ComponentTests/Miscellaneous/FsharpSuiteMigrated.fs +++ b/tests/FSharp.Compiler.ComponentTests/Miscellaneous/FsharpSuiteMigrated.fs @@ -31,16 +31,15 @@ module ScriptRunner = let cu = cu |> withDefines defaultDefines match cu with | FS fsSource -> - File.Delete("test.ok") let engine = createEngine (fsSource.Options |> Array.ofList,version) let res = evalScriptFromDiskInSharedSession engine cu match res with | CompilationResult.Failure _ -> res - | CompilationResult.Success s -> - if File.Exists("test.ok") then + | CompilationResult.Success s -> + if engine.GetOutput().Contains "TEST PASSED OK" then res else - failwith $"Results looked correct, but 'test.ok' file was not created. Result: %A{s}" + failwith $"Results looked correct, but 'TEST PASSED OK' was not printed. Result: %A{s}" | _ -> failwith $"Compilation unit other than fsharp is not supported, cannot process %A{cu}" diff --git a/tests/FSharp.Compiler.ComponentTests/Signatures/TestCasesForGenerationRoundTrip/access.fsx b/tests/FSharp.Compiler.ComponentTests/Signatures/TestCasesForGenerationRoundTrip/access.fsx index a8c3798a685..6790e4dfbee 100644 --- a/tests/FSharp.Compiler.ComponentTests/Signatures/TestCasesForGenerationRoundTrip/access.fsx +++ b/tests/FSharp.Compiler.ComponentTests/Signatures/TestCasesForGenerationRoundTrip/access.fsx @@ -278,7 +278,7 @@ let aa = match failures.Value with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/FSharp.Compiler.ComponentTests/Signatures/TestCasesForGenerationRoundTrip/array.fsx b/tests/FSharp.Compiler.ComponentTests/Signatures/TestCasesForGenerationRoundTrip/array.fsx index 8c55d727f92..dd61a8f7474 100644 --- a/tests/FSharp.Compiler.ComponentTests/Signatures/TestCasesForGenerationRoundTrip/array.fsx +++ b/tests/FSharp.Compiler.ComponentTests/Signatures/TestCasesForGenerationRoundTrip/array.fsx @@ -1142,7 +1142,7 @@ let aa = match failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/FSharp.Compiler.ComponentTests/Signatures/TestCasesForGenerationRoundTrip/libtest.fsx b/tests/FSharp.Compiler.ComponentTests/Signatures/TestCasesForGenerationRoundTrip/libtest.fsx index 23c2125ab51..515e1428697 100644 --- a/tests/FSharp.Compiler.ComponentTests/Signatures/TestCasesForGenerationRoundTrip/libtest.fsx +++ b/tests/FSharp.Compiler.ComponentTests/Signatures/TestCasesForGenerationRoundTrip/libtest.fsx @@ -5651,7 +5651,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/FSharp.Compiler.Private.Scripting.UnitTests/DependencyManagerInteractiveTests.fs b/tests/FSharp.Compiler.Private.Scripting.UnitTests/DependencyManagerInteractiveTests.fs index 8a1bb95b2d2..cc027d098af 100644 --- a/tests/FSharp.Compiler.Private.Scripting.UnitTests/DependencyManagerInteractiveTests.fs +++ b/tests/FSharp.Compiler.Private.Scripting.UnitTests/DependencyManagerInteractiveTests.fs @@ -760,10 +760,9 @@ x |> Seq.iter(fun r -> if found = expected.Length then sawExpectedOutput.Set() |> ignore let text = "#help" - use output = new RedirectConsoleOutput() use script = new FSharpScript(quiet = false, langVersion = LangVersion.V47) let mutable found = 0 - output.OutputProduced.Add (fun line -> verifyOutput line) + script.OutputProduced.Add (fun line -> verifyOutput line) let opt = script.Eval(text) |> getValue Assert.True(sawExpectedOutput.WaitOne(TimeSpan.FromSeconds(5.0)), sprintf "Expected to see error sentinel value written\nexpected:%A\nactual:%A" expected lines) @@ -811,10 +810,9 @@ x |> Seq.iter(fun r -> if found = expected.Length then sawExpectedOutput.Set() |> ignore let text = "#help" - use output = new RedirectConsoleOutput() use script = new FSharpScript(quiet = false, langVersion = LangVersion.Preview) let mutable found = 0 - output.OutputProduced.Add (fun line -> verifyOutput line) + script.OutputProduced.Add (fun line -> verifyOutput line) let opt = script.Eval(text) |> getValue Assert.True(sawExpectedOutput.WaitOne(TimeSpan.FromSeconds(5.0)), sprintf "Expected to see error sentinel value written\nexpected:%A\nactual:%A" expected lines) diff --git a/tests/FSharp.Compiler.Private.Scripting.UnitTests/FSharpScriptTests.fs b/tests/FSharp.Compiler.Private.Scripting.UnitTests/FSharpScriptTests.fs index f7587333981..aff47308ad2 100644 --- a/tests/FSharp.Compiler.Private.Scripting.UnitTests/FSharpScriptTests.fs +++ b/tests/FSharp.Compiler.Private.Scripting.UnitTests/FSharpScriptTests.fs @@ -83,9 +83,7 @@ x [] member _.``Capture console input``() = - use input = new RedirectConsoleInput() - use script = new FSharpScript() - input.ProvideInput "stdin:1234\r\n" + use script = new FSharpScript(input = "stdin:1234\r\n") let opt = script.Eval("System.Console.ReadLine()") |> getValue let value = opt.Value Assert.Equal(typeof, value.ReflectionType) @@ -93,12 +91,11 @@ x [] member _.``Capture console output/error``() = - use output = new RedirectConsoleOutput() use script = new FSharpScript() use sawOutputSentinel = new ManualResetEvent(false) use sawErrorSentinel = new ManualResetEvent(false) - output.OutputProduced.Add (fun line -> if line = "stdout:1234" then sawOutputSentinel.Set() |> ignore) - output.ErrorProduced.Add (fun line -> if line = "stderr:5678" then sawErrorSentinel.Set() |> ignore) + script.OutputProduced.Add (fun line -> if line = "stdout:1234" then sawOutputSentinel.Set() |> ignore) + script.ErrorProduced.Add (fun line -> if line = "stderr:5678" then sawErrorSentinel.Set() |> ignore) script.Eval("printfn \"stdout:1234\"; eprintfn \"stderr:5678\"") |> ignoreValue Assert.True(sawOutputSentinel.WaitOne(TimeSpan.FromSeconds(5.0)), "Expected to see output sentinel value written") Assert.True(sawErrorSentinel.WaitOne(TimeSpan.FromSeconds(5.0)), "Expected to see error sentinel value written") @@ -305,11 +302,10 @@ printfn ""%A"" result [] member _.``Eval script with invalid PackageName should fail immediately``() = - use output = new RedirectConsoleOutput() use script = new FSharpScript(additionalArgs=[| |]) let mutable found = 0 let outp = System.Collections.Generic.List() - output.OutputProduced.Add( + script.OutputProduced.Add( fun line -> if line.Contains("error NU1101:") && line.Contains("FSharp.Really.Not.A.Package") then found <- found + 1 @@ -321,10 +317,9 @@ printfn ""%A"" result [] member _.``Eval script with invalid PackageName should fail immediately and resolve one time only``() = - use output = new RedirectConsoleOutput() use script = new FSharpScript(additionalArgs=[| |]) let mutable foundResolve = 0 - output.OutputProduced.Add (fun line -> if line.Contains("error NU1101:") then foundResolve <- foundResolve + 1) + script.OutputProduced.Add (fun line -> if line.Contains("error NU1101:") then foundResolve <- foundResolve + 1) let result, errors = script.Eval(""" #r "nuget:FSharp.Really.Not.A.Package" diff --git a/tests/FSharp.Test.Utilities/ScriptHelpers.fs b/tests/FSharp.Test.Utilities/ScriptHelpers.fs index aaaf5c458d8..688941934c9 100644 --- a/tests/FSharp.Test.Utilities/ScriptHelpers.fs +++ b/tests/FSharp.Test.Utilities/ScriptHelpers.fs @@ -3,7 +3,6 @@ namespace FSharp.Test.ScriptHelpers open System -open System.Collections.Generic open System.IO open System.Text open System.Threading @@ -11,7 +10,7 @@ open FSharp.Compiler open FSharp.Compiler.Interactive.Shell open FSharp.Compiler.Diagnostics open FSharp.Compiler.EditorServices -open FSharp.Test.Utilities +open FSharp.Test [] type LangVersion = @@ -25,7 +24,26 @@ type LangVersion = | Latest | SupportsMl -type FSharpScript(?additionalArgs: string[], ?quiet: bool, ?langVersion: LangVersion) = +type private EventedTextWriter() = + inherit TextWriter() + let sb = StringBuilder() + let sw = new StringWriter() + let lineWritten = Event() + member _.LineWritten = lineWritten.Publish + override _.Encoding = Encoding.UTF8 + override _.Write(c: char) = + if c = '\n' then + let line = + let v = sb.ToString() + if v.EndsWith("\r") then v.Substring(0, v.Length - 1) + else v + sb.Clear() |> ignore + sw.WriteLine line + lineWritten.Trigger(line) + else sb.Append(c) |> ignore + override _.ToString() = sw.ToString() + +type FSharpScript(?additionalArgs: string[], ?quiet: bool, ?langVersion: LangVersion, ?input: string) = let additionalArgs = defaultArg additionalArgs [||] let quiet = defaultArg quiet true @@ -54,13 +72,32 @@ type FSharpScript(?additionalArgs: string[], ?quiet: bool, ?langVersion: LangVer let argv = Array.append baseArgs additionalArgs + let inReader = new StringReader(defaultArg input "") + let outWriter = new EventedTextWriter() + let errorWriter = new EventedTextWriter() + + let previousIn, previousOut, previousError = Console.In, Console.Out, Console.Error + + do + Console.SetIn inReader + Console.SetOut outWriter + Console.SetError errorWriter + let fsi = FsiEvaluationSession.Create (config, argv, stdin, stdout, stderr) member _.ValueBound = fsi.ValueBound member _.Fsi = fsi - member _.Eval(code: string, ?cancellationToken: CancellationToken, ?desiredCulture: Globalization.CultureInfo) = + member _.OutputProduced = outWriter.LineWritten + + member _.ErrorProduced = errorWriter.LineWritten + + member _.GetOutput() = string outWriter + + member _.GetErrorOutput() = string errorWriter + + member this.Eval(code: string, ?cancellationToken: CancellationToken, ?desiredCulture: Globalization.CultureInfo) = let originalCulture = Thread.CurrentThread.CurrentCulture Thread.CurrentThread.CurrentCulture <- Option.defaultValue Globalization.CultureInfo.InvariantCulture desiredCulture @@ -88,7 +125,11 @@ type FSharpScript(?additionalArgs: string[], ?quiet: bool, ?langVersion: LangVer } interface IDisposable with - member this.Dispose() = ((this.Fsi) :> IDisposable).Dispose() + member this.Dispose() = + ((this.Fsi) :> IDisposable).Dispose() + Console.SetIn previousIn + Console.SetOut previousOut + Console.SetError previousError [] module TestHelpers = @@ -101,15 +142,3 @@ module TestHelpers = | Error ex -> raise ex let ignoreValue = getValue >> ignore - - let getTempDir () = - let sysTempDir = Path.GetTempPath() - let customTempDirName = Guid.NewGuid().ToString("D") - let fullDirName = Path.Combine(sysTempDir, customTempDirName) - let dirInfo = Directory.CreateDirectory(fullDirName) - { new Object() with - member _.ToString() = dirInfo.FullName - interface IDisposable with - member _.Dispose() = - dirInfo.Delete(true) - } diff --git a/tests/FSharp.Test.Utilities/TestFramework.fs b/tests/FSharp.Test.Utilities/TestFramework.fs index d32ce4fcda8..6e1611beb5c 100644 --- a/tests/FSharp.Test.Utilities/TestFramework.fs +++ b/tests/FSharp.Test.Utilities/TestFramework.fs @@ -9,6 +9,7 @@ open System.Diagnostics open Scripting open Xunit open FSharp.Compiler.IO +open Xunit.Sdk let getShortId() = Guid.NewGuid().ToString().[..7] @@ -141,7 +142,7 @@ module Commands = let copy workDir source dest = log "copy /y %s %s" source dest File.Copy( source |> getfullpath workDir, dest |> getfullpath workDir, true) - CmdResult.Success + CmdResult.Success "" let mkdir_p workDir dir = log "mkdir %s" dir @@ -183,19 +184,6 @@ module Commands = let fsc workDir exec (dotNetExe: FilePath) (fscExe: FilePath) flags srcFiles = let args = (sprintf "%s %s" flags (srcFiles |> Seq.ofList |> String.concat " ")) -#if FSC_IN_PROCESS - // This is not yet complete - printfn "Hosted Compiler:" - printfn "workdir: %A\nargs: %A"workdir args - let fscCompiler = FSharp.Compiler.Hosted.FscCompiler() - let exitCode, _stdin, _stdout = FSharp.Compiler.Hosted.CompilerHelpers.fscCompile workDir (FSharp.Compiler.Hosted.CompilerHelpers.parseCommandLine args) - - match exitCode with - | 0 -> CmdResult.Success - | err -> - let msg = sprintf "Error running command '%s' with args '%s' in directory '%s'" fscExe args workDir - CmdResult.ErrorLevel (msg, err) -#else ignore workDir #if NETCOREAPP exec dotNetExe (fscExe + " " + args) @@ -204,7 +192,6 @@ module Commands = printfn "fscExe: %A" fscExe printfn "args: %A" args exec fscExe args -#endif #endif let csc exec cscExe flags srcFiles = @@ -441,15 +428,23 @@ let logConfig (cfg: TestConfig) = log "PEVERIFY = %s" cfg.PEVERIFY log "---------------------------------------------------------------" +let checkOutputPassed (output: string) = + Assert.True(output.Contains "TEST PASSED OK", $"Output does not contain 'TEST PASSED OK':\n{output}") + +let checkResultPassed result = + match result with + | CmdResult.ErrorLevel (msg1, err) -> Assert.Fail (sprintf "%s. ERRORLEVEL %d" msg1 err) + | CmdResult.Success output -> checkOutputPassed output + let checkResult result = match result with | CmdResult.ErrorLevel (msg1, err) -> Assert.Fail (sprintf "%s. ERRORLEVEL %d" msg1 err) - | CmdResult.Success -> () + | CmdResult.Success _ -> () let checkErrorLevel1 result = match result with | CmdResult.ErrorLevel (_,1) -> () - | CmdResult.Success | CmdResult.ErrorLevel _ -> Assert.Fail (sprintf "Command passed unexpectedly") + | CmdResult.Success _ | CmdResult.ErrorLevel _ -> Assert.Fail (sprintf "Command passed unexpectedly") let envVars () = System.Environment.GetEnvironmentVariables () @@ -497,27 +492,13 @@ let createConfigWithEmptyDirectory() = let cfg = suiteHelpers.Value { cfg with Directory = createTemporaryDirectory "temp" } -[] -type FileGuard(path: string) = - let remove path = if FileSystem.FileExistsShim(path) then Commands.rm (Path.GetTempPath()) path - do if not (Path.IsPathRooted(path)) then failwithf "path '%s' must be absolute" path - do remove path - member x.Path = path - member x.Exists = x.Path |> FileSystem.FileExistsShim - member x.CheckExists() = - if not x.Exists then - failwith (sprintf "exit code 0 but %s file doesn't exists" (x.Path |> Path.GetFileName)) - - interface IDisposable with - member x.Dispose () = remove path - - type RedirectToType = | Overwrite of FilePath | Append of FilePath type RedirectTo = - | Inherit + | Ignore + | Collect | Output of RedirectToType | OutputAndError of RedirectToType * RedirectToType | OutputAndErrorToSameFile of RedirectToType @@ -541,8 +522,8 @@ module Command = let redirectType = function Overwrite x -> sprintf ">%s" x | Append x -> sprintf ">>%s" x let outF = function - | Inherit -> "" - | Output r-> sprintf " 1%s" (redirectType r) + | Ignore | Collect -> "" + | Output r -> sprintf " 1%s" (redirectType r) | OutputAndError (r1, r2) -> sprintf " 1%s 2%s" (redirectType r1) (redirectType r2) | OutputAndErrorToSameFile r -> sprintf " 1%s 2>1" (redirectType r) | Error r -> sprintf " 2%s" (redirectType r) @@ -579,9 +560,12 @@ module Command = let outF fCont cmdArgs = match redirect.Output with - | RedirectTo.Inherit -> - use toLog = redirectToLog () - fCont { cmdArgs with RedirectOutput = Some (toLog.Post); RedirectError = Some (toLog.Post) } + | Ignore -> + fCont { cmdArgs with RedirectOutput = Some ignore; RedirectError = Some ignore } + | Collect -> + use out = redirectTo (new StringWriter()) + use error = redirectTo (new StringWriter()) + fCont { cmdArgs with RedirectOutput = Some out.Post; RedirectError = Some error.Post } | Output r -> use writer = openWrite r use outFile = redirectTo writer @@ -612,18 +596,21 @@ module Command = let alwaysSuccess _ = () -let execArgs = { Output = Inherit; Input = None; } +let execArgs = { Output = Ignore; Input = None; } let execAppend cfg stdoutPath stderrPath p = Command.exec cfg.Directory cfg.EnvironmentVariables { execArgs with Output = OutputAndError(Append(stdoutPath), Append(stderrPath)) } p >> checkResult let execAppendIgnoreExitCode cfg stdoutPath stderrPath p = Command.exec cfg.Directory cfg.EnvironmentVariables { execArgs with Output = OutputAndError(Append(stdoutPath), Append(stderrPath)) } p >> alwaysSuccess let exec cfg p = Command.exec cfg.Directory cfg.EnvironmentVariables execArgs p >> checkResult +let execAndCheckPassed cfg p = Command.exec cfg.Directory cfg.EnvironmentVariables { execArgs with Output = Collect } p >> checkResultPassed let execExpectFail cfg p = Command.exec cfg.Directory cfg.EnvironmentVariables execArgs p >> checkErrorLevel1 let execIn cfg workDir p = Command.exec workDir cfg.EnvironmentVariables execArgs p >> checkResult -let execBothToOutNoCheck cfg workDir outFile p = Command.exec workDir cfg.EnvironmentVariables { execArgs with Output = OutputAndErrorToSameFile(Overwrite(outFile)) } p +let execBothToOutNoCheck cfg workDir outFile p = Command.exec workDir cfg.EnvironmentVariables { execArgs with Output = OutputAndErrorToSameFile(Overwrite(outFile)) } p let execBothToOut cfg workDir outFile p = execBothToOutNoCheck cfg workDir outFile p >> checkResult +let execBothToOutCheckPassed cfg workDir outFile p = execBothToOutNoCheck cfg workDir outFile p >> checkResultPassed let execBothToOutExpectFail cfg workDir outFile p = execBothToOutNoCheck cfg workDir outFile p >> checkErrorLevel1 let execAppendOutIgnoreExitCode cfg workDir outFile p = Command.exec workDir cfg.EnvironmentVariables { execArgs with Output = Output(Append(outFile)) } p >> alwaysSuccess let execAppendErrExpectFail cfg errPath p = Command.exec cfg.Directory cfg.EnvironmentVariables { execArgs with Output = Error(Overwrite(errPath)) } p >> checkErrorLevel1 -let execStdin cfg l p = Command.exec cfg.Directory cfg.EnvironmentVariables { Output = Inherit; Input = Some(RedirectInput(l)) } p >> checkResult +let execStdin cfg l p = Command.exec cfg.Directory cfg.EnvironmentVariables { Output = Ignore; Input = Some(RedirectInput(l)) } p >> checkResult +let execStdinCheckPassed cfg l p = Command.exec cfg.Directory cfg.EnvironmentVariables { Output = Collect; Input = Some(RedirectInput(l)) } p >> checkResultPassed let execStdinAppendBothIgnoreExitCode cfg stdoutPath stderrPath stdinPath p = Command.exec cfg.Directory cfg.EnvironmentVariables { Output = OutputAndError(Append(stdoutPath), Append(stderrPath)); Input = Some(RedirectInput(stdinPath)) } p >> alwaysSuccess let fsc cfg arg = Printf.ksprintf (Commands.fsc cfg.Directory (exec cfg) cfg.DotNetExe cfg.FSC) arg let fscIn cfg workDir arg = Printf.ksprintf (Commands.fsc workDir (execIn cfg workDir) cfg.DotNetExe cfg.FSC) arg @@ -639,6 +626,7 @@ let ilasm cfg arg = Printf.ksprintf (Commands.ilasm (exec cfg) cfg.ILASM) arg let peverify _cfg _test = printfn "PEVerify is disabled, need to migrate to ILVerify instead, see https://github.com/dotnet/fsharp/issues/13854" //Commands.peverify (exec cfg) cfg.PEVERIFY "/nologo" let peverifyWithArgs _cfg _args _test = printfn "PEVerify is disabled, need to migrate to ILVerify instead, see https://github.com/dotnet/fsharp/issues/13854" //Commands.peverify (exec cfg) cfg.PEVERIFY args let fsi cfg = Printf.ksprintf (Commands.fsi (exec cfg) cfg.FSI) +let fsiCheckPassed cfg = Printf.ksprintf (Commands.fsi (execAndCheckPassed cfg) cfg.FSI) #if !NETCOREAPP let fsiAnyCpu cfg = Printf.ksprintf (Commands.fsi (exec cfg) cfg.FSIANYCPU) let sn cfg = Printf.ksprintf (Commands.sn (exec cfg) cfg.SN) @@ -646,10 +634,10 @@ let sn cfg = Printf.ksprintf (Commands.sn (exec cfg) cfg.SN) let fsi_script cfg = Printf.ksprintf (Commands.fsi (exec cfg) cfg.FSI_FOR_SCRIPTS) let fsiExpectFail cfg = Printf.ksprintf (Commands.fsi (execExpectFail cfg) cfg.FSI) let fsiAppendIgnoreExitCode cfg stdoutPath stderrPath = Printf.ksprintf (Commands.fsi (execAppendIgnoreExitCode cfg stdoutPath stderrPath) cfg.FSI) -let fileguard cfg fileName = Commands.getfullpath cfg.Directory fileName |> (fun x -> new FileGuard(x)) let getfullpath cfg = Commands.getfullpath cfg.Directory let fileExists cfg fileName = Commands.fileExists cfg.Directory fileName |> Option.isSome let fsiStdin cfg stdinPath = Printf.ksprintf (Commands.fsi (execStdin cfg stdinPath) cfg.FSI) +let fsiStdinCheckPassed cfg stdinPath = Printf.ksprintf (Commands.fsi (execStdinCheckPassed cfg stdinPath) cfg.FSI) let fsiStdinAppendBothIgnoreExitCode cfg stdoutPath stderrPath stdinPath = Printf.ksprintf (Commands.fsi (execStdinAppendBothIgnoreExitCode cfg stdoutPath stderrPath stdinPath) cfg.FSI) let rm cfg x = Commands.rm cfg.Directory x let rmdir cfg x = Commands.rmdir cfg.Directory x diff --git a/tests/FSharp.Test.Utilities/Utilities.fs b/tests/FSharp.Test.Utilities/Utilities.fs index 199f047dfd1..6ed885d4e44 100644 --- a/tests/FSharp.Test.Utilities/Utilities.fs +++ b/tests/FSharp.Test.Utilities/Utilities.fs @@ -38,86 +38,23 @@ type FactForDESKTOPAttribute() = do base.Skip <- "NETCOREAPP is not supported runtime for this kind of test, it is intended for DESKTOP only" #endif - // This file mimics how Roslyn handles their compilation references for compilation testing module Utilities = - - type CapturedTextReader() = - inherit TextReader() - let queue = Queue() - member _.ProvideInput(text: string) = - for c in text.ToCharArray() do - queue.Enqueue(c) - override _.Peek() = - if queue.Count > 0 then queue.Peek() |> int else -1 - override _.Read() = - if queue.Count > 0 then queue.Dequeue() |> int else -1 - - type RedirectConsoleInput() = - let oldStdIn = Console.In - let newStdIn = new CapturedTextReader() - do Console.SetIn(newStdIn) - member _.ProvideInput(text: string) = - newStdIn.ProvideInput(text) - interface IDisposable with - member _.Dispose() = - Console.SetIn(oldStdIn) - newStdIn.Dispose() - - type EventedTextWriter() = - inherit TextWriter() - let sb = StringBuilder() - let lineWritten = Event() - member _.LineWritten = lineWritten.Publish - override _.Encoding = Encoding.UTF8 - override _.Write(c: char) = - if c = '\n' then - let line = - let v = sb.ToString() - if v.EndsWith("\r") then v.Substring(0, v.Length - 1) - else v - sb.Clear() |> ignore - lineWritten.Trigger(line) - else sb.Append(c) |> ignore - - type RedirectConsoleOutput() = - let outputProduced = Event() - let errorProduced = Event() + type RedirectConsole() = let oldStdOut = Console.Out let oldStdErr = Console.Error - let newStdOut = new EventedTextWriter() - let newStdErr = new EventedTextWriter() - - do newStdOut.LineWritten.Add outputProduced.Trigger - do newStdErr.LineWritten.Add errorProduced.Trigger + let newStdOut = new StringWriter() + let newStdErr = new StringWriter() do Console.SetOut(newStdOut) do Console.SetError(newStdErr) + member _.Output () = string newStdOut - member _.OutputProduced = outputProduced.Publish - - member _.ErrorProduced = errorProduced.Publish + member _.ErrorOutput () =string newStdErr interface IDisposable with member _.Dispose() = Console.SetOut(oldStdOut) Console.SetError(oldStdErr) - newStdOut.Dispose() - newStdErr.Dispose() - - type RedirectConsole() = - let redirector = new RedirectConsoleOutput() - let outputLines = StringBuilder() - let errorLines = StringBuilder() - - do redirector.OutputProduced.Add (fun line -> lock outputLines <| fun () -> outputLines.AppendLine line |>ignore) - do redirector.ErrorProduced.Add(fun line -> lock errorLines <| fun () -> errorLines.AppendLine line |>ignore) - - member _.Output () = lock outputLines outputLines.ToString - - member _.ErrorOutput () = lock errorLines errorLines.ToString - - interface IDisposable with - member _.Dispose() = (redirector :> IDisposable).Dispose() type Async with static member RunImmediate (computation: Async<'T>, ?cancellationToken ) = diff --git a/tests/fsharp/Compiler/CodeGen/EmittedIL/StaticMember.fs b/tests/fsharp/Compiler/CodeGen/EmittedIL/StaticMember.fs index 464b7ca7d13..078cffd9e60 100644 --- a/tests/fsharp/Compiler/CodeGen/EmittedIL/StaticMember.fs +++ b/tests/fsharp/Compiler/CodeGen/EmittedIL/StaticMember.fs @@ -481,7 +481,7 @@ let _ = if !failures then (System.Console.Out.WriteLine "Test Failed"; exit 1) do (System.Console.Out.WriteLine "Test Passed"; - System.IO.File.WriteAllText("test.ok", "ok"); + printf "TEST PASSED OK" ; exit 0) """, (fun verifier -> verifier.VerifyIL [ diff --git a/tests/fsharp/FSharpSuite.Tests.fsproj b/tests/fsharp/FSharpSuite.Tests.fsproj index 36f26235ac1..6673da9f911 100644 --- a/tests/fsharp/FSharpSuite.Tests.fsproj +++ b/tests/fsharp/FSharpSuite.Tests.fsproj @@ -3,7 +3,7 @@ net472;$(FSharpNetCoreProductTargetFramework) - $(FSharpNetCoreProductTargetFramework) + $(FSharpNetCoreProductTargetFramework) win-x86;win-x64 $(AssetTargetFallback);portable-net45+win8+wp8+wpa81 true diff --git a/tests/fsharp/TypeProviderTests.fs b/tests/fsharp/TypeProviderTests.fs index ba3d43037e6..ab9f2e7e5ef 100644 --- a/tests/fsharp/TypeProviderTests.fs +++ b/tests/fsharp/TypeProviderTests.fs @@ -69,11 +69,9 @@ let diamondAssembly () = exec cfg ("." ++ "test3.exe") "" - use testOkFile = fileguard cfg "test.ok" + - fsi cfg "%s" cfg.fsi_flags ["test3.fsx"] - - testOkFile.CheckExists() + fsiCheckPassed cfg "%s" cfg.fsi_flags ["test3.fsx"] [] let globalNamespace () = @@ -286,18 +284,16 @@ let splitAssembly subdir project = fsc cfg "--out:test.exe -r:provider.dll" ["test.fsx"] begin - use testOkFile = fileguard cfg "test.ok" + - exec cfg ("." ++ "test.exe") "" + execAndCheckPassed cfg ("." ++ "test.exe") "" - testOkFile.CheckExists() end begin - use testOkFile = fileguard cfg "test.ok" + - fsi cfg "%s" cfg.fsi_flags ["test.fsx"] - testOkFile.CheckExists() + fsiCheckPassed cfg "%s" cfg.fsi_flags ["test.fsx"] end // Do the same thing with different load locations for the type provider design-time component @@ -326,19 +322,16 @@ let splitAssembly subdir project = fsc cfg "--out:test.exe -r:provider.dll" ["test.fsx"] - begin - use testOkFile = fileguard cfg "test.ok" + begin - exec cfg ("." ++ "test.exe") "" + execAndCheckPassed cfg ("." ++ "test.exe") "" - testOkFile.CheckExists() end begin - use testOkFile = fileguard cfg "test.ok" + - fsi cfg "%s" cfg.fsi_flags ["test.fsx"] - testOkFile.CheckExists() + fsiCheckPassed cfg "%s" cfg.fsi_flags ["test.fsx"] end clean() diff --git a/tests/fsharp/core/access/test.fsx b/tests/fsharp/core/access/test.fsx index 21a8c056ee0..3a8bfd0e6f3 100644 --- a/tests/fsharp/core/access/test.fsx +++ b/tests/fsharp/core/access/test.fsx @@ -274,7 +274,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK"; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/anon/test.fsx b/tests/fsharp/core/anon/test.fsx index 580772b3446..6b065cdd7f0 100644 --- a/tests/fsharp/core/anon/test.fsx +++ b/tests/fsharp/core/anon/test.fsx @@ -86,7 +86,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/apporder/test.fsx b/tests/fsharp/core/apporder/test.fsx index 7830de44c1a..5dc19b65fde 100644 --- a/tests/fsharp/core/apporder/test.fsx +++ b/tests/fsharp/core/apporder/test.fsx @@ -1130,7 +1130,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/array-no-dot/test.fsx b/tests/fsharp/core/array-no-dot/test.fsx index 4cba7c3268b..569c477c5eb 100644 --- a/tests/fsharp/core/array-no-dot/test.fsx +++ b/tests/fsharp/core/array-no-dot/test.fsx @@ -435,7 +435,7 @@ let aa = match failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/array/test.fsx b/tests/fsharp/core/array/test.fsx index 69d1feada8c..ceed74ab3b4 100644 --- a/tests/fsharp/core/array/test.fsx +++ b/tests/fsharp/core/array/test.fsx @@ -1142,7 +1142,7 @@ let aa = match failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/asyncStackTraces/test.fsx b/tests/fsharp/core/asyncStackTraces/test.fsx index abbd3ec0a4b..34c82a8804c 100644 --- a/tests/fsharp/core/asyncStackTraces/test.fsx +++ b/tests/fsharp/core/asyncStackTraces/test.fsx @@ -176,6 +176,6 @@ let aa = exit 1 else stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 diff --git a/tests/fsharp/core/attributes/test.fsx b/tests/fsharp/core/attributes/test.fsx index 30509f450fd..e17fd3404f1 100644 --- a/tests/fsharp/core/attributes/test.fsx +++ b/tests/fsharp/core/attributes/test.fsx @@ -1358,7 +1358,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/auto-widen/5.0/test.fsx b/tests/fsharp/core/auto-widen/5.0/test.fsx index 83d2f46ab2b..74f1af4fdb9 100644 --- a/tests/fsharp/core/auto-widen/5.0/test.fsx +++ b/tests/fsharp/core/auto-widen/5.0/test.fsx @@ -459,7 +459,7 @@ let aa = match failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> printfn "Test Failed, failures = %A" failures diff --git a/tests/fsharp/core/auto-widen/minimal/test.fsx b/tests/fsharp/core/auto-widen/minimal/test.fsx index 92e7cfc56da..bf0e11b64a6 100644 --- a/tests/fsharp/core/auto-widen/minimal/test.fsx +++ b/tests/fsharp/core/auto-widen/minimal/test.fsx @@ -2,5 +2,5 @@ #r "System.Xml.XDocument.dll" let ns : System.Xml.Linq.XNamespace = "" -System.IO.File.WriteAllText("test.ok","ok") +printf "TEST PASSED OK" ; exit 0 \ No newline at end of file diff --git a/tests/fsharp/core/auto-widen/preview-default-warns/test.fsx b/tests/fsharp/core/auto-widen/preview-default-warns/test.fsx index 2989aa19071..ea91533c0dd 100644 --- a/tests/fsharp/core/auto-widen/preview-default-warns/test.fsx +++ b/tests/fsharp/core/auto-widen/preview-default-warns/test.fsx @@ -566,7 +566,7 @@ let aa = match failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> printfn "Test Failed, failures = %A" failures diff --git a/tests/fsharp/core/auto-widen/preview/test.fsx b/tests/fsharp/core/auto-widen/preview/test.fsx index e5e11b074dd..50eaae85f62 100644 --- a/tests/fsharp/core/auto-widen/preview/test.fsx +++ b/tests/fsharp/core/auto-widen/preview/test.fsx @@ -644,7 +644,7 @@ let aa = match failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> printfn "Test Failed, failures = %A" failures diff --git a/tests/fsharp/core/comprehensions-hw/test.fsx b/tests/fsharp/core/comprehensions-hw/test.fsx index 54ccfa1f167..bd47019704e 100644 --- a/tests/fsharp/core/comprehensions-hw/test.fsx +++ b/tests/fsharp/core/comprehensions-hw/test.fsx @@ -1048,7 +1048,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/comprehensions/test.fsx b/tests/fsharp/core/comprehensions/test.fsx index c6cad18b75c..4d9664404cb 100644 --- a/tests/fsharp/core/comprehensions/test.fsx +++ b/tests/fsharp/core/comprehensions/test.fsx @@ -1488,7 +1488,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/control/test.fsx b/tests/fsharp/core/control/test.fsx index 98db3309532..6c80ca0d72b 100644 --- a/tests/fsharp/core/control/test.fsx +++ b/tests/fsharp/core/control/test.fsx @@ -2100,7 +2100,7 @@ let aa = exit 1 else stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 #endif diff --git a/tests/fsharp/core/controlChamenos/test.fsx b/tests/fsharp/core/controlChamenos/test.fsx index b95bfff4c80..5742662a53c 100644 --- a/tests/fsharp/core/controlChamenos/test.fsx +++ b/tests/fsharp/core/controlChamenos/test.fsx @@ -123,6 +123,6 @@ let aa = exit 1 else stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 #endif diff --git a/tests/fsharp/core/controlMailbox/test.fsx b/tests/fsharp/core/controlMailbox/test.fsx index fc8a1cc7aea..98d6a7d2f31 100644 --- a/tests/fsharp/core/controlMailbox/test.fsx +++ b/tests/fsharp/core/controlMailbox/test.fsx @@ -624,6 +624,6 @@ let aa = exit 1 else stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 #endif diff --git a/tests/fsharp/core/controlStackOverflow/test.fsx b/tests/fsharp/core/controlStackOverflow/test.fsx index 735b09173c9..f3678844b05 100644 --- a/tests/fsharp/core/controlStackOverflow/test.fsx +++ b/tests/fsharp/core/controlStackOverflow/test.fsx @@ -415,6 +415,6 @@ let aa = else stdout.WriteLine "Test Passed" log "ALL OK, HAPPY HOLIDAYS, MERRY CHRISTMAS!" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 #endif diff --git a/tests/fsharp/core/controlWebExt/test.fsx b/tests/fsharp/core/controlWebExt/test.fsx index 42a43aed573..23e5bf5071e 100644 --- a/tests/fsharp/core/controlWebExt/test.fsx +++ b/tests/fsharp/core/controlWebExt/test.fsx @@ -233,7 +233,7 @@ let aa = if not failures.IsEmpty then (stdout.WriteLine("Test Failed, failures = {0}", failures); exit 1) else (stdout.WriteLine "Test Passed"; log "ALL OK, HAPPY HOLIDAYS, MERRY CHRISTMAS!" - System.IO.File.WriteAllText("test.ok","ok"); + printf "TEST PASSED OK"; // debug: why is the fsi test failing? is it because test.ok does not exist? if System.IO.File.Exists("test.ok") then stdout.WriteLine ("test.ok found at {0}", System.IO.FileInfo("test.ok").FullName) diff --git a/tests/fsharp/core/controlWpf/test.fsx b/tests/fsharp/core/controlWpf/test.fsx index 25ad5eff208..400f196c652 100644 --- a/tests/fsharp/core/controlWpf/test.fsx +++ b/tests/fsharp/core/controlWpf/test.fsx @@ -27,8 +27,8 @@ async { printfn "Test Failed" app.Shutdown(128) else - printfn "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" + printf "TEST PASSED OK" ; app.Shutdown(0) } |> Async.StartImmediate diff --git a/tests/fsharp/core/csext/test.fsx b/tests/fsharp/core/csext/test.fsx index c77a7307642..224fd9dd047 100644 --- a/tests/fsharp/core/csext/test.fsx +++ b/tests/fsharp/core/csext/test.fsx @@ -321,7 +321,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/enum/test.fsx b/tests/fsharp/core/enum/test.fsx index 2bc2d41d783..bf80f12bdc7 100644 --- a/tests/fsharp/core/enum/test.fsx +++ b/tests/fsharp/core/enum/test.fsx @@ -49,7 +49,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/events/test.fs b/tests/fsharp/core/events/test.fs index 0050a8d5635..e9921fcbe25 100644 --- a/tests/fsharp/core/events/test.fs +++ b/tests/fsharp/core/events/test.fs @@ -537,5 +537,5 @@ module EventWithNonPublicDelegateTypes_DevDiv271288 = let _ = if failures.Length > 0 then (printfn "Tests Failed: %A" failures; exit 1) else (stdout.WriteLine "Test Passed"; - System.IO.File.WriteAllText("test.ok","ok"); + printf "TEST PASSED OK"; exit 0) diff --git a/tests/fsharp/core/fileorder/test.fsx b/tests/fsharp/core/fileorder/test.fsx index 6981cdcc03a..8c874d7d6b5 100644 --- a/tests/fsharp/core/fileorder/test.fsx +++ b/tests/fsharp/core/fileorder/test.fsx @@ -19,5 +19,5 @@ let aa = if !failures then (stdout.WriteLine "Test Failed"; exit 1) do (stdout.WriteLine "Test Passed"; - System.IO.File.WriteAllText("test.ok","ok"); + printf "TEST PASSED OK"; exit 0) \ No newline at end of file diff --git a/tests/fsharp/core/forexpression/test.fsx b/tests/fsharp/core/forexpression/test.fsx index 141fc4677e1..257cdf308f3 100644 --- a/tests/fsharp/core/forexpression/test.fsx +++ b/tests/fsharp/core/forexpression/test.fsx @@ -168,5 +168,5 @@ let RUN() = !failures #else let aa = if !failures then stdout.WriteLine "Test Failed"; exit 1 - else stdout.WriteLine "Test Passed"; System.IO.File.WriteAllText("test.ok","ok"); exit 0 + else stdout.WriteLine "Test Passed"; printf "TEST PASSED OK"; exit 0 #endif diff --git a/tests/fsharp/core/fsfromcs/test.cs b/tests/fsharp/core/fsfromcs/test.cs index 5281b3469e0..7c27491f789 100644 --- a/tests/fsharp/core/fsfromcs/test.cs +++ b/tests/fsharp/core/fsfromcs/test.cs @@ -311,7 +311,7 @@ static int Main() //let tup3 = (2,3,4) //let tup4 = (2,3,4,5) - System.Console.WriteLine("Test Passed."); + System.Console.WriteLine("TEST PASSED OK"); return 0; } diff --git a/tests/fsharp/core/fsfromfsviacs/test.fsx b/tests/fsharp/core/fsfromfsviacs/test.fsx index 7974a4ce47b..e7c47575bd8 100644 --- a/tests/fsharp/core/fsfromfsviacs/test.fsx +++ b/tests/fsharp/core/fsfromfsviacs/test.fsx @@ -487,7 +487,7 @@ let _ = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/fsi-load/test.fsx b/tests/fsharp/core/fsi-load/test.fsx index f81654365e7..062ea882adc 100644 --- a/tests/fsharp/core/fsi-load/test.fsx +++ b/tests/fsharp/core/fsi-load/test.fsx @@ -17,6 +17,6 @@ module OtherModule = let _ = stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 diff --git a/tests/fsharp/core/fsi-reference/test.fsx b/tests/fsharp/core/fsi-reference/test.fsx index 16867d6f344..393b44151c2 100644 --- a/tests/fsharp/core/fsi-reference/test.fsx +++ b/tests/fsharp/core/fsi-reference/test.fsx @@ -4,5 +4,5 @@ let c = new ReferenceAssembly.MyClass() let _ = c.X // If this fails then the jit blows up so this file will not get written. -let os = System.IO.File.CreateText "test.ok" in os.Close() +printf "TEST PASSED OK" ; exit 0 diff --git a/tests/fsharp/core/fsi-reload/load1.fsx b/tests/fsharp/core/fsi-reload/load1.fsx index 0f7fba67329..44b24cddab5 100644 --- a/tests/fsharp/core/fsi-reload/load1.fsx +++ b/tests/fsharp/core/fsi-reload/load1.fsx @@ -2,4 +2,4 @@ #load "a1.fs" #load "a2.fs" -let os = System.IO.File.CreateText "test.ok" in os.Close() +printf "TEST PASSED OK" ; diff --git a/tests/fsharp/core/fsi-reload/load2.fsx b/tests/fsharp/core/fsi-reload/load2.fsx index a30cad3826f..d87b4e10df0 100644 --- a/tests/fsharp/core/fsi-reload/load2.fsx +++ b/tests/fsharp/core/fsi-reload/load2.fsx @@ -2,4 +2,4 @@ #load "b1.fs" #load "b2.fsi" "b2.fs" -let os = System.IO.File.CreateText "test.ok" in os.Close() +printf "TEST PASSED OK" ; diff --git a/tests/fsharp/core/fsi-reload/test1.ml b/tests/fsharp/core/fsi-reload/test1.ml index e9f0a57fa91..9cc77a02eb1 100644 --- a/tests/fsharp/core/fsi-reload/test1.ml +++ b/tests/fsharp/core/fsi-reload/test1.ml @@ -72,6 +72,6 @@ printf "x = %b\n" (X x = X 3) printf "x = %d\n" (3 : x_t) ;; -begin ignore (3 : x_t); ignore (3 : Nested.x_t); ignore (3 : Test1.Nested.x_t); ignore (3 : Test1.x_t); let os = System.IO.File.CreateText "test.ok" in os.Close() end;; +begin ignore (3 : x_t); ignore (3 : Nested.x_t); ignore (3 : Test1.Nested.x_t); ignore (3 : Test1.x_t); printf "TEST PASSED OK" end;; #quit;; diff --git a/tests/fsharp/core/fsi-shadowcopy/test1.fsx b/tests/fsharp/core/fsi-shadowcopy/test1.fsx index 3e34e651775..93f2765b719 100644 --- a/tests/fsharp/core/fsi-shadowcopy/test1.fsx +++ b/tests/fsharp/core/fsi-shadowcopy/test1.fsx @@ -23,8 +23,7 @@ let next = compiled 30000;; //compile will fail because shadow copy is disabled if next = false then printfn "Succeeded -- compile fail because file locked due to --shadowcopyreferences-" - use os = System.IO.File.CreateText "test1.ok" - os.Close() + printf "TEST PASSED OK" ; else printfn "Failed -- compile succeeded but should have failed due to file lock because of --shadowcopyReferences-. Suspect test error";; diff --git a/tests/fsharp/core/fsi-shadowcopy/test2.fsx b/tests/fsharp/core/fsi-shadowcopy/test2.fsx index 34da503c636..94633d0819e 100644 --- a/tests/fsharp/core/fsi-shadowcopy/test2.fsx +++ b/tests/fsharp/core/fsi-shadowcopy/test2.fsx @@ -30,8 +30,7 @@ if next = true then printfn "Succeeded -- compile worked because file not locked due to --shadowcopyReferences+" if verifyGetEntryAssembly then printfn "Succeeded -- GetEntryAssembly() returned not null" - use os = System.IO.File.CreateText "test2.ok" - os.Close() + printf "TEST PASSED OK" ; else printfn "Failed -- GetEntryAssembly() returned null" else diff --git a/tests/fsharp/core/fsiAndModifiers/test.fsx b/tests/fsharp/core/fsiAndModifiers/test.fsx index 16b3d33aee0..c63ddcf384f 100644 --- a/tests/fsharp/core/fsiAndModifiers/test.fsx +++ b/tests/fsharp/core/fsiAndModifiers/test.fsx @@ -139,7 +139,7 @@ module PinTests = if errors.IsEmpty then - System.IO.File.WriteAllText("test.ok", "") + printf "TEST PASSED OK" ; exit(0) else for error in errors do diff --git a/tests/fsharp/core/genericmeasures/test.fsx b/tests/fsharp/core/genericmeasures/test.fsx index b7de5c84aaa..ade03d4fb4c 100644 --- a/tests/fsharp/core/genericmeasures/test.fsx +++ b/tests/fsharp/core/genericmeasures/test.fsx @@ -80,7 +80,7 @@ module Core_genericMeasures = #else RunAll(); stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 #endif diff --git a/tests/fsharp/core/indent/version46/test.fsx b/tests/fsharp/core/indent/version46/test.fsx index b9d41a04da5..3cc566d6981 100644 --- a/tests/fsharp/core/indent/version46/test.fsx +++ b/tests/fsharp/core/indent/version46/test.fsx @@ -105,7 +105,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/indent/version47/test.fsx b/tests/fsharp/core/indent/version47/test.fsx index 9a119b4c89f..1cc563cb0aa 100644 --- a/tests/fsharp/core/indent/version47/test.fsx +++ b/tests/fsharp/core/indent/version47/test.fsx @@ -85,7 +85,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/innerpoly/test.fsx b/tests/fsharp/core/innerpoly/test.fsx index e03b322d1c0..c9a8c714bc6 100644 --- a/tests/fsharp/core/innerpoly/test.fsx +++ b/tests/fsharp/core/innerpoly/test.fsx @@ -483,7 +483,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/int32/test.fsx b/tests/fsharp/core/int32/test.fsx index a6dec0ea0af..1c6a500c55a 100644 --- a/tests/fsharp/core/int32/test.fsx +++ b/tests/fsharp/core/int32/test.fsx @@ -425,7 +425,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/large/conditionals/LargeConditionals-200.fs b/tests/fsharp/core/large/conditionals/LargeConditionals-200.fs index d1910edcce4..330bfa99801 100644 --- a/tests/fsharp/core/large/conditionals/LargeConditionals-200.fs +++ b/tests/fsharp/core/large/conditionals/LargeConditionals-200.fs @@ -207,4 +207,4 @@ let expectedValues() = if rnd.Next(3) = 1 then 1 else 4 printfn "expectedValues() = %A" (expectedValues()) -System.IO.File.WriteAllLines("test.ok", ["ok"]) \ No newline at end of file +printf "TEST PASSED OK" ; \ No newline at end of file diff --git a/tests/fsharp/core/large/conditionals/LargeConditionals-maxtested.fs b/tests/fsharp/core/large/conditionals/LargeConditionals-maxtested.fs index 40840fbdb13..71c3dec00a3 100644 --- a/tests/fsharp/core/large/conditionals/LargeConditionals-maxtested.fs +++ b/tests/fsharp/core/large/conditionals/LargeConditionals-maxtested.fs @@ -421,4 +421,4 @@ let expectedValues() = if rnd.Next(3) = 1 then 1 else 4 printfn "expectedValues() = %A" (expectedValues()) -System.IO.File.WriteAllLines("test.ok", ["ok"]) \ No newline at end of file +printf "TEST PASSED OK" ; \ No newline at end of file diff --git a/tests/fsharp/core/large/lets/LargeLets-500.fs b/tests/fsharp/core/large/lets/LargeLets-500.fs index 5a1aa0697bb..d4e5f29e270 100644 --- a/tests/fsharp/core/large/lets/LargeLets-500.fs +++ b/tests/fsharp/core/large/lets/LargeLets-500.fs @@ -506,4 +506,4 @@ let expectedValues() = let x = x + rnd.Next(3) x printfn "expectedValues() = %A" (expectedValues()) -System.IO.File.WriteAllLines("test.ok", ["ok"]) +printf "TEST PASSED OK" ; diff --git a/tests/fsharp/core/large/lets/LargeLets-maxtested.fs b/tests/fsharp/core/large/lets/LargeLets-maxtested.fs index 9f220268b6e..2c9a0ee6007 100644 --- a/tests/fsharp/core/large/lets/LargeLets-maxtested.fs +++ b/tests/fsharp/core/large/lets/LargeLets-maxtested.fs @@ -792,4 +792,4 @@ let expectedValues() = let x = x + rnd.Next(3) x printfn "expectedValues() = %A" (expectedValues()) -System.IO.File.WriteAllLines("test.ok", ["ok"]) +printf "TEST PASSED OK" ; diff --git a/tests/fsharp/core/large/lists/LargeList-500.fs b/tests/fsharp/core/large/lists/LargeList-500.fs index b46244887a7..0b610e54c1d 100644 --- a/tests/fsharp/core/large/lists/LargeList-500.fs +++ b/tests/fsharp/core/large/lists/LargeList-500.fs @@ -504,4 +504,4 @@ let expectedValues = 1 ] printfn "length = %d" expectedValues.Length -System.IO.File.WriteAllLines("test.ok", ["ok"]) \ No newline at end of file +printf "TEST PASSED OK" ; \ No newline at end of file diff --git a/tests/fsharp/core/large/matches/LargeMatches-200.fs b/tests/fsharp/core/large/matches/LargeMatches-200.fs index 4dac865609a..33624f1275b 100644 --- a/tests/fsharp/core/large/matches/LargeMatches-200.fs +++ b/tests/fsharp/core/large/matches/LargeMatches-200.fs @@ -306,4 +306,4 @@ let expectedValues() = | None -> 4 printfn "expectedValues() = %A" (expectedValues()) -System.IO.File.WriteAllLines("test.ok", ["ok"]) \ No newline at end of file +printf "TEST PASSED OK" ; \ No newline at end of file diff --git a/tests/fsharp/core/large/matches/LargeMatches-maxtested.fs b/tests/fsharp/core/large/matches/LargeMatches-maxtested.fs index a220824334d..1c992ab7a43 100644 --- a/tests/fsharp/core/large/matches/LargeMatches-maxtested.fs +++ b/tests/fsharp/core/large/matches/LargeMatches-maxtested.fs @@ -462,4 +462,4 @@ let expectedValues() = | None -> 4 printfn "expectedValues() = %A" (expectedValues()) -System.IO.File.WriteAllLines("test.ok", ["ok"]) \ No newline at end of file +printf "TEST PASSED OK" ; \ No newline at end of file diff --git a/tests/fsharp/core/large/mixed/LargeSequentialLet-500.fs b/tests/fsharp/core/large/mixed/LargeSequentialLet-500.fs index 404817e2a4f..966651362be 100644 --- a/tests/fsharp/core/large/mixed/LargeSequentialLet-500.fs +++ b/tests/fsharp/core/large/mixed/LargeSequentialLet-500.fs @@ -1008,4 +1008,4 @@ let expectedValues() = let mutable x = x + 1 x printfn "expectedValues() = %A" (expectedValues()) -System.IO.File.WriteAllLines("test.ok", ["ok"]) \ No newline at end of file +printf "TEST PASSED OK" ; \ No newline at end of file diff --git a/tests/fsharp/core/large/mixed/LargeSequentialLet-maxtested.fs b/tests/fsharp/core/large/mixed/LargeSequentialLet-maxtested.fs index 404817e2a4f..966651362be 100644 --- a/tests/fsharp/core/large/mixed/LargeSequentialLet-maxtested.fs +++ b/tests/fsharp/core/large/mixed/LargeSequentialLet-maxtested.fs @@ -1008,4 +1008,4 @@ let expectedValues() = let mutable x = x + 1 x printfn "expectedValues() = %A" (expectedValues()) -System.IO.File.WriteAllLines("test.ok", ["ok"]) \ No newline at end of file +printf "TEST PASSED OK" ; \ No newline at end of file diff --git a/tests/fsharp/core/large/sequential/LargeSequential-500.fs b/tests/fsharp/core/large/sequential/LargeSequential-500.fs index adfd85723c8..98709915acc 100644 --- a/tests/fsharp/core/large/sequential/LargeSequential-500.fs +++ b/tests/fsharp/core/large/sequential/LargeSequential-500.fs @@ -506,4 +506,4 @@ let expectedValues() = x <- x + rnd.Next(3) x printfn "expectedValues() = %A" (expectedValues()) -System.IO.File.WriteAllLines("test.ok", ["ok"]) \ No newline at end of file +printf "TEST PASSED OK" ; \ No newline at end of file diff --git a/tests/fsharp/core/large/sequential/LargeSequential-maxtested.fs b/tests/fsharp/core/large/sequential/LargeSequential-maxtested.fs index e28abe4c379..b5fcb01d945 100644 --- a/tests/fsharp/core/large/sequential/LargeSequential-maxtested.fs +++ b/tests/fsharp/core/large/sequential/LargeSequential-maxtested.fs @@ -6712,4 +6712,4 @@ let expectedValues() = x <- x + rnd.Next(3) x printfn "expectedValues() = %A" (expectedValues()) -System.IO.File.WriteAllLines("test.ok", ["ok"]) \ No newline at end of file +printf "TEST PASSED OK" ; \ No newline at end of file diff --git a/tests/fsharp/core/lazy/test.fsx b/tests/fsharp/core/lazy/test.fsx index 7b2424252df..a15a1aa33d8 100644 --- a/tests/fsharp/core/lazy/test.fsx +++ b/tests/fsharp/core/lazy/test.fsx @@ -78,7 +78,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/letrec-mutrec/test.fs b/tests/fsharp/core/letrec-mutrec/test.fs index 9f571cf2a9d..720b441cb38 100644 --- a/tests/fsharp/core/letrec-mutrec/test.fs +++ b/tests/fsharp/core/letrec-mutrec/test.fs @@ -203,6 +203,6 @@ do if !failures then (stdout.WriteLine "Test Failed"; exit 1) do (stdout.WriteLine "Test Passed"; - System.IO.File.WriteAllText("test.ok","ok"); + printf "TEST PASSED OK"; exit 0) #endif diff --git a/tests/fsharp/core/letrec-mutrec2/test.fs b/tests/fsharp/core/letrec-mutrec2/test.fs index e9a830ec488..c04592ad0f2 100644 --- a/tests/fsharp/core/letrec-mutrec2/test.fs +++ b/tests/fsharp/core/letrec-mutrec2/test.fs @@ -337,6 +337,6 @@ let aa = do (stdout.WriteLine "Test Passed"; - System.IO.File.WriteAllText("test.ok","ok"); + printf "TEST PASSED OK"; exit 0) #endif \ No newline at end of file diff --git a/tests/fsharp/core/letrec/test.fsx b/tests/fsharp/core/letrec/test.fsx index 27f03ce0213..9d7ea6fbea4 100644 --- a/tests/fsharp/core/letrec/test.fsx +++ b/tests/fsharp/core/letrec/test.fsx @@ -812,7 +812,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/libtest/test.fsx b/tests/fsharp/core/libtest/test.fsx index 370cb4918af..6df6e6e4432 100644 --- a/tests/fsharp/core/libtest/test.fsx +++ b/tests/fsharp/core/libtest/test.fsx @@ -5646,7 +5646,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/lift/test.fsx b/tests/fsharp/core/lift/test.fsx index f47e1ba5972..24ec381a256 100644 --- a/tests/fsharp/core/lift/test.fsx +++ b/tests/fsharp/core/lift/test.fsx @@ -64,7 +64,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/longnames/test.fsx b/tests/fsharp/core/longnames/test.fsx index 577dc547a6d..963f31d4b25 100644 --- a/tests/fsharp/core/longnames/test.fsx +++ b/tests/fsharp/core/longnames/test.fsx @@ -695,7 +695,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/map/test.fsx b/tests/fsharp/core/map/test.fsx index 2e80355e94a..b093d33ff33 100644 --- a/tests/fsharp/core/map/test.fsx +++ b/tests/fsharp/core/map/test.fsx @@ -177,7 +177,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/math/lalgebra/test.fsx b/tests/fsharp/core/math/lalgebra/test.fsx index c09351a1a99..30f8dda47f6 100644 --- a/tests/fsharp/core/math/lalgebra/test.fsx +++ b/tests/fsharp/core/math/lalgebra/test.fsx @@ -313,7 +313,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/math/numbers/test.fsx b/tests/fsharp/core/math/numbers/test.fsx index d9b8eb2edd7..7e1fb5ecb04 100644 --- a/tests/fsharp/core/math/numbers/test.fsx +++ b/tests/fsharp/core/math/numbers/test.fsx @@ -290,7 +290,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/math/numbersVS2008/test.fsx b/tests/fsharp/core/math/numbersVS2008/test.fsx index ec3adaf70c8..d51423a94f3 100644 --- a/tests/fsharp/core/math/numbersVS2008/test.fsx +++ b/tests/fsharp/core/math/numbersVS2008/test.fsx @@ -276,7 +276,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/measures/test.fsx b/tests/fsharp/core/measures/test.fsx index f1dec887c09..83357564018 100644 --- a/tests/fsharp/core/measures/test.fsx +++ b/tests/fsharp/core/measures/test.fsx @@ -612,7 +612,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/members/basics-hw-mutrec/test.fs b/tests/fsharp/core/members/basics-hw-mutrec/test.fs index 5b53e85196f..cd66176d435 100644 --- a/tests/fsharp/core/members/basics-hw-mutrec/test.fs +++ b/tests/fsharp/core/members/basics-hw-mutrec/test.fs @@ -37,6 +37,6 @@ module StaticInitializerTest3 = let _ = if not failures.Value.IsEmpty then (eprintfn "Test Failed, failures = %A" failures.Value; exit 1) else (stdout.WriteLine "Test Passed"; - System.IO.File.WriteAllText("test.ok","ok"); + printf "TEST PASSED OK"; exit 0) diff --git a/tests/fsharp/core/members/basics-hw/test.fsx b/tests/fsharp/core/members/basics-hw/test.fsx index e04a76f7ec2..641cb5dbc76 100644 --- a/tests/fsharp/core/members/basics-hw/test.fsx +++ b/tests/fsharp/core/members/basics-hw/test.fsx @@ -5663,7 +5663,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/members/basics/test.fs b/tests/fsharp/core/members/basics/test.fs index efcaa000692..466e6cdd5b7 100644 --- a/tests/fsharp/core/members/basics/test.fs +++ b/tests/fsharp/core/members/basics/test.fs @@ -3481,7 +3481,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/members/ctree/test.fsx b/tests/fsharp/core/members/ctree/test.fsx index 117a36d1c18..c12dcd73a61 100644 --- a/tests/fsharp/core/members/ctree/test.fsx +++ b/tests/fsharp/core/members/ctree/test.fsx @@ -64,7 +64,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/members/factors-mutrec/test.fs b/tests/fsharp/core/members/factors-mutrec/test.fs index 8619ec8e785..e8532addec1 100644 --- a/tests/fsharp/core/members/factors-mutrec/test.fs +++ b/tests/fsharp/core/members/factors-mutrec/test.fs @@ -152,6 +152,6 @@ let Gaussian1DPriorFactorNode((var: VariableNode), mean, variance) = let _ = if !failures then (stdout.WriteLine "Test Failed"; exit 1) else (stdout.WriteLine "Test Passed"; - System.IO.File.WriteAllText("test.ok","ok"); + printf "TEST PASSED OK"; exit 0) diff --git a/tests/fsharp/core/members/factors/test.fsx b/tests/fsharp/core/members/factors/test.fsx index b2ebe8dbcf4..e8b83b4fa6b 100644 --- a/tests/fsharp/core/members/factors/test.fsx +++ b/tests/fsharp/core/members/factors/test.fsx @@ -276,7 +276,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/members/incremental-hw-mutrec/test.fsx b/tests/fsharp/core/members/incremental-hw-mutrec/test.fsx index d8543c40291..a661090396c 100644 --- a/tests/fsharp/core/members/incremental-hw-mutrec/test.fsx +++ b/tests/fsharp/core/members/incremental-hw-mutrec/test.fsx @@ -659,6 +659,6 @@ module ExceptionsWithAugmentations = let _ = if !failures then (stdout.WriteLine "Test Failed"; exit 1) else (stdout.WriteLine "Test Passed"; - System.IO.File.WriteAllText("test.ok","ok"); + printf "TEST PASSED OK"; exit 0) diff --git a/tests/fsharp/core/members/incremental-hw/test.fsx b/tests/fsharp/core/members/incremental-hw/test.fsx index 0c3ede8a6b7..0fbc223b8e1 100644 --- a/tests/fsharp/core/members/incremental-hw/test.fsx +++ b/tests/fsharp/core/members/incremental-hw/test.fsx @@ -740,7 +740,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/members/incremental/test.fsx b/tests/fsharp/core/members/incremental/test.fsx index 57015d42851..88b493e0cda 100644 --- a/tests/fsharp/core/members/incremental/test.fsx +++ b/tests/fsharp/core/members/incremental/test.fsx @@ -717,7 +717,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/members/ops-mutrec/test.fs b/tests/fsharp/core/members/ops-mutrec/test.fs index 1ff8f31135f..b4eae93feb8 100644 --- a/tests/fsharp/core/members/ops-mutrec/test.fs +++ b/tests/fsharp/core/members/ops-mutrec/test.fs @@ -382,6 +382,6 @@ module TraitCallsAndConstructors = let _ = if !failures then (stdout.WriteLine "Test Failed"; exit 1) else (stdout.WriteLine "Test Passed"; - System.IO.File.WriteAllText("test.ok","ok"); + printf "TEST PASSED OK" exit 0) diff --git a/tests/fsharp/core/members/ops/test.fsx b/tests/fsharp/core/members/ops/test.fsx index a7b611ee9cd..c8ef75f93be 100644 --- a/tests/fsharp/core/members/ops/test.fsx +++ b/tests/fsharp/core/members/ops/test.fsx @@ -416,7 +416,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/members/self-identifier/version46/test.fs b/tests/fsharp/core/members/self-identifier/version46/test.fs index 5a53a84a4cb..8bd41b0555c 100644 --- a/tests/fsharp/core/members/self-identifier/version46/test.fs +++ b/tests/fsharp/core/members/self-identifier/version46/test.fs @@ -54,7 +54,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/members/self-identifier/version47/test.fs b/tests/fsharp/core/members/self-identifier/version47/test.fs index 76bc777ae0d..2a648678b4e 100644 --- a/tests/fsharp/core/members/self-identifier/version47/test.fs +++ b/tests/fsharp/core/members/self-identifier/version47/test.fs @@ -76,7 +76,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/nameof/preview/test.fsx b/tests/fsharp/core/nameof/preview/test.fsx index 0a952ab823f..4921b12d53e 100644 --- a/tests/fsharp/core/nameof/preview/test.fsx +++ b/tests/fsharp/core/nameof/preview/test.fsx @@ -417,7 +417,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/namespaces/test2.fs b/tests/fsharp/core/namespaces/test2.fs index 4ad843fb442..90a5d6bfe41 100644 --- a/tests/fsharp/core/namespaces/test2.fs +++ b/tests/fsharp/core/namespaces/test2.fs @@ -28,7 +28,7 @@ module UnionTestsWithSignature = exit 1 else stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 #endif diff --git a/tests/fsharp/core/nested/test.fsx b/tests/fsharp/core/nested/test.fsx index 388db9ecc23..410d0f510a3 100644 --- a/tests/fsharp/core/nested/test.fsx +++ b/tests/fsharp/core/nested/test.fsx @@ -64,7 +64,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/patterns/test.fsx b/tests/fsharp/core/patterns/test.fsx index 1eb20080910..dce360f5996 100644 --- a/tests/fsharp/core/patterns/test.fsx +++ b/tests/fsharp/core/patterns/test.fsx @@ -1735,7 +1735,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/pinvoke/test.fsx b/tests/fsharp/core/pinvoke/test.fsx index 7f83b24fd41..29c079e145d 100644 --- a/tests/fsharp/core/pinvoke/test.fsx +++ b/tests/fsharp/core/pinvoke/test.fsx @@ -152,7 +152,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | messages -> printfn "%A" messages diff --git a/tests/fsharp/core/printf-interpolated/test.fsx b/tests/fsharp/core/printf-interpolated/test.fsx index b1891f31ad9..810d7bfd675 100644 --- a/tests/fsharp/core/printf-interpolated/test.fsx +++ b/tests/fsharp/core/printf-interpolated/test.fsx @@ -292,7 +292,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/printf/test.fsx b/tests/fsharp/core/printf/test.fsx index cf78d1a8cbd..a3ae40791a3 100644 --- a/tests/fsharp/core/printf/test.fsx +++ b/tests/fsharp/core/printf/test.fsx @@ -9339,7 +9339,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/queriesCustomQueryOps/test.fsx b/tests/fsharp/core/queriesCustomQueryOps/test.fsx index d542e5d0f4d..4b26f71babd 100644 --- a/tests/fsharp/core/queriesCustomQueryOps/test.fsx +++ b/tests/fsharp/core/queriesCustomQueryOps/test.fsx @@ -459,7 +459,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/queriesLeafExpressionConvert/test.fsx b/tests/fsharp/core/queriesLeafExpressionConvert/test.fsx index 59583445916..da0505782be 100644 --- a/tests/fsharp/core/queriesLeafExpressionConvert/test.fsx +++ b/tests/fsharp/core/queriesLeafExpressionConvert/test.fsx @@ -1004,7 +1004,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/queriesNullableOperators/test.fsx b/tests/fsharp/core/queriesNullableOperators/test.fsx index 1cb230749b5..5e400fb5644 100644 --- a/tests/fsharp/core/queriesNullableOperators/test.fsx +++ b/tests/fsharp/core/queriesNullableOperators/test.fsx @@ -311,7 +311,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/queriesOverIEnumerable/test.fsx b/tests/fsharp/core/queriesOverIEnumerable/test.fsx index cb77ad63828..fefcdc309f3 100644 --- a/tests/fsharp/core/queriesOverIEnumerable/test.fsx +++ b/tests/fsharp/core/queriesOverIEnumerable/test.fsx @@ -1002,7 +1002,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/queriesOverIQueryable/test.fsx b/tests/fsharp/core/queriesOverIQueryable/test.fsx index c6e507dfa61..d5a8b6c6858 100644 --- a/tests/fsharp/core/queriesOverIQueryable/test.fsx +++ b/tests/fsharp/core/queriesOverIQueryable/test.fsx @@ -2445,7 +2445,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/quotes/test.fsx b/tests/fsharp/core/quotes/test.fsx index 41efacfbc8d..7aa339449cf 100644 --- a/tests/fsharp/core/quotes/test.fsx +++ b/tests/fsharp/core/quotes/test.fsx @@ -5938,7 +5938,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | errs -> printfn "Test Failed, errors = %A" errs diff --git a/tests/fsharp/core/quotesDebugInfo/test.fsx b/tests/fsharp/core/quotesDebugInfo/test.fsx index 63b68a71777..e2bdcd55ce3 100644 --- a/tests/fsharp/core/quotesDebugInfo/test.fsx +++ b/tests/fsharp/core/quotesDebugInfo/test.fsx @@ -646,7 +646,7 @@ let aa = match !failures with | 0 -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/quotesInMultipleModules/module2.fsx b/tests/fsharp/core/quotesInMultipleModules/module2.fsx index 62a2f9e6e21..c24c10e54bf 100644 --- a/tests/fsharp/core/quotesInMultipleModules/module2.fsx +++ b/tests/fsharp/core/quotesInMultipleModules/module2.fsx @@ -37,7 +37,7 @@ if not test3 then if test1 && test2 && test3 then stdout.WriteLine "Test Passed"; - System.IO.File.WriteAllText("test.ok","ok"); + printf "TEST PASSED OK"; exit 0 else exit 1 diff --git a/tests/fsharp/core/recordResolution/test.fsx b/tests/fsharp/core/recordResolution/test.fsx index 13af38e0d92..545b7b81a7b 100644 --- a/tests/fsharp/core/recordResolution/test.fsx +++ b/tests/fsharp/core/recordResolution/test.fsx @@ -56,5 +56,5 @@ module Ex3 = let a2 = { FA = 1 } let r = a2 :> A2 //this produces warnings, but proves that a2 is indeed of type A2. -System.IO.File.WriteAllText("test.ok","ok") +printf "TEST PASSED OK" ; exit 0 \ No newline at end of file diff --git a/tests/fsharp/core/reflect/test2.fs b/tests/fsharp/core/reflect/test2.fs index 5b4a58e5b8e..78e876605a9 100644 --- a/tests/fsharp/core/reflect/test2.fs +++ b/tests/fsharp/core/reflect/test2.fs @@ -330,7 +330,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/refnormalization/test.fs b/tests/fsharp/core/refnormalization/test.fs index 40c34e96927..994868999e5 100644 --- a/tests/fsharp/core/refnormalization/test.fs +++ b/tests/fsharp/core/refnormalization/test.fs @@ -25,5 +25,5 @@ let main args = printfn "Actual: %A " versions 1 else - File.WriteAllText("test.ok", "ok") + printf "TEST PASSED OK" ; 0 diff --git a/tests/fsharp/core/seq/test.fsx b/tests/fsharp/core/seq/test.fsx index b62a55882aa..62f39fe5f3c 100644 --- a/tests/fsharp/core/seq/test.fsx +++ b/tests/fsharp/core/seq/test.fsx @@ -768,7 +768,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/state-machines/test.fsx b/tests/fsharp/core/state-machines/test.fsx index 5fae4c96b7a..f171bfdbe7b 100644 --- a/tests/fsharp/core/state-machines/test.fsx +++ b/tests/fsharp/core/state-machines/test.fsx @@ -663,7 +663,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/subtype/test.fsx b/tests/fsharp/core/subtype/test.fsx index 688682206e0..820c8566502 100644 --- a/tests/fsharp/core/subtype/test.fsx +++ b/tests/fsharp/core/subtype/test.fsx @@ -2545,7 +2545,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/syntax/test.fsx b/tests/fsharp/core/syntax/test.fsx index c961992da28..c85225a5a73 100644 --- a/tests/fsharp/core/syntax/test.fsx +++ b/tests/fsharp/core/syntax/test.fsx @@ -1841,7 +1841,7 @@ let aa = match !failures with | false -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/tlr/test.fsx b/tests/fsharp/core/tlr/test.fsx index bb8f1bcbf94..3d799fd1fd9 100644 --- a/tests/fsharp/core/tlr/test.fsx +++ b/tests/fsharp/core/tlr/test.fsx @@ -380,7 +380,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/topinit/test_deterministic_init.fs b/tests/fsharp/core/topinit/test_deterministic_init.fs index ea3d5f9df1d..55474ff38a2 100644 --- a/tests/fsharp/core/topinit/test_deterministic_init.fs +++ b/tests/fsharp/core/topinit/test_deterministic_init.fs @@ -597,5 +597,5 @@ printfn "Touching value in module Lib85..." printfn " --> Lib85.x = %A" Lib85.x printfn "Checking this did cause initialization of module Lib85..." checkInitialized "Lib85" InitFlag85.init -System.IO.File.WriteAllText("test.ok","ok") +printf "TEST PASSED OK" ; exit 0 diff --git a/tests/fsharp/core/unicode/test.fsx b/tests/fsharp/core/unicode/test.fsx index 10089e9dd0b..3954ee440cd 100644 --- a/tests/fsharp/core/unicode/test.fsx +++ b/tests/fsharp/core/unicode/test.fsx @@ -139,7 +139,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/unitsOfMeasure/test.fs b/tests/fsharp/core/unitsOfMeasure/test.fs index b2a40a8759f..fa7244122aa 100644 --- a/tests/fsharp/core/unitsOfMeasure/test.fs +++ b/tests/fsharp/core/unitsOfMeasure/test.fs @@ -201,7 +201,7 @@ let main argv = // test2 for _ in CreateBadImageFormatException () do () - System.IO.File.WriteAllText("test.ok","ok"); + printf "TEST PASSED OK"; match failures with | [] -> diff --git a/tests/fsharp/perf/graph/test.ml b/tests/fsharp/perf/graph/test.ml index 1e34121064f..e19614be84e 100644 --- a/tests/fsharp/perf/graph/test.ml +++ b/tests/fsharp/perf/graph/test.ml @@ -538,5 +538,5 @@ end let _ = test() do (System.Console.WriteLine "Test Passed"; - System.IO.File.WriteAllText ("test.ok", "ok"); + printf "TEST PASSED OK"; exit 0) diff --git a/tests/fsharp/perf/nbody/test.ml b/tests/fsharp/perf/nbody/test.ml index 4ec5b9862a1..06b94f4c674 100644 --- a/tests/fsharp/perf/nbody/test.ml +++ b/tests/fsharp/perf/nbody/test.ml @@ -143,6 +143,6 @@ let _ = test "dce98nj" (main 500000 = "-0.169096567") do (System.Console.WriteLine "Test Passed"; - System.IO.File.WriteAllText ("test.ok", "ok"); + printf "TEST PASSED OK"; exit 0) diff --git a/tests/fsharp/regression/12322/test.fsx b/tests/fsharp/regression/12322/test.fsx index 755937aedd4..855a3a2bb51 100644 --- a/tests/fsharp/regression/12322/test.fsx +++ b/tests/fsharp/regression/12322/test.fsx @@ -1489,6 +1489,6 @@ module LotsOfLets = // This is a compilation test, not a lot actually happens in the test do (System.Console.Out.WriteLine "Test Passed"; - System.IO.File.WriteAllText("test.ok", "ok"); + printf "TEST PASSED OK" ; exit 0) diff --git a/tests/fsharp/regression/12383/test.fs b/tests/fsharp/regression/12383/test.fs index ae10696c9ae..b94d328988d 100644 --- a/tests/fsharp/regression/12383/test.fs +++ b/tests/fsharp/regression/12383/test.fs @@ -2940,6 +2940,6 @@ let inline translate opcode = let translate2 opcode = translate opcode do (System.Console.Out.WriteLine "Test Passed"; - System.IO.File.WriteAllText("test.ok", "ok"); + printf "TEST PASSED OK" ; exit 0) diff --git a/tests/fsharp/regression/13219/test.fsx b/tests/fsharp/regression/13219/test.fsx index c6ff7817805..be2ff9c7421 100644 --- a/tests/fsharp/regression/13219/test.fsx +++ b/tests/fsharp/regression/13219/test.fsx @@ -18,5 +18,5 @@ type System.Object with // This is a compilation test, not a lot actually happens in the test do (System.Console.Out.WriteLine "Test Passed"; - System.IO.File.WriteAllText("test.ok", "ok"); + printf "TEST PASSED OK" ; exit 0) diff --git a/tests/fsharp/regression/13710/test.fsx b/tests/fsharp/regression/13710/test.fsx index e80a3ecd54b..22b0c34dcec 100644 --- a/tests/fsharp/regression/13710/test.fsx +++ b/tests/fsharp/regression/13710/test.fsx @@ -12,6 +12,6 @@ printfn $"{auth.Test}" // This is a compilation test, not a lot actually happens in the test do (System.Console.Out.WriteLine "Test Passed"; - System.IO.File.WriteAllText("test.ok", "ok"); + printf "TEST PASSED OK" ; exit 0) diff --git a/tests/fsharp/regression/26/test.ml b/tests/fsharp/regression/26/test.ml index 525ae7c5e97..287a42bed6a 100644 --- a/tests/fsharp/regression/26/test.ml +++ b/tests/fsharp/regression/26/test.ml @@ -27,6 +27,6 @@ let _ = if (compare [| |] [| |] <> 0) then fail "Test Failed (abcwlvero02)" let _ = System.Console.Error.WriteLine "Test Passed" do (System.Console.Out.WriteLine "Test Passed"; - System.IO.File.WriteAllText("test.ok", "ok"); + printf "TEST PASSED OK"; exit 0) diff --git a/tests/fsharp/regression/321/test.ml b/tests/fsharp/regression/321/test.ml index 8669efdbbb8..61f99fc21ac 100644 --- a/tests/fsharp/regression/321/test.ml +++ b/tests/fsharp/regression/321/test.ml @@ -25,5 +25,5 @@ exception Bad_xml_structure of string let _ = (System.Console.Out.WriteLine "Test Passed"; - System.IO.File.WriteAllText("test.ok", "ok"); + printf "TEST PASSED OK"; exit 0) diff --git a/tests/fsharp/regression/655/main.fs b/tests/fsharp/regression/655/main.fs index 2a5f4da2d93..424f52c3b36 100644 --- a/tests/fsharp/regression/655/main.fs +++ b/tests/fsharp/regression/655/main.fs @@ -6,7 +6,7 @@ let xI = x :> Datafile let _ = (System.Console.Out.WriteLine "Test Passed"; - System.IO.File.WriteAllText("test.ok", "ok"); + printf "TEST PASSED OK" ; exit 0) diff --git a/tests/fsharp/regression/656/form.fs b/tests/fsharp/regression/656/form.fs index 70bd3f707c2..de189dba38f 100644 --- a/tests/fsharp/regression/656/form.fs +++ b/tests/fsharp/regression/656/form.fs @@ -928,5 +928,5 @@ do Application.Run(mainForm) let _ = (System.Console.Out.WriteLine "Test Passed"; - System.IO.File.WriteAllText("test.ok", "ok"); + printf "TEST PASSED OK" ; exit 0) diff --git a/tests/fsharp/regression/83/test.ml b/tests/fsharp/regression/83/test.ml index 5dad355c937..1188cc35d02 100644 --- a/tests/fsharp/regression/83/test.ml +++ b/tests/fsharp/regression/83/test.ml @@ -41,6 +41,6 @@ let _ = if !failures then (System.Console.Out.WriteLine "Test Failed"; exit 1) do (System.Console.Out.WriteLine "Test Passed"; - System.IO.File.WriteAllText("test.ok", "ok"); + printf "TEST PASSED OK"; exit 0) diff --git a/tests/fsharp/regression/84/test.ml b/tests/fsharp/regression/84/test.ml index b2e868f53b8..b8f9ec7ce0c 100644 --- a/tests/fsharp/regression/84/test.ml +++ b/tests/fsharp/regression/84/test.ml @@ -5,7 +5,7 @@ let _ = | true -> (System.Console.Out.WriteLine "Test Failed"; exit 1) | false -> (System.Console.Out.WriteLine "Test Passed"; - System.IO.File.WriteAllText("test.ok", "ok"); + printf "TEST PASSED OK"; exit 0) let _ = (System.Console.Out.WriteLine "Test Ended"; exit 100) diff --git a/tests/fsharp/regression/86/test.ml b/tests/fsharp/regression/86/test.ml index 4b1abe343f6..2ec7219e0be 100644 --- a/tests/fsharp/regression/86/test.ml +++ b/tests/fsharp/regression/86/test.ml @@ -4,7 +4,7 @@ let _ = if '\\' = '\092' & "\\" = "\092" then (System.Console.Out.WriteLine "Test Passed"; - System.IO.File.WriteAllText("test.ok", "ok"); + printf "TEST PASSED OK"; exit 0) else (System.Console.Out.WriteLine "Test Failed"; exit 1) diff --git a/tests/fsharp/regression/OverloadResolution-bug/test.fsx b/tests/fsharp/regression/OverloadResolution-bug/test.fsx index ff87afb18cb..c3d3669c450 100644 --- a/tests/fsharp/regression/OverloadResolution-bug/test.fsx +++ b/tests/fsharp/regression/OverloadResolution-bug/test.fsx @@ -31,5 +31,5 @@ module TestOfObj = | _ -> None - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; printfn "Succeeded" diff --git a/tests/fsharp/regression/literal-value-bug-2/test.fsx b/tests/fsharp/regression/literal-value-bug-2/test.fsx index e529df8c863..fa15406ebcc 100644 --- a/tests/fsharp/regression/literal-value-bug-2/test.fsx +++ b/tests/fsharp/regression/literal-value-bug-2/test.fsx @@ -30,7 +30,7 @@ let result = 1 if result = 0 then - System.IO.File.WriteAllText("test.ok","ok"); + printf "TEST PASSED OK"; printfn "Succeeded" else printfn "Failed: %d" result diff --git a/tests/fsharp/regression/struct-tuple-bug-1/test.fsx b/tests/fsharp/regression/struct-tuple-bug-1/test.fsx index e70c5934575..88852695706 100644 --- a/tests/fsharp/regression/struct-tuple-bug-1/test.fsx +++ b/tests/fsharp/regression/struct-tuple-bug-1/test.fsx @@ -14,7 +14,7 @@ let _ = printfn "Test Failed" exit 1 else - printfn "Test Passed" - System.IO.File.WriteAllText("test.ok", "ok") + printf "TEST PASSED OK" + printf "TEST PASSED OK" ; exit 0 () \ No newline at end of file diff --git a/tests/fsharp/regression/tuple-bug-1/test.ml b/tests/fsharp/regression/tuple-bug-1/test.ml index d839ccd0733..bead09c38dd 100644 --- a/tests/fsharp/regression/tuple-bug-1/test.ml +++ b/tests/fsharp/regression/tuple-bug-1/test.ml @@ -25,6 +25,6 @@ let _ = if !failures then (System.Console.Out.WriteLine "Test Failed"; exit 1) else (System.Console.Out.WriteLine "Test Passed"; - System.IO.File.WriteAllText("test.ok", "ok"); + printf "TEST PASSED OK"; exit 0) diff --git a/tests/fsharp/single-test.fs b/tests/fsharp/single-test.fs index a84de9a8c94..5869e27aee0 100644 --- a/tests/fsharp/single-test.fs +++ b/tests/fsharp/single-test.fs @@ -87,6 +87,9 @@ let generateOverrides = let template = @" + + + " template @@ -189,7 +192,6 @@ let generateProjectArtifacts (pc:ProjectConfiguration) outputType (targetFramewo - " template |> replace "$(UTILITYSOURCEITEMS)" pc.UtilitySourceItems false false CompileItem.Compile @@ -209,7 +211,6 @@ let generateProjectArtifacts (pc:ProjectConfiguration) outputType (targetFramewo |> replaceTokens "$(RestoreFromArtifactsPath)" (Path.GetFullPath(__SOURCE_DIRECTORY__) + "/../../artifacts/packages/" + configuration) generateProjBody -let lockObj = obj() let singleTestBuildAndRunCore cfg copyFiles p languageVersion = let sources = [] let loadSources = [] @@ -225,22 +226,7 @@ let singleTestBuildAndRunCore cfg copyFiles p languageVersion = // targetFramework optimize = "net472" OR net5.0 etc ... // optimize = true or false let executeSingleTestBuildAndRun outputType compilerType targetFramework optimize buildOnly = - let mutable result = false - let directory = - let mutable result = "" - lock lockObj <| (fun () -> - let rec loop () = - let pathToArtifacts = Path.GetFullPath(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "../../../..")) - if Path.GetFileName(pathToArtifacts) <> "artifacts" then failwith "FSharp.Cambridge did not find artifacts directory --- has the location changed????" - let pathToTemp = Path.Combine(pathToArtifacts, "Temp") - let projectDirectory = Path.Combine(pathToTemp, "FSharp.Cambridge", Guid.NewGuid().ToString() + ".tmp") - if Directory.Exists(projectDirectory) then - loop () - else - Directory.CreateDirectory(projectDirectory) |>ignore - projectDirectory - result <- loop()) - result + let directory = cfg.Directory let pc = { OutputType = outputType @@ -269,47 +255,30 @@ let singleTestBuildAndRunCore cfg copyFiles p languageVersion = let propsFileName = Path.Combine(directory, "Directory.Build.props") let overridesFileName = Path.Combine(directory, "Directory.Overrides.targets") let projectFileName = Path.Combine(directory, Guid.NewGuid().ToString() + ".tmp" + ".fsproj") - try - // Clean up directory - Directory.CreateDirectory(directory) |> ignore - copyFilesToDest cfg.Directory directory - try File.Delete(Path.Combine(directory, "FSharp.Core.dll")) with _ -> () - emitFile targetsFileName targetsBody - emitFile overridesFileName overridesBody - let buildOutputFile = Path.Combine(directory, "buildoutput.txt") - if outputType = OutputType.Exe then - let executeFsc testCompilerVersion targetFramework = - let propsBody = generateProps testCompilerVersion cfg.BUILD_CONFIG - emitFile propsFileName propsBody - let projectBody = generateProjectArtifacts pc outputType targetFramework cfg.BUILD_CONFIG languageVersion - emitFile projectFileName projectBody - use testOkFile = new FileGuard(Path.Combine(directory, "test.ok")) - let cfg = { cfg with Directory = directory } - let result = execBothToOutNoCheck cfg directory buildOutputFile cfg.DotNetExe (sprintf "run -f %s" targetFramework) - if not (buildOnly) then - result |> checkResult - testOkFile.CheckExists() - executeFsc compilerType targetFramework - if buildOnly then verifyResults (findFirstSourceFile pc) buildOutputFile - else - let executeFsi testCompilerVersion targetFramework = - let propsBody = generateProps testCompilerVersion cfg.BUILD_CONFIG - emitFile propsFileName propsBody - let projectBody = generateProjectArtifacts pc outputType targetFramework cfg.BUILD_CONFIG languageVersion - emitFile projectFileName projectBody - use testOkFile = new FileGuard(Path.Combine(directory, "test.ok")) - let cfg = { cfg with Directory = directory } - execBothToOut cfg directory buildOutputFile cfg.DotNetExe "build /t:RunFSharpScript" - testOkFile.CheckExists() - executeFsi compilerType targetFramework - result <- true - finally - if result <> false then - try Directory.Delete(directory, true) with _ -> () - else - printfn "Configuration: %s" cfg.Directory - printfn "Directory: %s" directory - printfn "Filename: %s" projectFileName + emitFile targetsFileName targetsBody + emitFile overridesFileName overridesBody + let buildOutputFile = Path.Combine(directory, "buildoutput.txt") + if outputType = OutputType.Exe then + let executeFsc testCompilerVersion targetFramework = + let propsBody = generateProps testCompilerVersion cfg.BUILD_CONFIG + emitFile propsFileName propsBody + let projectBody = generateProjectArtifacts pc outputType targetFramework cfg.BUILD_CONFIG languageVersion + emitFile projectFileName projectBody + let cfg = { cfg with Directory = directory } + let result = execBothToOutNoCheck cfg directory buildOutputFile cfg.DotNetExe (sprintf "run -f %s" targetFramework) + if not (buildOnly) then + result |> checkResultPassed + executeFsc compilerType targetFramework + if buildOnly then verifyResults (findFirstSourceFile pc) buildOutputFile + else + let executeFsi testCompilerVersion targetFramework = + let propsBody = generateProps testCompilerVersion cfg.BUILD_CONFIG + emitFile propsFileName propsBody + let projectBody = generateProjectArtifacts pc outputType targetFramework cfg.BUILD_CONFIG languageVersion + emitFile projectFileName projectBody + let cfg = { cfg with Directory = directory } + execBothToOutCheckPassed cfg directory buildOutputFile cfg.DotNetExe $"build /t:RunFSharpScriptAndPrintOutput" + executeFsi compilerType targetFramework match p with #if NETCOREAPP @@ -321,19 +290,15 @@ let singleTestBuildAndRunCore cfg copyFiles p languageVersion = | FSI_NETFX_STDIN -> use _cleanup = (cleanUpFSharpCore cfg) - use testOkFile = new FileGuard (getfullpath cfg "test.ok") let sources = extraSources |> List.filter (fileExists cfg) - fsiStdin cfg (sources |> List.rev |> List.head) "" [] //use last file, because `cmd < a.txt b.txt` redirect b.txt only - - testOkFile.CheckExists() + fsiStdinCheckPassed cfg (sources |> List.rev |> List.head) "" [] //use last file, because `cmd < a.txt b.txt` redirect b.txt only | FSC_NETFX_TEST_ROUNDTRIP_AS_DLL -> // Compile as a DLL to exercise pickling of interface data, then recompile the original source file referencing this DLL // The second compilation will not utilize the information from the first in any meaningful way, but the // compiler will unpickle the interface and optimization data, so we test unpickling as well. use _cleanup = (cleanUpFSharpCore cfg) - use testOkFile = new FileGuard (getfullpath cfg "test.ok") let sources = extraSources |> List.filter (fileExists cfg) @@ -343,9 +308,8 @@ let singleTestBuildAndRunCore cfg copyFiles p languageVersion = peverify cfg "test--optimize-lib.dll" peverify cfg "test--optimize-client-of-lib.exe" - exec cfg ("." ++ "test--optimize-client-of-lib.exe") "" + execAndCheckPassed cfg ("." ++ "test--optimize-client-of-lib.exe") "" - testOkFile.CheckExists() #endif let singleTestBuildAndRunAux cfg p = diff --git a/tests/fsharp/tests.fs b/tests/fsharp/tests.fs index 7fdab667a00..ed99adda96a 100644 --- a/tests/fsharp/tests.fs +++ b/tests/fsharp/tests.fs @@ -35,37 +35,32 @@ module CoreTests = let ``subtype-langversion-checknulls`` () = let cfg = testConfig "core/subtype" - use testOkFile = fileguard cfg "test.ok" + fsc cfg "%s -o:test-checknulls.exe -g --checknulls" cfg.fsc_flags ["test.fsx"] - exec cfg ("." ++ "test-checknulls.exe") "" + execAndCheckPassed cfg ("." ++ "test-checknulls.exe") "" - testOkFile.CheckExists() [] let ``subtype-langversion-no-checknulls`` () = let cfg = testConfig "core/subtype" - use testOkFile = fileguard cfg "test.ok" + fsc cfg "%s -o:test-no-checknulls.exe -g --checknulls-" cfg.fsc_flags ["test.fsx"] - exec cfg ("." ++ "test-no-checknulls.exe") "" + execAndCheckPassed cfg ("." ++ "test-no-checknulls.exe") "" - testOkFile.CheckExists() [] let ``subtype-langversion-46`` () = let cfg = testConfig "core/subtype" - use testOkFile = fileguard cfg "test.ok" - fsc cfg "%s -o:test-langversion-46.exe -g --langversion:4.6" cfg.fsc_flags ["test.fsx"] - exec cfg ("." ++ "test-langversion-46.exe") "" + execAndCheckPassed cfg ("." ++ "test-langversion-46.exe") "" - testOkFile.CheckExists() #endif @@ -94,75 +89,71 @@ module CoreTests = let cfg = { cfg with fsc_flags = sprintf "%s --preferreduilang:en-US --test:StackSpan" cfg.fsc_flags} begin - use testOkFile = fileguard cfg "test.ok" + singleNegTest cfg "test" fsc cfg "%s -o:test.exe -g" cfg.fsc_flags ["test.fsx"] // Execution is disabled until we can be sure .NET 4.7.2 is on the machine - //exec cfg ("." ++ "test.exe") "" + //execAndCheckPassed cfg ("." ++ "test.exe") "" - //testOkFile.CheckExists() + //checkPassed() end begin - use testOkFile = fileguard cfg "test2.ok" singleNegTest cfg "test2" fsc cfg "%s -o:test2.exe -g" cfg.fsc_flags ["test2.fsx"] // Execution is disabled until we can be sure .NET 4.7.2 is on the machine - //exec cfg ("." ++ "test.exe") "" + //execAndCheckPassed cfg ("." ++ "test.exe") "" - //testOkFile.CheckExists() + //checkPassed() end begin - use testOkFile = fileguard cfg "test3.ok" singleNegTest cfg "test3" fsc cfg "%s -o:test3.exe -g" cfg.fsc_flags ["test3.fsx"] // Execution is disabled until we can be sure .NET 4.7.2 is on the machine - //exec cfg ("." ++ "test.exe") "" + //execAndCheckPassed cfg ("." ++ "test.exe") "" - //testOkFile.CheckExists() + //checkPassed() end [] let asyncStackTraces () = let cfg = testConfig "core/asyncStackTraces" - use testOkFile = fileguard cfg "test.ok" + fsc cfg "%s -o:test.exe -g --tailcalls- --optimize-" cfg.fsc_flags ["test.fsx"] - exec cfg ("." ++ "test.exe") "" + execAndCheckPassed cfg ("." ++ "test.exe") "" - testOkFile.CheckExists() [] let ``state-machines-non-optimized`` () = let cfg = testConfig "core/state-machines" - use testOkFile = fileguard cfg "test.ok" + fsc cfg "%s -o:test.exe -g --tailcalls- --optimize-" cfg.fsc_flags ["test.fsx"] peverify cfg "test.exe" - exec cfg ("." ++ "test.exe") "" + execAndCheckPassed cfg ("." ++ "test.exe") "" - testOkFile.CheckExists() [] let ``state-machines-optimized`` () = let cfg = testConfig "core/state-machines" - use testOkFile = fileguard cfg "test.ok" + fsc cfg "%s -o:test.exe -g --tailcalls+ --optimize+" cfg.fsc_flags ["test.fsx"] @@ -170,7 +161,6 @@ module CoreTests = exec cfg ("." ++ "test.exe") "" - testOkFile.CheckExists() [] let ``state-machines neg-resumable-01`` () = @@ -186,90 +176,79 @@ module CoreTests = [] let ``lots-of-conditionals``() = let cfg = testConfig "core/large/conditionals" - use testOkFile = fileguard cfg "test.ok" + fsc cfg "%s -o:test.exe " cfg.fsc_flags ["LargeConditionals-200.fs"] - exec cfg ("." ++ "test.exe") "" - testOkFile.CheckExists() + execAndCheckPassed cfg ("." ++ "test.exe") "" [] let ``lots-of-conditionals-maxtested``() = let cfg = testConfig "core/large/conditionals" - use testOkFile = fileguard cfg "test.ok" + fsc cfg "%s -o:test.exe " cfg.fsc_flags ["LargeConditionals-maxtested.fs"] - exec cfg ("." ++ "test.exe") "" - testOkFile.CheckExists() + execAndCheckPassed cfg ("." ++ "test.exe") "" [] let ``lots-of-lets``() = let cfg = testConfig "core/large/lets" - use testOkFile = fileguard cfg "test.ok" + fsc cfg "%s -o:test.exe " cfg.fsc_flags ["LargeLets-500.fs"] - exec cfg ("." ++ "test.exe") "" - testOkFile.CheckExists() + execAndCheckPassed cfg ("." ++ "test.exe") "" [] let ``lots-of-lets-maxtested``() = let cfg = testConfig "core/large/lets" - use testOkFile = fileguard cfg "test.ok" + fsc cfg "%s -o:test.exe " cfg.fsc_flags ["LargeLets-maxtested.fs"] - exec cfg ("." ++ "test.exe") "" - testOkFile.CheckExists() + execAndCheckPassed cfg ("." ++ "test.exe") "" [] let ``lots-of-lists``() = let cfg = testConfig "core/large/lists" - use testOkFile = fileguard cfg "test.ok" + fsc cfg "%s -o:test-500.exe " cfg.fsc_flags ["LargeList-500.fs"] - exec cfg ("." ++ "test-500.exe") "" - testOkFile.CheckExists() + execAndCheckPassed cfg ("." ++ "test-500.exe") "" [] let ``lots-of-matches``() = let cfg = testConfig "core/large/matches" - use testOkFile = fileguard cfg "test.ok" + fsc cfg "%s -o:test.exe " cfg.fsc_flags ["LargeMatches-200.fs"] - exec cfg ("." ++ "test.exe") "" - testOkFile.CheckExists() + execAndCheckPassed cfg ("." ++ "test.exe") "" [] let ``lots-of-matches-maxtested``() = let cfg = testConfig "core/large/matches" - use testOkFile = fileguard cfg "test.ok" + fsc cfg "%s -o:test.exe " cfg.fsc_flags ["LargeMatches-maxtested.fs"] - exec cfg ("." ++ "test.exe") "" - testOkFile.CheckExists() + execAndCheckPassed cfg ("." ++ "test.exe") "" [] let ``lots-of-sequential-and-let``() = let cfg = testConfig "core/large/mixed" - use testOkFile = fileguard cfg "test.ok" + fsc cfg "%s -o:test.exe " cfg.fsc_flags ["LargeSequentialLet-500.fs"] - exec cfg ("." ++ "test.exe") "" - testOkFile.CheckExists() + execAndCheckPassed cfg ("." ++ "test.exe") "" [] let ``lots-of-sequential-and-let-maxtested``() = let cfg = testConfig "core/large/mixed" - use testOkFile = fileguard cfg "test.ok" + fsc cfg "%s -o:test.exe " cfg.fsc_flags ["LargeSequentialLet-maxtested.fs"] - exec cfg ("." ++ "test.exe") "" - testOkFile.CheckExists() + execAndCheckPassed cfg ("." ++ "test.exe") "" [] let ``lots-of-sequential``() = let cfg = testConfig "core/large/sequential" - use testOkFile = fileguard cfg "test.ok" + fsc cfg "%s -o:test.exe " cfg.fsc_flags ["LargeSequential-500.fs"] - exec cfg ("." ++ "test.exe") "" - testOkFile.CheckExists() + execAndCheckPassed cfg ("." ++ "test.exe") "" [] let ``lots-of-sequential-maxtested``() = let cfg = testConfig "core/large/sequential" - use testOkFile = fileguard cfg "test.ok" + fsc cfg "%s -o:test.exe " cfg.fsc_flags ["LargeSequential-maxtested.fs"] - exec cfg ("." ++ "test.exe") "" - testOkFile.CheckExists() + execAndCheckPassed cfg ("." ++ "test.exe") "" #endif @@ -295,19 +274,17 @@ module CoreTests = peverify cfg "test.exe" begin - use testOkFile = fileguard cfg "test.ok" + - exec cfg ("." ++ "test.exe") "" + execAndCheckPassed cfg ("." ++ "test.exe") "" - testOkFile.CheckExists() end begin - use testOkFile = fileguard cfg "test.ok" + - fsi cfg "-r:lib.dll" ["test.fsx"] + fsiCheckPassed cfg "-r:lib.dll" ["test.fsx"] - testOkFile.CheckExists() end [] @@ -322,13 +299,12 @@ module CoreTests = peverify cfg "testcs.exe" - use testOkFile = fileguard cfg "test.ok" + - fsi cfg "" ["test.fs"] + fsiCheckPassed cfg "" ["test.fs"] - testOkFile.CheckExists() - exec cfg ("." ++ "testcs.exe") "" + execAndCheckPassed cfg ("." ++ "testcs.exe") "" // @@ -355,7 +331,7 @@ module CoreTests = // fsiStdin cfg "%s %s" cfg.fsi_flags flags "test1.fsx" // // // if NOT EXIST test1.ok goto SetError - // testOkFile.CheckExists() + // checkPassed() // // // [] @@ -377,7 +353,7 @@ module CoreTests = // fsiStdin cfg "%s %s" cfg.fsi_flags flags "test2.fsx" // // // if NOT EXIST test2.ok goto SetError - // testOkFile.CheckExists() + // checkPassed() // @@ -446,9 +422,9 @@ module CoreTests = csc cfg """/nologo /r:"%s" /r:System.Core.dll /r:lib--optimize.dll /out:test--optimize.exe""" cfg.FSCOREDLLPATH ["test.cs"] - exec cfg ("." ++ "test.exe") "" + execAndCheckPassed cfg ("." ++ "test.exe") "" - exec cfg ("." ++ "test--optimize.exe") "" + execAndCheckPassed cfg ("." ++ "test--optimize.exe") "" [] let fsfromfsviacs () = @@ -467,21 +443,21 @@ module CoreTests = peverify cfg "test.exe" - exec cfg ("." ++ "test.exe") "" + execAndCheckPassed cfg ("." ++ "test.exe") "" // Same with library references the other way around fsc cfg "%s -r:lib.dll -r:lib3.dll -r:lib2.dll -o:test.exe -g" cfg.fsc_flags ["test.fsx"] peverify cfg "test.exe" - exec cfg ("." ++ "test.exe") "" + execAndCheckPassed cfg ("." ++ "test.exe") "" // Same without the reference to lib.dll - testing an incomplete reference set, but only compiling a subset of the code fsc cfg "%s --define:NO_LIB_REFERENCE -r:lib3.dll -r:lib2.dll -o:test.exe -g" cfg.fsc_flags ["test.fsx"] peverify cfg "test.exe" - exec cfg ("." ++ "test.exe") "" + execAndCheckPassed cfg ("." ++ "test.exe") "" // some features missing in 4.7 for version in ["4.7"] do @@ -509,35 +485,22 @@ module CoreTests = let cfg = testConfig "core/fsi-reference" - begin - use testOkFile = fileguard cfg "test.ok" + begin fsc cfg @"--target:library -o:ImplementationAssembly\ReferenceAssemblyExample.dll" ["ImplementationAssembly.fs"] fsc cfg @"--target:library -o:ReferenceAssembly\ReferenceAssemblyExample.dll" ["ReferenceAssembly.fs"] - fsiStdin cfg "test.fsx" "" [] - testOkFile.CheckExists() + fsiStdinCheckPassed cfg "test.fsx" "" [] end [] let ``fsi-reload`` () = let cfg = testConfig "core/fsi-reload" + + fsiStdinCheckPassed cfg "test1.ml" " --langversion:5.0 --mlcompatibility --maxerrors:1" [] + + fsiCheckPassed cfg "%s --maxerrors:1" cfg.fsi_flags ["load1.fsx"] - begin - use testOkFile = fileguard cfg "test.ok" - fsiStdin cfg "test1.ml" " --langversion:5.0 --mlcompatibility --maxerrors:1" [] - testOkFile.CheckExists() - end - - begin - use testOkFile = fileguard cfg "test.ok" - fsi cfg "%s --maxerrors:1" cfg.fsi_flags ["load1.fsx"] - testOkFile.CheckExists() - end - - begin - use testOkFile = fileguard cfg "test.ok" - fsi cfg "%s --maxerrors:1" cfg.fsi_flags ["load2.fsx"] - testOkFile.CheckExists() - end + + fsiCheckPassed cfg "%s --maxerrors:1" cfg.fsi_flags ["load2.fsx"] fsc cfg "" ["load1.fsx"] fsc cfg "" ["load2.fsx"] @@ -551,11 +514,7 @@ module CoreTests = fsiStdin cfg "prepare.fsx" "--maxerrors:1" [] - use testOkFile = fileguard cfg "test.ok" - - fsiStdin cfg "test.fsx" "--maxerrors:1" [] - - testOkFile.CheckExists() + fsiStdinCheckPassed cfg "test.fsx" "--maxerrors:1" [] [] let ``genericmeasures-FSC_NETFX_TEST_ROUNDTRIP_AS_DLL`` () = singleTestBuildAndRun "core/genericmeasures" FSC_NETFX_TEST_ROUNDTRIP_AS_DLL @@ -595,27 +554,24 @@ module CoreTests = singleNegTest cfg "negativetest" begin - use testOkFile = fileguard cfg "test.ok" + - fsi cfg "%s" cfg.fsi_flags ["test.fsx"] + fsiCheckPassed cfg "%s" cfg.fsi_flags ["test.fsx"] - testOkFile.CheckExists() end begin - use testOkFile = fileguard cfg "test.ok" + - exec cfg ("." ++ "test.exe") "" + execAndCheckPassed cfg ("." ++ "test.exe") "" - testOkFile.CheckExists() end begin - use testOkFile = fileguard cfg "test.ok" + - exec cfg ("." ++ "test--optimize.exe") "" + execAndCheckPassed cfg ("." ++ "test--optimize.exe") "" - testOkFile.CheckExists() end // Debug with @@ -633,10 +589,10 @@ module CoreTests = let ``fsi b 2>c`` = // "%FSI%" %fsc_flags_errors_ok% --nologo z.raw.output.test.default.txt 2>&1 - let ``exec b 2>c`` (inFile, outFile, errFile) p = + let ``execAndCheckPassed b 2>c`` (inFile, outFile, errFile) p = Command.exec cfg.Directory cfg.EnvironmentVariables { Output = OutputAndError(Overwrite(outFile), Overwrite(errFile)); Input = Some(RedirectInput(inFile)); } p >> checkResult - Printf.ksprintf (fun flags (inFile, outFile, errFile) -> Commands.fsi (``exec b 2>c`` (inFile, outFile, errFile)) cfg.FSI flags []) + Printf.ksprintf (fun flags (inFile, outFile, errFile) -> Commands.fsi (``execAndCheckPassed b 2>c`` (inFile, outFile, errFile)) cfg.FSI flags []) let fsc_flags_errors_ok = "" @@ -819,9 +775,8 @@ module CoreTests = peverify cfg "test.exe" begin - use testOkFile = fileguard cfg "test.ok" - exec cfg ("." ++ "test.exe") "" - testOkFile.CheckExists() + + execAndCheckPassed cfg ("." ++ "test.exe") "" end fsc cfg "%s -o:test-with-debug-data.exe --quotations-debug+ -r cslib.dll -g" cfg.fsc_flags ["test.fsx"] @@ -833,23 +788,20 @@ module CoreTests = peverify cfg "test--optimize.exe" begin - use testOkFile = fileguard cfg "test.ok" + - fsi cfg "%s -r cslib.dll" cfg.fsi_flags ["test.fsx"] + fsiCheckPassed cfg "%s -r cslib.dll" cfg.fsi_flags ["test.fsx"] - testOkFile.CheckExists() end begin - use testOkFile = fileguard cfg "test.ok" - exec cfg ("." ++ "test-with-debug-data.exe") "" - testOkFile.CheckExists() + + execAndCheckPassed cfg ("." ++ "test-with-debug-data.exe") "" end begin - use testOkFile = fileguard cfg "test.ok" - exec cfg ("." ++ "test--optimize.exe") "" - testOkFile.CheckExists() + + execAndCheckPassed cfg ("." ++ "test--optimize.exe") "" end // Previously a comment here said: @@ -948,7 +900,7 @@ module CoreTests = peverify cfg "test.exe" - exec cfg ("." ++ "test.exe") "" + execAndCheckPassed cfg ("." ++ "test.exe") "" log "== Compiling F# Library and Code, when empty file libfile2.fs IS included" fsc cfg "%s -a --optimize -o:lib2.dll " cfg.fsc_flags ["libfile1.fs"; "libfile2.fs"] @@ -959,7 +911,7 @@ module CoreTests = peverify cfg "test2.exe" - exec cfg ("." ++ "test2.exe") "" + execAndCheckPassed cfg ("." ++ "test2.exe") "" // Repro for https://github.com/dotnet/fsharp/issues/2679 [] @@ -1008,26 +960,24 @@ module CoreTests = let ``libtest-langversion-checknulls`` () = let cfg = testConfig "core/libtest" - use testOkFile = fileguard cfg "test.ok" + fsc cfg "%s -o:test-checknulls.exe -g --checknulls" cfg.fsc_flags ["test.fsx"] - exec cfg ("." ++ "test-checknulls.exe") "" + execAndCheckPassed cfg ("." ++ "test-checknulls.exe") "" - testOkFile.CheckExists() [] let ``libtest-langversion-46`` () = let cfg = testConfig "core/libtest" - use testOkFile = fileguard cfg "test.ok" + fsc cfg "%s -o:test-langversion-46.exe -g --langversion:4.6" cfg.fsc_flags ["test.fsx"] - exec cfg ("." ++ "test-langversion-46.exe") "" + execAndCheckPassed cfg ("." ++ "test-langversion-46.exe") "" - testOkFile.CheckExists() [] let ``no-warn-2003-tests`` () = @@ -1240,23 +1190,14 @@ module CoreTests = peverify cfg "test--optimize.exe" - use testOkFile = fileguard cfg "test.ok" + fsiCheckPassed cfg "%s" cfg.fsi_flags ["test.fsx"] - fsi cfg "%s" cfg.fsi_flags ["test.fsx"] - testOkFile.CheckExists() + execAndCheckPassed cfg ("." ++ "test.exe") "" - use testOkFile2 = fileguard cfg "test.ok" - exec cfg ("." ++ "test.exe") "" + execAndCheckPassed cfg ("." ++ "test--optimize.exe") "" - testOkFile2.CheckExists() - - use testOkFile3 = fileguard cfg "test.ok" - - exec cfg ("." ++ "test--optimize.exe") "" - - testOkFile3.CheckExists() [] @@ -1271,17 +1212,11 @@ module CoreTests = peverify cfg "test--optimize.exe" - use testOkFile = fileguard cfg "test.ok" - fsi cfg "%s" cfg.fsi_flags ["test.fsx"] - testOkFile.CheckExists() + fsiCheckPassed cfg "%s" cfg.fsi_flags ["test.fsx"] - use testOkFile2 = fileguard cfg "test.ok" - exec cfg ("." ++ "test.exe") "" - testOkFile2.CheckExists() + execAndCheckPassed cfg ("." ++ "test.exe") "" - use testOkFile3 = fileguard cfg "test.ok" - exec cfg ("." ++ "test--optimize.exe") "" - testOkFile3.CheckExists() + execAndCheckPassed cfg ("." ++ "test--optimize.exe") "" [] let queriesOverIEnumerable () = @@ -1295,23 +1230,15 @@ module CoreTests = peverify cfg "test--optimize.exe" - use testOkFile = fileguard cfg "test.ok" - - fsi cfg "%s" cfg.fsi_flags ["test.fsx"] - - testOkFile.CheckExists() + - use testOkFile2 = fileguard cfg "test.ok" + fsiCheckPassed cfg "%s" cfg.fsi_flags ["test.fsx"] - exec cfg ("." ++ "test.exe") "" - testOkFile2.CheckExists() + execAndCheckPassed cfg ("." ++ "test.exe") "" - use testOkFile3 = fileguard cfg "test.ok" - - exec cfg ("." ++ "test--optimize.exe") "" + execAndCheckPassed cfg ("." ++ "test--optimize.exe") "" - testOkFile3.CheckExists() [] let queriesOverIQueryable () = @@ -1325,23 +1252,18 @@ module CoreTests = peverify cfg "test--optimize.exe" - use testOkFile = fileguard cfg "test.ok" - fsi cfg "%s" cfg.fsi_flags ["test.fsx"] + + fsiCheckPassed cfg "%s" cfg.fsi_flags ["test.fsx"] - testOkFile.CheckExists() - use testOkFile2 = fileguard cfg "test.ok" - exec cfg ("." ++ "test.exe") "" + execAndCheckPassed cfg ("." ++ "test.exe") "" - testOkFile2.CheckExists() - use testOkFile3 = fileguard cfg "test.ok" - exec cfg ("." ++ "test--optimize.exe") "" + execAndCheckPassed cfg ("." ++ "test--optimize.exe") "" - testOkFile3.CheckExists() [] @@ -1356,23 +1278,17 @@ module CoreTests = peverify cfg "test--optimize.exe" - use testOkFile = fileguard cfg "test.ok" - fsi cfg "%s --quotations-debug+" cfg.fsi_flags ["test.fsx"] - - testOkFile.CheckExists() + + fsiCheckPassed cfg "%s --quotations-debug+" cfg.fsi_flags ["test.fsx"] - use testOkFile2 = fileguard cfg "test.ok" - exec cfg ("." ++ "test.exe") "" + execAndCheckPassed cfg ("." ++ "test.exe") "" - testOkFile2.CheckExists() - use testOkFile3 = fileguard cfg "test.ok" - exec cfg ("." ++ "test--optimize.exe") "" + execAndCheckPassed cfg ("." ++ "test--optimize.exe") "" - testOkFile3.CheckExists() [] @@ -1399,30 +1315,24 @@ module CoreTests = peverify cfg "module2-opt.exe" - use testOkFile = fileguard cfg "test.ok" - - fsi cfg "%s -r module1.dll" cfg.fsi_flags ["module2.fsx"] - - testOkFile.CheckExists() + + fsiCheckPassed cfg "%s -r module1.dll" cfg.fsi_flags ["module2.fsx"] - use testOkFile = fileguard cfg "test.ok" - exec cfg ("." ++ "module2.exe") "" - testOkFile.CheckExists() + - use testOkFile = fileguard cfg "test.ok" + execAndCheckPassed cfg ("." ++ "module2.exe") "" - exec cfg ("." ++ "module2-opt.exe") "" + - testOkFile.CheckExists() + execAndCheckPassed cfg ("." ++ "module2-opt.exe") "" - use testOkFile = fileguard cfg "test.ok" + - exec cfg ("." ++ "module2-staticlink.exe") "" + execAndCheckPassed cfg ("." ++ "module2-staticlink.exe") "" - testOkFile.CheckExists() #endif @@ -1442,26 +1352,23 @@ module CoreTests = //TestCase1 // Build a program that references v2 of ascendent and v1 of dependent. // Note that, even though ascendent v2 references dependent v2, the reference is marked as v1. - use TestOk = fileguard cfg "test.ok" + fsc cfg @"%s -o:test1.exe -r:version1\DependentAssembly.dll -r:version2\AscendentAssembly.dll --optimize- -g" cfg.fsc_flags ["test.fs"] - exec cfg ("." ++ "test1.exe") "DependentAssembly-1.0.0.0 AscendentAssembly-2.0.0.0" - TestOk.CheckExists() + execAndCheckPassed cfg ("." ++ "test1.exe") "DependentAssembly-1.0.0.0 AscendentAssembly-2.0.0.0" //TestCase2 // Build a program that references v1 of ascendent and v2 of dependent. // Note that, even though ascendent v1 references dependent v1, the reference is marked as v2 which was passed in. - use TestOk = fileguard cfg "test.ok" + fsc cfg @"%s -o:test2.exe -r:version2\DependentAssembly.dll -r:version1\AscendentAssembly.dll --optimize- -g" cfg.fsc_flags ["test.fs"] - exec cfg ("." ++ "test2.exe") "DependentAssembly-2.0.0.0 AscendentAssembly-1.0.0.0" - TestOk.CheckExists() + execAndCheckPassed cfg ("." ++ "test2.exe") "DependentAssembly-2.0.0.0 AscendentAssembly-1.0.0.0" //TestCase3 // Build a program that references v1 of ascendent and v1 and v2 of dependent. // Verifies that compiler uses first version of a duplicate assembly passed on command line. - use TestOk = fileguard cfg "test.ok" + fsc cfg @"%s -o:test3.exe -r:version1\DependentAssembly.dll -r:version2\DependentAssembly.dll -r:version1\AscendentAssembly.dll --optimize- -g" cfg.fsc_flags ["test.fs"] - exec cfg ("." ++ "test3.exe") "DependentAssembly-1.0.0.0 AscendentAssembly-1.0.0.0" - TestOk.CheckExists() + execAndCheckPassed cfg ("." ++ "test3.exe") "DependentAssembly-1.0.0.0 AscendentAssembly-1.0.0.0" [] @@ -1628,11 +1535,10 @@ module CoreTests = peverify cfg "test.exe" - use testOkFile = fileguard cfg "test.ok" + - exec cfg ("." ++ "test.exe") "" + execAndCheckPassed cfg ("." ++ "test.exe") "" - testOkFile.CheckExists() [] let verify () = @@ -1867,11 +1773,10 @@ module RegressionTests = peverify cfg "test.exe" - use testOkFile = fileguard cfg "test.ok" + - exec cfg ("." ++ "test.exe") "" + execAndCheckPassed cfg ("." ++ "test.exe") "" - testOkFile.CheckExists() // This test is disabled in coreclr builds dependent on fixing : https://github.com/dotnet/fsharp/issues/2600 [] diff --git a/tests/fsharp/tools/eval/test.fsx b/tests/fsharp/tools/eval/test.fsx index 69431999bbc..9fb17c1d870 100644 --- a/tests/fsharp/tools/eval/test.fsx +++ b/tests/fsharp/tools/eval/test.fsx @@ -2797,5 +2797,5 @@ let _ = exit 1 else stdout.WriteLine "Test Passed"; - System.IO.File.WriteAllText("test.ok","ok"); + printf "TEST PASSED OK"; exit 0 diff --git a/tests/fsharp/typeProviders/diamondAssembly/test3.fsx b/tests/fsharp/typeProviders/diamondAssembly/test3.fsx index 51e5f1803e7..d3350294831 100644 --- a/tests/fsharp/typeProviders/diamondAssembly/test3.fsx +++ b/tests/fsharp/typeProviders/diamondAssembly/test3.fsx @@ -162,7 +162,7 @@ let _ = if not failures.IsEmpty then (printfn "Test Failed, failures = %A" failures; exit 1) do (stdout.WriteLine "Test Passed"; - System.IO.File.WriteAllText("test.ok","ok"); + printf "TEST PASSED OK"; exit 0) diff --git a/tests/fsharp/typeProviders/globalNamespace/test.fsx b/tests/fsharp/typeProviders/globalNamespace/test.fsx index 133be281594..f0201d7d252 100644 --- a/tests/fsharp/typeProviders/globalNamespace/test.fsx +++ b/tests/fsharp/typeProviders/globalNamespace/test.fsx @@ -24,7 +24,7 @@ let _ = if not failures.IsEmpty then (printfn "Test Failed, failures = %A" failures; exit 1) do (stdout.WriteLine "Test Passed"; - System.IO.File.WriteAllText("test.ok","ok"); + printf "TEST PASSED OK"; exit 0) diff --git a/tests/fsharp/typeProviders/helloWorld/test.fsx b/tests/fsharp/typeProviders/helloWorld/test.fsx index e528e8da949..59d811bc5a0 100644 --- a/tests/fsharp/typeProviders/helloWorld/test.fsx +++ b/tests/fsharp/typeProviders/helloWorld/test.fsx @@ -1192,7 +1192,7 @@ let _ = if not failures.IsEmpty then (printfn "Test Failed, failures = %A" failures; exit 1) do (stdout.WriteLine "Test Passed"; - System.IO.File.WriteAllText("test.ok","ok"); + printf "TEST PASSED OK"; exit 0) diff --git a/tests/fsharp/typeProviders/helloWorldCSharp/test.fsx b/tests/fsharp/typeProviders/helloWorldCSharp/test.fsx index 936e670a305..a4a1fbe3228 100644 --- a/tests/fsharp/typeProviders/helloWorldCSharp/test.fsx +++ b/tests/fsharp/typeProviders/helloWorldCSharp/test.fsx @@ -26,7 +26,7 @@ let _ = if not failures.IsEmpty then (printfn "Test Failed, failures = %A" failures; exit 1) do (stdout.WriteLine "Test Passed"; - System.IO.File.WriteAllText("test.ok","ok"); + printf "TEST PASSED OK"; exit 0) diff --git a/tests/fsharp/typeProviders/splitAssemblyTools/test.fsx b/tests/fsharp/typeProviders/splitAssemblyTools/test.fsx index e25871ab5f8..ba7cc6b9e34 100644 --- a/tests/fsharp/typeProviders/splitAssemblyTools/test.fsx +++ b/tests/fsharp/typeProviders/splitAssemblyTools/test.fsx @@ -26,7 +26,7 @@ let _ = if not failures.IsEmpty then (printfn "Test Failed, failures = %A" failures; exit 1) do (stdout.WriteLine "Test Passed"; - System.IO.File.WriteAllText("test.ok","ok"); + printf "TEST PASSED OK"; exit 0) diff --git a/tests/fsharp/typeProviders/splitAssemblyTypeproviders/test.fsx b/tests/fsharp/typeProviders/splitAssemblyTypeproviders/test.fsx index e25871ab5f8..ba7cc6b9e34 100644 --- a/tests/fsharp/typeProviders/splitAssemblyTypeproviders/test.fsx +++ b/tests/fsharp/typeProviders/splitAssemblyTypeproviders/test.fsx @@ -26,7 +26,7 @@ let _ = if not failures.IsEmpty then (printfn "Test Failed, failures = %A" failures; exit 1) do (stdout.WriteLine "Test Passed"; - System.IO.File.WriteAllText("test.ok","ok"); + printf "TEST PASSED OK"; exit 0) diff --git a/tests/fsharp/typeProviders/wedgeAssembly/test3.fsx b/tests/fsharp/typeProviders/wedgeAssembly/test3.fsx index 7e6125c4be9..1a3c546d17a 100644 --- a/tests/fsharp/typeProviders/wedgeAssembly/test3.fsx +++ b/tests/fsharp/typeProviders/wedgeAssembly/test3.fsx @@ -108,7 +108,7 @@ let _ = if not failures.IsEmpty then (printfn "Test Failed, failures = %A" failures; exit 1) do (stdout.WriteLine "Test Passed"; - System.IO.File.WriteAllText("test.ok","ok"); + printf "TEST PASSED OK"; exit 0) diff --git a/tests/fsharp/typecheck/full-rank-arrays/test.fsx b/tests/fsharp/typecheck/full-rank-arrays/test.fsx index 0a062adae4a..d8800170979 100644 --- a/tests/fsharp/typecheck/full-rank-arrays/test.fsx +++ b/tests/fsharp/typecheck/full-rank-arrays/test.fsx @@ -107,5 +107,5 @@ let _ = let x = Class1() x.RunTests() System.Console.WriteLine "Test Passed"; - System.IO.File.WriteAllText ("test.ok", "ok"); + printf "TEST PASSED OK" exit 0 diff --git a/tests/fsharp/typecheck/misc/test.ml b/tests/fsharp/typecheck/misc/test.ml index 4a2e5c89332..14bc16ae51f 100644 --- a/tests/fsharp/typecheck/misc/test.ml +++ b/tests/fsharp/typecheck/misc/test.ml @@ -33,5 +33,5 @@ let _ = * So avoid using ;; *) System.Console.WriteLine "Test Passed"; - System.IO.File.WriteAllText ("test.ok", "ok"); + printf "TEST PASSED OK"; exit 0 diff --git a/tests/fsharpqa/Source/Conformance/LexicalAnalysis/IdentifiersAndKeywords/backtickmoduleandtypenames.fsx b/tests/fsharpqa/Source/Conformance/LexicalAnalysis/IdentifiersAndKeywords/backtickmoduleandtypenames.fsx index 20aede76c20..47debdeb71f 100644 --- a/tests/fsharpqa/Source/Conformance/LexicalAnalysis/IdentifiersAndKeywords/backtickmoduleandtypenames.fsx +++ b/tests/fsharpqa/Source/Conformance/LexicalAnalysis/IdentifiersAndKeywords/backtickmoduleandtypenames.fsx @@ -75,5 +75,5 @@ let aa = if !failures then (stdout.WriteLine "Test Failed"; exit 1) do (stdout.WriteLine "Test Passed"; - System.IO.File.WriteAllText("test.ok","ok"); + printf "TEST PASSED OK"; exit 0) diff --git a/tests/scripts/scriptlib.fsx b/tests/scripts/scriptlib.fsx index b074b78ba25..853aecb496e 100644 --- a/tests/scripts/scriptlib.fsx +++ b/tests/scripts/scriptlib.fsx @@ -82,7 +82,7 @@ module Scripting = type FilePath = string type CmdResult = - | Success + | Success of output: string | ErrorLevel of string * int type CmdArguments = @@ -156,7 +156,8 @@ module Scripting = p.WaitForExit() match p.ExitCode with - | 0 -> Success + | 0 -> + Success(string out) | errCode -> let msg = sprintf "Error running command '%s' with args '%s' in directory '%s'.\n---- stdout below --- \n%s\n---- stderr below --- \n%s " exePath arguments workDir (out.ToString()) (err.ToString()) ErrorLevel (msg, errCode)