Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip flaky test #18051

Merged
merged 1 commit into from
Nov 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ let internal recordAllEvents groupBy =
let getFileNameKey (_l, (f: string, _p), _) = Path.GetFileName f

// TODO: currently the label for DependecyGraph cache is $"%d{fileSnapshots.Length} files ending with {lastFile}"
let getDependecyGraphKey (_l, _, _) = failwith "not implemented"
let getDependecyGraphKey (_l, _, _) = failwith "not implemented"

let internal recordEvents groupBy =
let observe, getEvents = recordAllEvents groupBy
Expand Down Expand Up @@ -293,7 +293,7 @@ let ``We don't check files that are not depended on`` () =

let observe, check = recordEvents getFileNameKey

ProjectWorkflowBuilder(project, useTransparentCompiler = true) {
ProjectWorkflowBuilder(project, useTransparentCompiler = true) {
withChecker (observe _.TcIntermediate)
updateFile "First" updatePublicSurface
checkFile "Last" expectOk
Expand Down Expand Up @@ -448,7 +448,7 @@ let fuzzingTest seed (project: SyntheticProject) = task {

let builder = ProjectWorkflowBuilder(project, useTransparentCompiler = true, autoStart = false)
let checker = builder.Checker

// Force creation and caching of options
do! SaveAndCheckProject project checker false |> Async.Ignore

Expand Down Expand Up @@ -600,7 +600,7 @@ let fuzzingTest seed (project: SyntheticProject) = task {
builder.DeleteProjectDir()
}

[<Theory>]
[<Theory(Skip="TODO: this sometimes fails, needs investigation")>]
[<InlineData(SignatureFiles.Yes)>]
[<InlineData(SignatureFiles.No)>]
[<InlineData(SignatureFiles.Some)>]
Expand Down Expand Up @@ -712,7 +712,7 @@ let ``What happens if bootstrapInfoStatic needs to be recomputed`` _ =
giraffeProject.Workflow {
updateFile "Helpers" (fun f -> { f with SignatureFile = Custom (f.SignatureFile.CustomText + "\n") })
checkFile "EndpointRouting" expectOk
withChecker (fun checker ->
withChecker (fun checker ->
async {
checker.Caches.BootstrapInfoStatic.Clear()
checker.Caches.BootstrapInfo.Clear()
Expand All @@ -722,7 +722,7 @@ let ``What happens if bootstrapInfoStatic needs to be recomputed`` _ =
})
updateFile "Core" (fun f -> { f with SignatureFile = Custom (f.SignatureFile.CustomText + "\n") })
checkFile "EndpointRouting" expectOk
}
}


module ParsedInputHashing =
Expand Down Expand Up @@ -776,7 +776,7 @@ let ``TypeCheck last file in project with transparent compiler`` useTransparentC
let responseFile = FileInfo responseFile
let syntheticProject = mkSyntheticProjectForResponseFile responseFile

let workflow =
let workflow =
ProjectWorkflowBuilder(
syntheticProject,
isExistingProject = true,
Expand All @@ -793,7 +793,7 @@ let ``TypeCheck last file in project with transparent compiler`` useTransparentC
| Some lastFile ->

workflow {
clearCache
clearCache
checkFile lastFile expectOk
}

Expand All @@ -803,13 +803,13 @@ let ``LoadClosure for script is computed once`` () =
sourceFile "First" [])

let observe, getEvents = recordAllEvents getFileNameKey

ProjectWorkflowBuilder(project, useTransparentCompiler = true) {
withChecker (observe _.ScriptClosure)
checkFile "First" expectOk
}
|> ignore

Assert.Empty(getEvents())

[<Fact>]
Expand All @@ -819,7 +819,7 @@ let ``LoadClosure for script is recomputed after changes`` () =
sourceFile "First" [])

let observe, check = recordEvents getFileNameKey

ProjectWorkflowBuilder(project, useTransparentCompiler = true) {
withChecker (observe _.ScriptClosure)
checkFile "First" expectOk
Expand All @@ -830,12 +830,12 @@ let ``LoadClosure for script is recomputed after changes`` () =
} |> ignore

check (fileName "First") [Weakened; Requested; Started; Finished; Weakened; Requested; Started; Finished]

[<Fact>]
let ``TryGetRecentCheckResultsForFile returns None before first call to ParseAndCheckFileInProject`` () =
let project = SyntheticProject.Create(
sourceFile "First" [])

ProjectWorkflowBuilder(project) {
clearCache
tryGetRecentCheckResults "First" expectNone
Expand All @@ -845,7 +845,7 @@ let ``TryGetRecentCheckResultsForFile returns None before first call to ParseAnd
let ``TryGetRecentCheckResultsForFile returns result after first call to ParseAndCheckFileInProject`` () =
let project = SyntheticProject.Create(
sourceFile "First" [] )

ProjectWorkflowBuilder(project) {
tryGetRecentCheckResults "First" expectSome
} |> ignore
Expand All @@ -854,21 +854,21 @@ let ``TryGetRecentCheckResultsForFile returns result after first call to ParseAn
let ``TryGetRecentCheckResultsForFile returns no result after edit`` () =
let project = SyntheticProject.Create(
sourceFile "First" [])

ProjectWorkflowBuilder(project) {
tryGetRecentCheckResults "First" expectSome
updateFile "First" updatePublicSurface
tryGetRecentCheckResults "First" expectNone
checkFile "First" expectOk
tryGetRecentCheckResults "First" expectSome
} |> ignore

[<Fact>]
let ``TryGetRecentCheckResultsForFile returns result after edit of other file`` () =
let project = SyntheticProject.Create(
sourceFile "First" [],
sourceFile "Second" ["First"])

ProjectWorkflowBuilder(project) {
tryGetRecentCheckResults "First" expectSome
tryGetRecentCheckResults "Second" expectSome
Expand Down Expand Up @@ -901,7 +901,7 @@ let ``Unused warning should still produce after parse warning`` useTransparentCo
// There should be parse warning because of the space in the file name:
// warning FS0221: The declarations in this file will be placed in an implicit module 'As 01' based on the file name 'As 01.fs'.
// However this is not a valid F# identifier, so the contents will not be accessible from other files. Consider renaming the file or adding a 'module' or 'namespace' declaration at the top of the file.

let project =
{ SyntheticProject.Create(
{ sourceFile "As 01" [] with
Expand All @@ -914,7 +914,7 @@ do
printfn "Hello from F#"
"""
SignatureFile = No

}) with
AutoAddModules = false
OtherOptions = [
Expand All @@ -939,7 +939,7 @@ printfn "Hello from F#"
checkResults.Diagnostics
|> Array.exists (fun diag -> diag.Severity = FSharpDiagnosticSeverity.Warning && diag.ErrorNumber = 1182)
Assert.True(hasCheckWarning, "Expected post inference warning FS1182")

ProjectWorkflowBuilder(project, useTransparentCompiler = useTransparentCompiler) {
checkFile "As 01" expectTwoWarnings
}
Expand All @@ -959,12 +959,12 @@ type private LoadClosureTestShim(currentFileSystem: IFileSystem) =
let mutable bDidUpdate = false
let asStream (v:string) = new MemoryStream(System.Text.Encoding.UTF8.GetBytes v)
let knownFiles = set [ "a.fsx"; "b.fsx"; "c.fsx" ]

member val aFsx = "#load \"b.fsx\""
member val bFsxInitial = ""
member val bFsxUpdate = "#load \"c.fsx\""
member val cFsx = ""

member x.DocumentSource (fileName: string) =
async {
if not (knownFiles.Contains fileName) then
Expand All @@ -978,7 +978,7 @@ type private LoadClosureTestShim(currentFileSystem: IFileSystem) =
}

member x.UpdateB () = bDidUpdate <- true

override _.FileExistsShim(path) =
if knownFiles.Contains path then true else currentFileSystem.FileExistsShim(path)
override _.GetFullPathShim(fileName) =
Expand All @@ -996,7 +996,7 @@ type private LoadClosureTestShim(currentFileSystem: IFileSystem) =
)

module TestsMutatingFileSystem =

[<Theory>]
[<InlineData(false)>]
[<InlineData(true)>]
Expand All @@ -1010,7 +1010,7 @@ module TestsMutatingFileSystem =
if System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription.StartsWith(".NET Framework") then
None
else
Some false
Some false

try
let checker = FSharpChecker.Create(useTransparentCompiler = useTransparentCompiler)
Expand All @@ -1034,7 +1034,7 @@ module TestsMutatingFileSystem =
match snd checkResults with
| FSharpCheckFileAnswer.Aborted -> failwith "Did not expected FSharpCheckFileAnswer.Aborted"
| FSharpCheckFileAnswer.Succeeded checkFileResults -> Assert.Equal(0, checkFileResults.Diagnostics.Length)

// Update b.fsx, it should now load c.fsx
fileSystemShim.UpdateB()

Expand Down Expand Up @@ -1081,7 +1081,7 @@ let ``Parsing with cache and without project snapshot`` () =
async {
let checker = FSharpChecker.Create(useTransparentCompiler = true)
let fileName = "B.fs"
let parsingOptions = { FSharpParsingOptions.Default with SourceFiles = [| "A.fs"; fileName; "C.fs" |] }
let parsingOptions = { FSharpParsingOptions.Default with SourceFiles = [| "A.fs"; fileName; "C.fs" |] }
let sourceText =
SourceText.ofString """
module B
Expand All @@ -1091,7 +1091,7 @@ let b : int = ExtraIdentUserNeverWroteRulezzz
let! parseResult = checker.ParseFile(fileName, sourceText, parsingOptions, cache = true)
Assert.False(parseResult.ParseHadErrors)
Assert.True(Array.isEmpty parseResult.Diagnostics)

let! parseAgainResult = checker.ParseFile(fileName, sourceText, parsingOptions, cache = true)
Assert.False(parseAgainResult.ParseHadErrors)
Assert.True(Array.isEmpty parseAgainResult.Diagnostics)
Expand Down
Loading