Skip to content

Commit 9f819b5

Browse files
vzarytovskiibaronfel
authored andcommitted
Fix paths when search for nuget packages
1 parent 49347bc commit 9f819b5

File tree

1 file changed

+42
-42
lines changed

1 file changed

+42
-42
lines changed

tests/FSharp.Test.Utilities/TestFramework.fs

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ module Commands =
1818
else Path.Combine(workDir, path)
1919
rooted |> Path.GetFullPath
2020

21-
let fileExists workDir path =
21+
let fileExists workDir path =
2222
if path |> getfullpath workDir |> File.Exists then Some path else None
2323

24-
let directoryExists workDir path =
24+
let directoryExists workDir path =
2525
if path |> getfullpath workDir |> Directory.Exists then Some path else None
2626

27-
let copy_y workDir source dest =
27+
let copy_y workDir source dest =
2828
log "copy /y %s %s" source dest
2929
File.Copy( source |> getfullpath workDir, dest |> getfullpath workDir, true)
3030
CmdResult.Success
@@ -35,24 +35,24 @@ module Commands =
3535

3636
let rm dir path =
3737
let p = path |> getfullpath dir
38-
if File.Exists(p) then
38+
if File.Exists(p) then
3939
(log "rm %s" p) |> ignore
4040
File.Delete(p)
4141
else
4242
(log "not found: %s p") |> ignore
4343

4444
let rmdir dir path =
4545
let p = path |> getfullpath dir
46-
if Directory.Exists(p) then
46+
if Directory.Exists(p) then
4747
(log "rmdir /sy %s" p) |> ignore
4848
Directory.Delete(p, true)
4949
else
5050
(log "not found: %s p") |> ignore
5151

52-
let pathAddBackslash (p: FilePath) =
52+
let pathAddBackslash (p: FilePath) =
5353
if String.IsNullOrWhiteSpace (p) then p
5454
else
55-
p.TrimEnd ([| Path.DirectorySeparatorChar; Path.AltDirectorySeparatorChar |])
55+
p.TrimEnd ([| Path.DirectorySeparatorChar; Path.AltDirectorySeparatorChar |])
5656
+ Path.DirectorySeparatorChar.ToString()
5757

5858
let echoAppendToFile workDir text p =
@@ -78,11 +78,11 @@ module Commands =
7878

7979
match exitCode with
8080
| 0 -> CmdResult.Success
81-
| err ->
82-
let msg = sprintf "Error running command '%s' with args '%s' in directory '%s'" fscExe args workDir
81+
| err ->
82+
let msg = sprintf "Error running command '%s' with args '%s' in directory '%s'" fscExe args workDir
8383
CmdResult.ErrorLevel (msg, err)
8484
#else
85-
ignore workDir
85+
ignore workDir
8686
#if NETCOREAPP
8787
exec dotNetExe (fscExe + " " + args)
8888
#else
@@ -119,7 +119,7 @@ module Commands =
119119
path
120120

121121

122-
type TestConfig =
122+
type TestConfig =
123123
{ EnvironmentVariables : Map<string, string>
124124
CSC : string
125125
csc_flags : string
@@ -138,7 +138,7 @@ type TestConfig =
138138
ILDASM : string
139139
ILASM : string
140140
PEVERIFY : string
141-
Directory: string
141+
Directory: string
142142
DotNetExe: string
143143
DefaultPlatform: string}
144144

@@ -185,11 +185,11 @@ let requireFile dir path =
185185
// However when nuget packages are installed to $HOME/.nuget/packages, it seems they are lowercased
186186
let fullPath = (dir ++ path)
187187
match Commands.fileExists __SOURCE_DIRECTORY__ fullPath with
188-
| Some p -> p
188+
| Some _ -> fullPath
189189
| None ->
190190
let fullPathLower = (dir ++ path.ToLower())
191191
match Commands.fileExists __SOURCE_DIRECTORY__ fullPathLower with
192-
| Some p -> p
192+
| Some _ -> fullPathLower
193193
| None -> failwith (sprintf "Couldn't find \"%s\" on the following paths: \"%s\", \"%s\". Running 'build test' once might solve this issue" path fullPath fullPathLower)
194194

