[Analyzer] Refactor analyzer testing scripts.
- Exporting needed function for future reuse.
- Idiomatic python: using with `file as f` instead of `try/finally`.
- Fixing some indentation issues.
- No need to reinvent python `multiprocessing.getCPUCount()`
- Removing a function parameter which is always the same under all invocations.
- Adding some docstrings.
Differential Revision: https://reviews.llvm.org/D38156
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@313949
91177308-0d34-0410-b5e6-
96231b3b80d8