Repository navigation
feat: analyze files several at once, each whatever the others came to - #148
Merged
Merged
Conversation
analyzeFiles hands the files to as many threads as it is told, and tells a reporter of each file as it starts and once it has ended, one call at a time. Unlike the steps of a build, a file that fails does not stop the others; only a tool that cannot be started does.
The queue held the function given to it as _analyze, beside its own analyze, which reports a file around it; a call to either read alike.
The parallel analysis tests wait on events alone, as the build tests do, and rely on the time limit to end a wait that never ends.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds the part that analyzes the files of a project several at once, which
scrap checkwill use. No command uses it yet, and it knows nothing of clang-tidy: it is handed the function that analyzes one file.Check::analyzeFilestakes the files in order and analyzes as many at once as it is told, with the calling thread as one of the threads, as the steps of a build are run.The steps of a build are not reused, as they wait for the kinds before their own, skip what is up to date, and stop at the first failure, none of which an analysis wants.
Tests
ParallelAnalysisTest, 6 tests, with a scripted analysis and a reporter that fails the test when two calls overlap: every file analyzed after one fails, files analyzed at the same time, output and failures in the order the files ended, the stop once the tool cannot be started, nothing to analyze, and what an analysis throws.Each of these fails at least one test when taken out: going on after a failure, stopping once the tool cannot be started, the output handed to the reporter, more than one thread, analyzing outside the lock, and passing on or stopping at what was thrown.
Locally, the tests ran 500 times in a row, and 200 times built with GCC's ThreadSanitizer, with no failure and no report.