From 81682561f5589daa25ae06bf0978c810e1a8b291 Mon Sep 17 00:00:00 2001 From: Pepe Iborra Date: Sun, 20 Jun 2021 10:26:53 +0100 Subject: [PATCH] [ghcide-bench] fix edit experiment I noticed that the edit experiment is reporting bogus "user time" numbers because waitForProgressDone is being satisfied by the previous iteration build. The fix is easy: wait for a freshly started build first. --- ghcide/bench/lib/Experiments.hs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/ghcide/bench/lib/Experiments.hs b/ghcide/bench/lib/Experiments.hs index 80035ba119..7b3ffbb642 100644 --- a/ghcide/bench/lib/Experiments.hs +++ b/ghcide/bench/lib/Experiments.hs @@ -76,7 +76,10 @@ experiments = bench "edit" $ \docs -> do forM_ docs $ \DocumentPositions{..} -> changeDoc doc [charEdit stringLiteralP] - waitForProgressDone -- TODO check that this waits for all of them + -- wait for a fresh build start + waitForProgressStart + -- wait for the build to be finished + waitForProgressDone return True, --------------------------------------------------------------------------------------- bench "hover after edit" $ \docs -> do @@ -390,6 +393,12 @@ data BenchRun = BenchRun badRun :: BenchRun badRun = BenchRun 0 0 0 0 0 False +waitForProgressStart :: Session () +waitForProgressStart = void $ do + skipManyTill anyMessage $ satisfy $ \case + FromServerMess SWindowWorkDoneProgressCreate _ -> True + _ -> False + -- | Wait for all progress to be done -- Needs at least one progress done notification to return waitForProgressDone :: Session ()