195195
let config configurationName envVars =
@@ -213,7 +213,7 @@ let config configurationName envVars =
213213
let artifactsPath = repoRoot ++ "artifacts"
214214
let artifactsBinPath = artifactsPath ++ "bin"
215215
let coreClrRuntimePackageVersion = "3.0.0-preview-27318-01"
216-
let csc_flags = "/nologo"
216+
let csc_flags = "/nologo"
217217
let fsc_flags = "-r:System.Core.dll --nowarn:20 --define:COMPILED"
218218
let fsi_flags = "-r:System.Core.dll --nowarn:20 --define:INTERACTIVE --maxerrors:1 --abortonerror"
219219
let operatingSystem = getOperatingSystem ()
@@ -253,8 +253,8 @@ let config configurationName envVars =
253253
let FSC = requireArtifact ("fsc" ++ configurationName ++ fscArchitecture ++ "fsc.exe")
254254
let FSCOREDLLPATH = requireArtifact ("FSharp.Core" ++ configurationName ++ fsharpCoreArchitecture ++ "FSharp.Core.dll")
255255

256-
let defaultPlatform =
257-
match Is64BitOperatingSystem with
256+
let defaultPlatform =
257+
match Is64BitOperatingSystem with
258258
// | PlatformID.MacOSX, true -> "osx.10.10-x64"
259259
// | PlatformID.Unix,true -> "ubuntu.14.04-x64"
260260
| true -> "win7-x64"
@@ -265,7 +265,7 @@ let config configurationName envVars =
265265
ILDASM = ILDASM
266266
ILASM = ILASM
267267
PEVERIFY = PEVERIFY
268-
CSC = CSC
268+
CSC = CSC
269269
BUILD_CONFIG = configurationName
270270
FSC = FSC
271271
FSI = FSI
@@ -276,9 +276,9 @@ let config configurationName envVars =
276276
FSharpBuild = FSharpBuild
277277
FSharpCompilerInteractiveSettings = FSharpCompilerInteractiveSettings
278278
csc_flags = csc_flags
279-
fsc_flags = fsc_flags
280-
fsi_flags = fsi_flags
281-
Directory=""
279+
fsc_flags = fsc_flags
280+
fsi_flags = fsi_flags
281+
Directory=""
282282
DotNetExe = dotNetExe
283283
DefaultPlatform = defaultPlatform }
284284

@@ -302,18 +302,18 @@ let logConfig (cfg: TestConfig) =
302302
log "---------------------------------------------------------------"
303303

304304

305-
let checkResult result =
305+
let checkResult result =
306306
match result with
307307
| CmdResult.ErrorLevel (msg1, err) -> Assert.Fail (sprintf "%s. ERRORLEVEL %d" msg1 err)
308308
| CmdResult.Success -> ()
309309

310-
let checkErrorLevel1 result =
310+
let checkErrorLevel1 result =
311311
match result with
312312
| CmdResult.ErrorLevel (_,1) -> ()
313313
| CmdResult.Success | CmdResult.ErrorLevel _ -> Assert.Fail (sprintf "Command passed unexpectedly")
314314

315-
let envVars () =
316-
System.Environment.GetEnvironmentVariables ()
315+
let envVars () =
316+
System.Environment.GetEnvironmentVariables ()
317317
|> Seq.cast<System.Collections.DictionaryEntry>
318318
|> Seq.map (fun d -> d.Key :?> string, d.Value :?> string)
319319
|> Map.ofSeq
@@ -329,7 +329,7 @@ let initializeSuite () =
329329

330330
let cfg =
331331
let c = config configurationName env
332-
let usedEnvVars = c.EnvironmentVariables |> Map.add "FSC" c.FSC
332+
let usedEnvVars = c.EnvironmentVariables |> Map.add "FSC" c.FSC
333333
{ c with EnvironmentVariables = usedEnvVars }
334334

335335
logConfig cfg
@@ -345,7 +345,7 @@ type public InitializeSuiteAttribute () =
345345

346346
override x.BeforeTest details =
347347
try
348-
if details.IsSuite
348+
if details.IsSuite
349349
then suiteHelpers.Force() |> ignore
350350
with
351351
| e -> raise (Exception("failed test suite initialization, debug code in InitializeSuiteAttribute", e))
@@ -376,28 +376,28 @@ type FileGuard(path: string) =
376376
member x.Path = path
377377
member x.Exists = x.Path |> File.Exists
378378
member x.CheckExists() =
379-
if not x.Exists then
379+
if not x.Exists then
380380
failwith (sprintf "exit code 0 but %s file doesn't exists" (x.Path |> Path.GetFileName))
381381

