Skip to content

Commit

Permalink
reenable transparent compiler tests
Browse files Browse the repository at this point in the history
  • Loading branch information
majocha committed Oct 28, 2024
1 parent 8f82c8d commit c8567d3
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ open OpenTelemetry.Trace

#nowarn "57"

[<Fact(Skip="Flaky. See https://github.com/dotnet/fsharp/issues/16766")>]
[<Fact>]
let ``Use Transparent Compiler`` () =

let size = 20
Expand Down Expand Up @@ -60,7 +60,7 @@ let ``Use Transparent Compiler`` () =
checkFile last expectSignatureChanged
}

[<Fact(Skip="Flaky. See https://github.com/dotnet/fsharp/issues/16766")>]
[<Fact>]
let ``Parallel processing`` () =

let project = SyntheticProject.Create(
Expand All @@ -78,7 +78,7 @@ let ``Parallel processing`` () =
checkFile "E" expectSignatureChanged
}

[<Fact(Skip="Flaky. See https://github.com/dotnet/fsharp/issues/16766")>]
[<Fact>]
let ``Parallel processing with signatures`` () =

let project = SyntheticProject.Create(
Expand Down Expand Up @@ -113,29 +113,29 @@ let makeTestProject () =
let testWorkflow () =
ProjectWorkflowBuilder(makeTestProject(), useTransparentCompiler = true)

[<Fact(Skip="Flaky. See https://github.com/dotnet/fsharp/issues/16766")>]
[<Fact>]
let ``Edit file, check it, then check dependent file`` () =
testWorkflow() {
updateFile "First" breakDependentFiles
checkFile "First" expectSignatureChanged
checkFile "Second" expectErrors
}

[<Fact(Skip="Flaky. See https://github.com/dotnet/fsharp/issues/16766")>]
[<Fact>]
let ``Edit file, don't check it, check dependent file`` () =
testWorkflow() {
updateFile "First" breakDependentFiles
checkFile "Second" expectErrors
}

[<Fact(Skip="Flaky. See https://github.com/dotnet/fsharp/issues/16766")>]
[<Fact>]
let ``Check transitive dependency`` () =
testWorkflow() {
updateFile "First" breakDependentFiles
checkFile "Last" expectSignatureChanged
}

[<Fact(Skip="Flaky. See https://github.com/dotnet/fsharp/issues/16766")>]
[<Fact>]
let ``Change multiple files at once`` () =
testWorkflow() {
updateFile "First" (setPublicVersion 2)
Expand All @@ -144,7 +144,7 @@ let ``Change multiple files at once`` () =
checkFile "Last" (expectSignatureContains "val f: x: 'a -> (ModuleFirst.TFirstV_2<'a> * ModuleSecond.TSecondV_2<'a>) * (ModuleFirst.TFirstV_2<'a> * ModuleThird.TThirdV_2<'a>) * TLastV_1<'a>")
}

[<Fact(Skip="Flaky. See https://github.com/dotnet/fsharp/issues/16766")>]
[<Fact>]
let ``Files depend on signature file if present`` () =
let project = makeTestProject() |> updateFile "First" addSignatureFile

Expand All @@ -154,7 +154,7 @@ let ``Files depend on signature file if present`` () =
checkFile "Second" expectNoChanges
}

[<Fact(Skip="Flaky. See https://github.com/dotnet/fsharp/issues/16766")>]
[<Fact>]
let ``Project with signatures`` () =

let project = SyntheticProject.Create(
Expand All @@ -169,7 +169,7 @@ let ``Project with signatures`` () =
checkFile "Second" expectOk
}

[<Fact(Skip="Flaky. See https://github.com/dotnet/fsharp/issues/16766")>]
[<Fact>]
let ``Signature update`` () =

let project = SyntheticProject.Create(
Expand All @@ -185,22 +185,22 @@ let ``Signature update`` () =
checkFile "Second" expectSignatureChanged
}

[<Fact(Skip="Flaky. See https://github.com/dotnet/fsharp/issues/16766")>]
[<Fact>]
let ``Adding a file`` () =
testWorkflow() {
addFileAbove "Second" (sourceFile "New" [])
updateFile "Second" (addDependency "New")
checkFile "Last" (expectSignatureContains "val f: x: 'a -> (ModuleFirst.TFirstV_1<'a> * ModuleNew.TNewV_1<'a> * ModuleSecond.TSecondV_1<'a>) * (ModuleFirst.TFirstV_1<'a> * ModuleThird.TThirdV_1<'a>) * TLastV_1<'a>")
}

[<Fact(Skip="Flaky. See https://github.com/dotnet/fsharp/issues/16766")>]
[<Fact>]
let ``Removing a file`` () =
testWorkflow() {
removeFile "Second"
checkFile "Last" expectErrors
}

