提交 91bdb8a8 编写于 作者: D Don Syme 提交者: Kevin Ransom (msft)

add diagnostics (#6321)

* add diagnostics

* add diagnostics

* diagnostics

* diagnostics

* diagnostics

* add diagnostics and possible fix for tp smoke tests

* fix build

* fix build

* more diagnostics

* try to fix flaky test

* fix build

* try to fix dodgy test
上级 b904d430
......@@ -278,8 +278,10 @@ type CancellationType() =
} |> Async.Start
try
let res = t.Wait(1000)
Assert.Fail (sprintf "Excepted TimeoutException wrapped in an AggregateException, but got %A" res)
let res = t.Wait(2000)
let msg = sprintf "Excepted TimeoutException wrapped in an AggregateException, but got %A" res
printfn "failure msg: %s" msg
Assert.Fail (msg)
with :? AggregateException as agg -> ()
[<Test>]
......
......@@ -124,7 +124,10 @@ module GlobalCounters =
let AddConfig c = lock counterLock (fun () -> configs <- c :: configs)
let GetConfigs() = lock counterLock (fun () -> configs)
let CheckAllConfigsDisposed() =
for c in GetConfigs() do
let cs = GetConfigs()
lock counterLock (fun () ->
configs <- [])
for c in cs do
try
c.SystemRuntimeContainsType("System.Object") |> ignore
failwith "expected configuration object to be disposed"
......
......@@ -1623,28 +1623,44 @@ type UsingMSBuild() as this =
let file1 = OpenFile(project,fileName)
// The disposals should be at least one less
Assert.IsTrue(countDisposals() < i, "Check1, countDisposals() < i, iteration " + string i)
let c = countCreations()
let d = countDisposals()
Assert.IsTrue(c >= countDisposals(), "Check2, countCreations() >= countDisposals(), iteration " + string i + ", countCreations() = " + string c + ", countDisposals() = " + string d)
Assert.IsTrue((c = i), "Check3, countCreations() = i, iteration " + string i + ", countCreations() = " + string c)
// Creations should always be greater or equal to disposals
Assert.IsTrue(c >= d, "Check2, countCreations() >= countDisposals(), iteration " + string i + ", countCreations() = " + string c + ", countDisposals() = " + string d)
// Creations can run ahead of iterations if the background checker resurrects the builder for a project
// even after we've moved on from it.
Assert.IsTrue((c >= i), "Check3, countCreations() >= i, iteration " + string i + ", countCreations() = " + string c)
if not clearing then
// By default we hold 3 build incrementalBuilderCache entries and 5 typeCheckInfo entries, so if we're not clearing
// there should be some roots to project builds still present
if i >= 3 then
Assert.IsTrue(i >= countDisposals() + 3, "Check4a, i >= countDisposals() + 3, iteration " + string i + ", i = " + string i + ", countDisposals() = " + string (countDisposals()))
Assert.IsTrue(c >= d + 3, "Check4a, c >= countDisposals() + 3, iteration " + string i + ", i = " + string i + ", countDisposals() = " + string d)
printfn "Check4a2, i = %d, countInvaldiationHandlersRemoved() = %d" i (countInvaldiationHandlersRemoved())
// If we forcefully clear out caches and force a collection, then we can say much stronger things...
if clearing then
ClearLanguageServiceRootCachesAndCollectAndFinalizeAllTransients(this.VS)
Assert.IsTrue((i = countDisposals()), "Check4b, countCreations() = countDisposals(), iteration " + string i)
Assert.IsTrue(countInvaldiationHandlersAdded() - countInvaldiationHandlersRemoved() = 0, "Check4b2, all invlidation handlers removed, iteration " + string i)
let c = countCreations()
let d = countDisposals()
// Creations should be equal to disposals after a `ClearLanguageServiceRootCachesAndCollectAndFinalizeAllTransients`
Assert.IsTrue((c = d), "Check4b, countCreations() = countDisposals(), iteration " + string i)
Assert.IsTrue((countInvaldiationHandlersAdded() = countInvaldiationHandlersRemoved()), "Check4b2, all invlidation handlers removed, iteration " + string i)
Assert.IsTrue(countCreations() = 50, "Check5, at end, countCreations() = 50")
let c = countCreations()
let d = countDisposals()
Assert.IsTrue(c >= 50, "Check5, at end, countCreations() >= 50")
ClearLanguageServiceRootCachesAndCollectAndFinalizeAllTransients(this.VS)
Assert.IsTrue(countDisposals() = 50, "Check6b, at end, countDisposals() = 50 after explicit clearing")
Assert.IsTrue(countInvaldiationHandlersAdded() - countInvaldiationHandlersRemoved() = 0, "Check6b2, at end, all invalidation handlers removed after explicit cleraring")
let c = countCreations()
let d = countDisposals()
// Creations should be equal to disposals after a `ClearLanguageServiceRootCachesAndCollectAndFinalizeAllTransients`
Assert.IsTrue((c = d), "Check6b, at end, countCreations() = countDisposals() after explicit clearing")
Assert.IsTrue((countInvaldiationHandlersAdded() = countInvaldiationHandlersRemoved()), "Check6b2, at end, all invalidation handlers removed after explicit cleraring")
checkConfigsDisposed()
[<Test;Category("TypeProvider"); Category("Expensive")>]
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册