Skip to content

Commit

Permalink
Unify fsharpqa comparer.fsx (#6875)
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinRansom committed May 27, 2019
1 parent 25560f4 commit 070be18
Show file tree
Hide file tree
Showing 11 changed files with 55 additions and 156 deletions.
21 changes: 0 additions & 21 deletions tests/fsharpqa/Source/CompilerOptions/fsc/gccerrors/comparer.fsx

This file was deleted.

4 changes: 1 addition & 3 deletions tests/fsharpqa/Source/CompilerOptions/fsc/gccerrors/env.lst
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
ReqENU SOURCE=gccerrors01.fs COMPILE_ONLY=1 SCFLAGS="--gccerrors --nologo gccerrors01.fs >gccerrors01.txt" POSTCMD="\$FSI_PIPE --nologo --quiet --exec comparer.fsx gccerrors01.txt gccerrors01.bsl"


ReqENU SOURCE=gccerrors01.fs COMPILE_ONLY=1 SCFLAGS="--gccerrors --nologo gccerrors01.fs >gccerrors01.txt" POSTCMD="\$FSI_PIPE --nologo --quiet --exec ..\\..\\..\\comparer.fsx gccerrors01.txt gccerrors01.bsl"
32 changes: 0 additions & 32 deletions tests/fsharpqa/Source/CompilerOptions/fsc/help/comparer.fsx

This file was deleted.

6 changes: 3 additions & 3 deletions tests/fsharpqa/Source/CompilerOptions/fsc/help/env.lst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# ReqENU means that the test is non-localized

ReqENU SOURCE=dummy.fsx COMPILE_ONLY=1 PRECMD="\$FSC_PIPE >help40.txt -? 2>&1" POSTCMD="\$FSI_PIPE --nologo --quiet --exec comparer.fsx help40.txt help40.437.1033.bsl" # -?
ReqENU SOURCE=dummy.fsx COMPILE_ONLY=1 PRECMD="\$FSC_PIPE >help40.txt --help 2>&1" POSTCMD="\$FSI_PIPE --nologo --quiet --exec comparer.fsx help40.txt help40.437.1033.bsl" # --help
ReqENU SOURCE=dummy.fsx COMPILE_ONLY=1 PRECMD="\$FSC_PIPE >help40.txt /? 2>&1" POSTCMD="\$FSI_PIPE --nologo --quiet --exec comparer.fsx help40.txt help40.437.1033.bsl" # /?
ReqENU SOURCE=dummy.fsx COMPILE_ONLY=1 PRECMD="\$FSC_PIPE >help40.txt -? 2>&1" POSTCMD="\$FSI_PIPE --nologo --quiet --exec ..\\..\\..\\comparer.fsx help40.txt help40.437.1033.bsl" # -?
ReqENU SOURCE=dummy.fsx COMPILE_ONLY=1 PRECMD="\$FSC_PIPE >help40.txt --help 2>&1" POSTCMD="\$FSI_PIPE --nologo --quiet --exec ..\\..\\..\\comparer.fsx help40.txt help40.437.1033.bsl" # --help
ReqENU SOURCE=dummy.fsx COMPILE_ONLY=1 PRECMD="\$FSC_PIPE >help40.txt /? 2>&1" POSTCMD="\$FSI_PIPE --nologo --quiet --exec ..\\..\\..\\comparer.fsx help40.txt help40.437.1033.bsl" # /?

33 changes: 0 additions & 33 deletions tests/fsharpqa/Source/CompilerOptions/fsc/nologo/comparer.fsx

This file was deleted.

4 changes: 2 additions & 2 deletions tests/fsharpqa/Source/CompilerOptions/fsc/nologo/env.lst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Not really related to the --nologo option

ReqENU SOURCE=dummy.fsx COMPILE_ONLY=1 PRECMD="\$FSC_PIPE >logo.txt 2>&1 || time /t" POSTCMD="\$FSI_PIPE --nologo --quiet --exec comparer.fsx logo.txt logo.437.1033.bsl" # fsc
ReqENU SOURCE=dummy.fsx COMPILE_ONLY=1 PRECMD="\$FSC_PIPE >nologo.txt --nologo 2>&1 || time /t" POSTCMD="\$FSI_PIPE --nologo --quiet --exec comparer.fsx nologo.txt nologo.437.1033.bsl" # fsc --nologo
ReqENU SOURCE=dummy.fsx COMPILE_ONLY=1 PRECMD="\$FSC_PIPE >logo.txt 2>&1 || time /t" POSTCMD="\$FSI_PIPE --nologo --quiet --exec ..\\..\\..\\comparer.fsx logo.txt logo.437.1033.bsl" # fsc
ReqENU SOURCE=dummy.fsx COMPILE_ONLY=1 PRECMD="\$FSC_PIPE >nologo.txt --nologo 2>&1 || time /t" POSTCMD="\$FSI_PIPE --nologo --quiet --exec ..\\..\\..\\comparer.fsx nologo.txt nologo.437.1033.bsl" # fsc --nologo



21 changes: 0 additions & 21 deletions tests/fsharpqa/Source/CompilerOptions/fsi/exename/comparer.fsx

This file was deleted.

2 changes: 1 addition & 1 deletion tests/fsharpqa/Source/CompilerOptions/fsi/exename/env.lst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

ReqENU SOURCE=dummy.fsx COMPILE_ONLY=1 SCFLAGS="--nologo --exename:fsharpi --help >help.txt" FSIMODE=EXEC POSTCMD="\$FSI_PIPE --nologo --quiet --exec comparer.fsx help.txt help40.437.1033.bsl" # -?-40
ReqENU SOURCE=dummy.fsx COMPILE_ONLY=1 SCFLAGS="--nologo --exename:fsharpi --help >help.txt" FSIMODE=EXEC POSTCMD="\$FSI_PIPE --nologo --quiet --exec ..\\..\\..\\comparer.fsx help.txt help40.437.1033.bsl" # -?-40



36 changes: 0 additions & 36 deletions tests/fsharpqa/Source/CompilerOptions/fsi/help/comparer.fsx

This file was deleted.

8 changes: 4 additions & 4 deletions tests/fsharpqa/Source/CompilerOptions/fsi/help/env.lst
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@

ReqENU SOURCE=dummy.fsx COMPILE_ONLY=1 SCFLAGS="--nologo" FSIMODE=EXEC PRECMD="\$FSI_PIPE >help.txt -? 2>&1" POSTCMD="\$FSI_PIPE --nologo --quiet --exec comparer.fsx help.txt help40.437.1033.bsl" # -?-40
ReqENU SOURCE=dummy.fsx COMPILE_ONLY=1 SCFLAGS="--nologo" FSIMODE=EXEC PRECMD="\$FSI_PIPE >help.txt -? 2>&1" POSTCMD="\$FSI_PIPE --nologo --quiet --exec ..\\..\\..\\comparer.fsx help.txt help40.437.1033.bsl" # -?-40

ReqENU SOURCE=dummy.fsx COMPILE_ONLY=1 SCFLAGS="--nologo" FSIMODE=EXEC PRECMD="\$FSI_PIPE >help.txt --help 2>&1" POSTCMD="\$FSI_PIPE --nologo --quiet --exec comparer.fsx help.txt help40.437.1033.bsl" # --help-40
ReqENU SOURCE=dummy.fsx COMPILE_ONLY=1 SCFLAGS="--nologo" FSIMODE=EXEC PRECMD="\$FSI_PIPE >help.txt --help 2>&1" POSTCMD="\$FSI_PIPE --nologo --quiet --exec ..\\..\\..\\comparer.fsx help.txt help40.437.1033.bsl" # --help-40

ReqENU SOURCE=dummy.fsx COMPILE_ONLY=1 SCFLAGS="--nologo" FSIMODE=EXEC PRECMD="\$FSI_PIPE >help.txt /? 2>&1" POSTCMD="\$FSI_PIPE --nologo --quiet --exec comparer.fsx help.txt help40.437.1033.bsl" # /?-40
ReqENU SOURCE=dummy.fsx COMPILE_ONLY=1 SCFLAGS="--nologo" FSIMODE=EXEC PRECMD="\$FSI_PIPE >help.txt /? 2>&1" POSTCMD="\$FSI_PIPE --nologo --quiet --exec ..\\..\\..\\comparer.fsx help.txt help40.437.1033.bsl" # /?-40

# With --nologo
ReqENU SOURCE=dummy.fsx COMPILE_ONLY=1 SCFLAGS="--nologo" FSIMODE=EXEC PRECMD="\$FSI_PIPE >help.txt --nologo -? 2>&1" POSTCMD="\$FSI_PIPE --nologo --quiet --exec comparer.fsx help.txt help40-nologo.437.1033.bsl" # -? --nologo-40
ReqENU SOURCE=dummy.fsx COMPILE_ONLY=1 SCFLAGS="--nologo" FSIMODE=EXEC PRECMD="\$FSI_PIPE >help.txt --nologo -? 2>&1" POSTCMD="\$FSI_PIPE --nologo --quiet --exec ..\\..\\..\\comparer.fsx help.txt help40-nologo.437.1033.bsl" # -? --nologo-40


44 changes: 44 additions & 0 deletions tests/fsharpqa/Source/comparer.fsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// #NoMT #CompilerOptions #RequiresENU
#light
open System
open System.IO
open System.Text.RegularExpressions

let arg0 = Environment.GetCommandLineArgs().[0]
let path = Environment.GetEnvironmentVariable("PATH")
let fn1 = fsi.CommandLineArgs.[1]
let fn2 = fsi.CommandLineArgs.[2]

// Read file into an array
let File2List (filename:string) = File.ReadAllLines(filename)

let f1 = File2List fn1
let f2 = File2List fn2

let mutable i = 0
let compare (f1:string[]) (f2:string[]) =
if f1.Length <> f2.Length then failwithf "Help text did not match. f1.Length = %d, f2.Length = %d, Check you have right fsi on path. fsi = %s, PATH=%s" f1.Length f2.Length arg0 path
(f1, f2) ||> Array.forall2 (fun (a:string) (b:string) ->

let replace (sourcepattern:string) (replacement:string) (str:string) : string =
Regex.Replace(str, sourcepattern, replacement)

let normalizeText (str:string) =
str |> replace @"F# Interactive version .+" "F# Interactive"
|> replace @"F# Compiler version .+" "F# Compiler"
|> replace "fsiAnyCpu.exe" "fsi.exe"

let aa = normalizeText a
let bb = normalizeText b

i <- i+1
if (aa = bb) then
true
else
printfn "Files differ at line %d:" i
printfn "\t>> %s" a
printfn "\t<< %s" b
false
)

exit (if compare f1 f2 then 0 else 1)

0 comments on commit 070be18

Please sign in to comment.