Currently it doesn't matter because we run PreambleThread in sync mode.
Once we start running it in async, test order will become non-deterministic.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
clang-tools-extra/clangd/unittests/TUSchedulerTests.cpp | ||
---|---|---|
866 | This seems unfortunate because it doesn't test the production configuration. How many possible sequences are there? Are there fewer if we blockuntilidle between adddoc + locatesymbolat? Can we use testing::AnyOf to fudge around the nondeterminism? | |
894 | FWIW, I found the comments useful, and don't understand e.g. why we have two identical lines anymore. | |
897 | why do we never go idle at the end? |
clang-tools-extra/clangd/unittests/TUSchedulerTests.cpp | ||
---|---|---|
866 | I didn't want to do that as it was rather asserting on action ordering of preamble and ast worker threads rather than checking for whether we emit TUStatuses, but I suppose this test was always trying to assert both. Introducing some more simplications by turning of diagnostics and also making use of the assumption that ASTWorker will block for first preamble build. | |
897 | because astworker doesn't emit queue related notifications(running action, queued, idle) in RunSync mode. |
Thanks! Now having read it, I'm slightly nervous we're not catching all the interleavings.
An alternate approach if this is too messy would be just to capture the two streams of enums into separate vectors, drop duplicates, and assert the sequence of each.
Anyway, up to you what to do here, I'm happy if we're testing at least something in the async configuration.
clang-tools-extra/clangd/unittests/TUSchedulerTests.cpp | ||
---|---|---|
866 | This makes sense, at the risk of being a massive pain do you think we should have a separate test that (only) creates diagnostics? | |
912 | haha, including the (idle,runningaction) case twice is fun :-) Maybe not necessary though | |
918 | Hmm... are you sure the preamble can't still be running at this point? What stops it from pausing forever before exiting? |
going with separately recording each thread. that way we can also test building of diagnostics.
clang-tools-extra/clangd/unittests/TUSchedulerTests.cpp | ||
---|---|---|
866 | changed the test to record each thread separately while deduplicating, so we can also build the diags now. | |
918 | it has to go idle before stopping, since we block after issuing the update. |
This seems unfortunate because it doesn't test the production configuration.
How many possible sequences are there? Are there fewer if we blockuntilidle between adddoc + locatesymbolat?
Can we use testing::AnyOf to fudge around the nondeterminism?