[<Fact(Skip="Flaky. See https://github.com/dotnet/fsharp/issues/16766")>]
[<Fact>]
let ``Changes in a referenced project`` () =
let library = SyntheticProject.Create("library", sourceFile "Library" [])

Expand All @@ -219,7 +219,7 @@ let ``Changes in a referenced project`` () =

}

[<Fact(Skip="Flaky. See https://github.com/dotnet/fsharp/issues/16766")>]
[<Fact>]
let ``File is not checked twice`` () =

let cacheEvents = ConcurrentQueue()
Expand All @@ -243,7 +243,7 @@ let ``File is not checked twice`` () =
Assert.Equal<JobEvent list>([Weakened; Requested; Started; Finished], intermediateTypeChecks["FileFirst.fs"])
Assert.Equal<JobEvent list>([Weakened; Requested; Started; Finished], intermediateTypeChecks["FileThird.fs"])

[<Fact(Skip="Flaky. See https://github.com/dotnet/fsharp/issues/16766")>]
[<Fact>]
let ``If a file is checked as a dependency it's not re-checked later`` () =
let cacheEvents = ConcurrentQueue()

Expand All @@ -267,7 +267,7 @@ let ``If a file is checked as a dependency it's not re-checked later`` () =
Assert.Equal<JobEvent list>([Weakened; Requested; Started; Finished; Requested], intermediateTypeChecks["FileThird.fs"])


// [<Fact(Skip="Flaky. See https://github.com/dotnet/fsharp/issues/16766")>] TODO: differentiate complete and minimal checking requests
// [<Fact>] TODO: differentiate complete and minimal checking requests
let ``We don't check files that are not depended on`` () =
let project = SyntheticProject.Create(
sourceFile "First" [],
Expand Down Expand Up @@ -297,7 +297,7 @@ let ``We don't check files that are not depended on`` () =
Assert.Equal<JobEvent list>([Started; Finished], intermediateTypeChecks["FileThird.fs"])
Assert.False (intermediateTypeChecks.ContainsKey "FileSecond.fs")

// [<Fact(Skip="Flaky. See https://github.com/dotnet/fsharp/issues/16766")>] TODO: differentiate complete and minimal checking requests
// [<Fact>] TODO: differentiate complete and minimal checking requests
let ``Files that are not depended on don't invalidate cache`` () =
let project = SyntheticProject.Create(
sourceFile "First" [],
Expand Down Expand Up @@ -338,7 +338,7 @@ let ``Files that are not depended on don't invalidate cache`` () =

Assert.Equal<string * JobEvent list>([], intermediateTypeChecks |> Map.toList)

// [<Fact(Skip="Flaky. See https://github.com/dotnet/fsharp/issues/16766")>] TODO: differentiate complete and minimal checking requests
// [<Fact>] TODO: differentiate complete and minimal checking requests
let ``Files that are not depended on don't invalidate cache part 2`` () =
let project = SyntheticProject.Create(
sourceFile "A" [],
Expand Down Expand Up @@ -378,7 +378,7 @@ let ``Files that are not depended on don't invalidate cache part 2`` () =
Assert.Equal<string * JobEvent list>(["FileE.fs", [Started; Finished]], graphConstructions)
Assert.Equal<string * JobEvent list>(["FileE.fs", [Started; Finished]], intermediateTypeChecks)

[<Fact(Skip="Flaky. See https://github.com/dotnet/fsharp/issues/16766")>]
[<Fact>]
let ``Changing impl files doesn't invalidate cache when they have signatures`` () =
let project = SyntheticProject.Create(
{ sourceFile "A" [] with SignatureFile = AutoGenerated },
Expand Down Expand Up @@ -407,7 +407,7 @@ let ``Changing impl files doesn't invalidate cache when they have signatures`` (

Assert.Equal<string * JobEvent list>([], intermediateTypeChecks)

[<Fact(Skip="Flaky. See https://github.com/dotnet/fsharp/issues/16766")>]
[<Fact>]
let ``Changing impl file doesn't invalidate an in-memory referenced project`` () =
let library = SyntheticProject.Create("library", { sourceFile "A" [] with SignatureFile = AutoGenerated })

Expand Down Expand Up @@ -646,13 +646,10 @@ let fuzzingTest seed (project: SyntheticProject) = task {
builder.DeleteProjectDir()
}
(* This gets in the way of insertions too often now, uncomment when stable.
[<Theory>]
[<InlineData(SignatureFiles.Yes)>]
[<InlineData(SignatureFiles.No)>]
[<InlineData(SignatureFiles.Some)>]
*)
let Fuzzing signatureFiles =
let seed = System.Random().Next()
Expand Down Expand Up @@ -790,7 +787,7 @@ module Stuff =
let fileName, snapshot, checker = singleFileChecker source
checker.ParseFile(fileName, snapshot) |> Async.RunSynchronously

//[<Fact(Skip="Flaky. See https://github.com/dotnet/fsharp/issues/16766")>]
//[<Fact>]
let ``Hash stays the same when whitespace changes`` () =

//let parseResult = getParseResult source
Expand Down Expand Up @@ -846,7 +843,7 @@ let ``TypeCheck last file in project with transparent compiler`` useTransparentC
checkFile lastFile expectOk
}

[<Fact(Skip="Flaky. See https://github.com/dotnet/fsharp/issues/16766")>]
[<Fact>]
let ``LoadClosure for script is computed once`` () =
let project = SyntheticProject.CreateForScript(
sourceFile "First" [])
Expand All @@ -871,7 +868,7 @@ let ``LoadClosure for script is computed once`` () =

Assert.Empty(closureComputations)

[<Fact(Skip="Flaky. See https://github.com/dotnet/fsharp/issues/16766")>]
[<Fact>]
let ``LoadClosure for script is recomputed after changes`` () =
let project = SyntheticProject.CreateForScript(
sourceFile "First" [])
Expand Down Expand Up @@ -900,7 +897,7 @@ let ``LoadClosure for script is recomputed after changes`` () =

Assert.Equal<JobEvent list>([Weakened; Requested; Started; Finished; Weakened; Requested; Started; Finished], closureComputations["FileFirst.fs"])

[<Fact(Skip="Flaky. See https://github.com/dotnet/fsharp/issues/16766")>]
[<Fact>]
let ``TryGetRecentCheckResultsForFile returns None before first call to ParseAndCheckFileInProject`` () =
let project = SyntheticProject.Create(
sourceFile "First" [])
Expand All @@ -910,7 +907,7 @@ let ``TryGetRecentCheckResultsForFile returns None before first call to ParseAnd
tryGetRecentCheckResults "First" expectNone
} |> ignore

[<Fact(Skip="Flaky. See https://github.com/dotnet/fsharp/issues/16766")>]
[<Fact>]
let ``TryGetRecentCheckResultsForFile returns result after first call to ParseAndCheckFileInProject`` () =
let project = SyntheticProject.Create(
sourceFile "First" [] )
Expand All @@ -919,7 +916,7 @@ let ``TryGetRecentCheckResultsForFile returns result after first call to ParseAn
tryGetRecentCheckResults "First" expectSome
} |> ignore

[<Fact(Skip="Flaky. See https://github.com/dotnet/fsharp/issues/16766")>]
[<Fact>]
let ``TryGetRecentCheckResultsForFile returns no result after edit`` () =
let project = SyntheticProject.Create(
sourceFile "First" [])
Expand All @@ -932,7 +929,7 @@ let ``TryGetRecentCheckResultsForFile returns no result after edit`` () =
tryGetRecentCheckResults "First" expectSome
} |> ignore