382382
interface IDisposable with
383383
member x.Dispose () = remove path
384-
385384

386-
type RedirectToType =
385+
386+
type RedirectToType =
387387
| Overwrite of FilePath
388388
| Append of FilePath
389389

390-
type RedirectTo =
390+
type RedirectTo =
391391
| Inherit
392392
| Output of RedirectToType
393393
| OutputAndError of RedirectToType * RedirectToType
394-
| OutputAndErrorToSameFile of RedirectToType
394+
| OutputAndErrorToSameFile of RedirectToType
395395
| Error of RedirectToType
396396

397-
type RedirectFrom =
397+
type RedirectFrom =
398398
| RedirectInput of FilePath
399399

400-
type RedirectInfo =
400+
type RedirectInfo =
401401
{ Output : RedirectTo
402402
Input : RedirectFrom option }
403403

@@ -415,7 +415,7 @@ module Command =
415415
| Inherit -> ""
416416
| Output r-> sprintf " 1%s" (redirectType r)
417417
| OutputAndError (r1, r2) -> sprintf " 1%s 2%s" (redirectType r1) (redirectType r2)
418-
| OutputAndErrorToSameFile r -> sprintf " 1%s 2>1" (redirectType r)
418+
| OutputAndErrorToSameFile r -> sprintf " 1%s 2>1" (redirectType r)
419419
| Error r -> sprintf " 2%s" (redirectType r)
420420
sprintf "%s%s%s%s" path (match args with "" -> "" | x -> " " + x) (inF redirect.Input) (outF redirect.Output)
421421

@@ -444,13 +444,13 @@ module Command =
444444

445445
let openWrite rt =
446446
let fullpath = Commands.getfullpath dir
447-
match rt with
447+
match rt with
448448
| Append p -> File.AppendText( p |> fullpath)
449449
| Overwrite p -> new StreamWriter(new FileStream(p |> fullpath, FileMode.Create))
450450

451451
let outF fCont cmdArgs =
452452
match redirect.Output with
453-
| RedirectTo.Inherit ->
453+
| RedirectTo.Inherit ->
454454
use toLog = redirectToLog ()
455455
fCont { cmdArgs with RedirectOutput = Some (toLog.Post); RedirectError = Some (toLog.Post) }
456456
| Output r ->
@@ -473,7 +473,7 @@ module Command =
473473
use outFile = redirectTo writer
474474
use toLog = redirectToLog ()
475475
fCont { cmdArgs with RedirectOutput = Some (toLog.Post); RedirectError = Some (outFile.Post) }
476-
476+
477477
let exec cmdArgs =
478478
log "%s" (logExec dir path args redirect)
479479
Process.exec cmdArgs dir envVars path args
@@ -533,7 +533,7 @@ let diff normalize path1 path2 =
533533

534534
if not <| File.Exists(path1) then
535535
// creating empty baseline file as this is likely someone initializing a new test
536-
File.WriteAllText(path1, String.Empty)
536+
File.WriteAllText(path1, String.Empty)
537537
if not <| File.Exists(path2) then failwithf "Invalid path %s" path2
538538

539539
let lines1 = File.ReadAllLines(path1)
@@ -565,7 +565,7 @@ let diff normalize path1 path2 =
565565

566566
result.ToString()
567567

568-
let fsdiff cfg a b =
568+
let fsdiff cfg a b =
569569
let actualFile = System.IO.Path.Combine(cfg.Directory, a)
570570
let expectedFile = System.IO.Path.Combine(cfg.Directory, b)
571571
let errorText = System.IO.File.ReadAllText (System.IO.Path.Combine(cfg.Directory, a))
@@ -577,8 +577,8 @@ let fsdiff cfg a b =
577577
log "%s" errorText
578578

579579
result
580-
581-
let requireENCulture () =
580+
581+
let requireENCulture () =
582582
match System.Globalization.CultureInfo.CurrentCulture.TwoLetterISOLanguageName with
583583
| "en" -> true
584584
| _ -> false

0 commit comments

Comments
 (0)