[<Fact(Skip="Flaky. See https://github.com/dotnet/fsharp/issues/16766")>]
[<Fact>]
let ``TryGetRecentCheckResultsForFile returns result after edit of other file`` () =
let project = SyntheticProject.Create(
sourceFile "First" [],
Expand All @@ -946,9 +943,9 @@ let ``TryGetRecentCheckResultsForFile returns result after edit of other file``
tryGetRecentCheckResults "Second" expectSome // file didn't change so we still want to get the recent result
} |> ignore

[<Fact(Skip="Flaky. See https://github.com/dotnet/fsharp/issues/16766")>]
[<Fact(Skip="TransparentCompiler assumeDotNetFramework differs from default checker")>]
let ``Background compiler and Transparent compiler return the same options`` () =
async {
task {
let backgroundChecker = FSharpChecker.Create(useTransparentCompiler = false)
let transparentChecker = FSharpChecker.Create(useTransparentCompiler = true)
let scriptName = Path.Combine(__SOURCE_DIRECTORY__, "script.fsx")
Expand Down Expand Up @@ -1013,7 +1010,7 @@ printfn "Hello from F#"
checkFile "As 01" expectTwoWarnings
}

[<Fact(Skip="Flaky. See https://github.com/dotnet/fsharp/issues/16766")>]
[<Fact>]
let ``Transparent Compiler ScriptClosure cache is populated after GetProjectOptionsFromScript`` () =
async {
let transparentChecker = FSharpChecker.Create(useTransparentCompiler = true)
Expand Down
2 changes: 1 addition & 1 deletion tests/FSharp.Compiler.Service.Tests/BuildGraphTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ module BuildGraphTests =
Assert.shouldBeTrue(ex <> null)
try task.Wait(1000) |> ignore with | :? TimeoutException -> reraise() | _ -> ()

[<Fact>]
[<Fact(Skip="takes too long")>]
let ``Many requests to get a value asynchronously might evaluate the computation more than once even when some requests get canceled``() =
let requests = 10000
let resetEvent = new ManualResetEvent(false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ let z = Project1.x
ReferencedProjects = [| FSharpReferencedProject.FSharpReference(MultiProjectDirty1.dllName, MultiProjectDirty1.getOptions()) |] }

[<Theory>]
// [<InlineData(true)>]
[<InlineData(true)>]
[<InlineData(false)>]
let ``Test multi project symbols should pick up changes in dependent projects`` useTransparentCompiler =

Expand Down
16 changes: 8 additions & 8 deletions tests/FSharp.Compiler.Service.Tests/ProjectAnalysisTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -4647,7 +4647,7 @@ let callToOverload = B(5).Overload(4)
let args = mkProjectCommandLineArgs (dllName, [])

[<Theory>]
// [<InlineData true>] // Flaky, reenable when stable
[<InlineData true>] // Flaky, reenable when stable
[<InlineData false>]
let ``Test project36 FSharpMemberOrFunctionOrValue.IsBaseValue`` useTransparentCompiler =
let keepAssemblyContentsChecker = FSharpChecker.Create(keepAssemblyContents=true, useTransparentCompiler=useTransparentCompiler)
Expand All @@ -4664,7 +4664,7 @@ let ``Test project36 FSharpMemberOrFunctionOrValue.IsBaseValue`` useTransparentC
|> fun baseSymbol -> shouldEqual true baseSymbol.IsBaseValue

[<Theory>]
// [<InlineData true>] // Flaky, reenable when stable
[<InlineData true>] // Flaky, reenable when stable
[<InlineData false>]
let ``Test project36 FSharpMemberOrFunctionOrValue.IsConstructorThisValue & IsMemberThisValue`` useTransparentCompiler =
let keepAssemblyContentsChecker = FSharpChecker.Create(keepAssemblyContents=true, useTransparentCompiler=useTransparentCompiler)
Expand Down Expand Up @@ -4703,7 +4703,7 @@ let ``Test project36 FSharpMemberOrFunctionOrValue.IsConstructorThisValue & IsMe
|> shouldEqual true

[<Theory>]
// [<InlineData true>] // Flaky, reenable when stable
[<InlineData true>] // Flaky, reenable when stable
[<InlineData false>]
let ``Test project36 FSharpMemberOrFunctionOrValue.LiteralValue`` useTransparentCompiler =
let keepAssemblyContentsChecker = FSharpChecker.Create(keepAssemblyContents=true, useTransparentCompiler=useTransparentCompiler)
Expand Down Expand Up @@ -5324,7 +5324,7 @@ let foo (a: Foo): bool =
let options = { checker.GetProjectOptionsFromCommandLineArgs (projFileName, args) with SourceFiles = fileNames }

[<Theory>]
// [<InlineData true>] // Flaky, reenable when stable
[<InlineData true>] // Flaky, reenable when stable
[<InlineData false>]
let ``Test typed AST for struct unions`` useTransparentCompiler = // See https://github.com/fsharp/FSharp.Compiler.Service/issues/756
let keepAssemblyContentsChecker = FSharpChecker.Create(keepAssemblyContents=true, useTransparentCompiler=useTransparentCompiler)
Expand Down Expand Up @@ -5414,7 +5414,7 @@ let ``Test diagnostics with line directives ignored`` () =
//------------------------------------------------------

[<Theory>]
// [<InlineData true>] // Flaky, reenable when stable
[<InlineData true>] // Flaky, reenable when stable
[<InlineData false>]
let ``ParseAndCheckFileResults contains ImplFile list if FSharpChecker is created with keepAssemblyContent flag set to true`` useTransparentCompiler =

Expand Down Expand Up @@ -5500,7 +5500,7 @@ let ``#4030, Incremental builder creation warnings 5`` () =
//------------------------------------------------------

[<Theory>]
// [<InlineData true>] // Flaky, reenable when stable
[<InlineData true>] // Flaky, reenable when stable
[<InlineData false>]
let ``Unused opens in rec module smoke test 1`` useTransparentCompiler =

Expand Down Expand Up @@ -5575,7 +5575,7 @@ type UseTheThings(i:int) =
unusedOpensData |> shouldEqual expected

[<Theory>]
// [<InlineData true>] // Flaky, reenable when stable
[<InlineData true>] // Flaky, reenable when stable
[<InlineData false>]
let ``Unused opens in non rec module smoke test 1`` useTransparentCompiler =

Expand Down Expand Up @@ -5664,7 +5664,7 @@ type UseTheThings(i:int) =
unusedOpensData |> shouldEqual expected

[<Theory>]
// [<InlineData true>] // Flaky, reenable when stable
[<InlineData true>] // Flaky, reenable when stable
[<InlineData false>]
let ``Unused opens smoke test auto open`` useTransparentCompiler =

Expand Down

0 comments on commit c8567d3

Please sign in to comment.