Commit Graph

110 Commits

Author SHA1 Message Date
Valeriy Savchenko 5b4f143564 [analyzer][tests] Introduce analyzer benchmarking framework
Summary:
This commit includes a couple of changes:
  * Benchmark selected projects by analyzing them multiple times
  * Compare two benchmarking results and visualizing them on one chart
  * Organize project build logging, so we can use the same code
    in benchmarks

Differential Revision: https://reviews.llvm.org/D83539
2020-07-14 11:42:46 +03:00
Valeriy Savchenko 00997d1cad [analyzer][tests] Fix zip unpacking
Differential Revision: https://reviews.llvm.org/D83374
2020-07-10 11:32:13 +03:00
Valeriy Savchenko 21bacc2154 [analyzer][tests] Measure peak memory consumption for every project
Differential Revision: https://reviews.llvm.org/D82967
2020-07-10 11:31:41 +03:00
Valeriy Savchenko 495fd64041 [analyzer] SATest: Use logger in single-threaded mode as well
Summary:
It generalizes the way the output looks across any -jN.
Additionally it solves the buffering problems.

Differential Revision: https://reviews.llvm.org/D81601
2020-06-25 12:28:22 +03:00
Valeriy Savchenko 6f55355c16 [analyzer] SATest: Add 5 more projects for testing
Differential Revision: https://reviews.llvm.org/D81599
2020-06-25 12:28:22 +03:00
Valeriy Savchenko 38b455e91a [analyzer] SATest: Add option to specify projects to test
Differential Revision: https://reviews.llvm.org/D81569
2020-06-16 13:30:01 +03:00
Valeriy Savchenko d9944da273 [analyzer] SATest: Introduce a single entrypoint for regression scripts
Differential Revision: https://reviews.llvm.org/D81567
2020-06-16 13:30:01 +03:00
Valeriy Savchenko 35dd0147cd [analyzer] CmpRuns.py: Decouple main functionality from argparse
Summary:
It makes it much harder to use from other modules when one of the
parameters is an argparse Namespace.  This commit makes it easier
to use CmpRuns programmatically.

Differential Revision: https://reviews.llvm.org/D81566
2020-06-16 13:30:01 +03:00
Valeriy Savchenko bbb8f17136 [analyzer] SATest: Add posibility to download source from git and zip
Differential Revision: https://reviews.llvm.org/D81564
2020-06-16 13:30:00 +03:00
Valeriy Savchenko fb4b565212 [analyzer] SATest: Move from csv to json project maps
Summary:
JSON format is a bit more verbose and easier to reason about
and extend.  For this reason, before extending SATestBuild
functionality it is better to refactor the part of how we
configure the whole system.

Differential Revision: https://reviews.llvm.org/D81563
2020-06-16 13:30:00 +03:00
Valeriy Savchenko 98f737f4bf [analyzer] CmpRuns.py: Refactor and add type annotations. NFC.
Differential Revision: https://reviews.llvm.org/D80517
2020-06-16 13:29:46 +03:00
Valeriy Savchenko 5395389475 [analyzer] SATestBuild.py: Make verbosity level a cmd option
Reviewers: NoQ, dcoughlin

Subscribers: xazax.hun, baloghadamsoftware, szepet, a.sidorin, mikhail.ramalho, Szelethus, donat.nagy, dkrupp, Charusso, ASDenysPetrov, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D80626
2020-05-28 20:47:06 +03:00
Valeriy Savchenko a5b2503a8a [analyzer] SATestBuild.py: Fix hang when one of the tasks fails
Summary:
Tasks can crash with many different exceptions including SystemExit.
Bare except still causes a warning, so let's use BaseException instead.

Differential Revision: https://reviews.llvm.org/D80443
2020-05-22 19:15:00 +03:00
Valeriy Savchenko 7cebfa4e06 [analyzer] SATestUtils.py: Refactor and add type annotations
Differential Revision: https://reviews.llvm.org/D80424
2020-05-22 13:51:58 +03:00
Valeriy Savchenko 4902ca6da4 [analyzer] SATestBuild.py: Refactor and add type annotations
Summary:
SATest scripts should be more python-style than they are now.
This includes better architecture, type annotations, naming
convesions, and up-to-date language features.  This commit starts
with two scripts SATestBuild and SATestAdd.

Differential Revision: https://reviews.llvm.org/D80423
2020-05-22 13:51:58 +03:00
Valeriy Savchenko 6846aec731 [analyzer] SATestBuild.py: Optionally override compiler
Differential Revision: https://reviews.llvm.org/D80211
2020-05-19 17:12:46 +03:00
Artem Dergachev 1a3b801db5 [analyzer] SATestBuild.py: Fix handling invalid plists after 2to3 conversion.
The updated plistlib throws a different exception class.
2020-05-15 14:27:30 +03:00
Valeriy Savchenko c98872e3a3 [analyzer] Modernize analyzer's Python scripts
Summary:
Fix read/write in binary format, which crashes Python 3.
Additionally, clean up redundant (as for Python 3) code and
fix a handful of flake8 warnings.

Differential Revision: https://reviews.llvm.org/D79932
2020-05-14 15:55:37 +03:00
Artem Dergachev 8cbd3f431a [analyzer] SATestBuild.py: Be defensive against corrupt plist files. 2020-05-13 14:13:00 +03:00
Artem Dergachev 11c8c2a551 [analyzer] SATestBuild.py: Fix support for #NOPREFIX.
Regressed in ec2d93c.
2020-05-12 22:43:32 +03:00
Artem Dergachev ec2d93c7d7 [analyzer] SATestBuild.py: Allow comments in run_static_analyzer.cmd.
Because those can get really weird sometimes.
2020-05-11 17:26:37 +03:00
Artem Dergachev e8b29c00dd [analyzer] SATestBuild.py: Use driver for analyzing single-file tests.
Don't bother coming up with a -cc1 run-line ourselves.

This, in particular, gets rid of a macOS-specific code path.

llvm-svn: 362009
2019-05-29 18:49:31 +00:00
Serge Guelton d458974c45 Portable Python script across Python version
In Python3, dict.items, dict.keys, dict.values, zip, map and filter no longer return lists, they create generator instead.

The portability patch consists in forcing an extra `list` call if the result is actually used as a list.
`map` are replaced by list comprehension and `filter` by filtered list comprehension.

Differential Revision: https://reviews.llvm.org/D55197

llvm-svn: 349501
2018-12-18 16:04:21 +00:00
Serge Guelton c0ebe773cd Portable Python script across Python version
Using from __future__ import print_function it is possible to have a compatible behavior of `print(...)` across Python version.

Differential Revision: https://reviews.llvm.org/D55213

llvm-svn: 349454
2018-12-18 08:36:33 +00:00
Serge Guelton 1f88dc5aee Portable Python script across Python version
Queue module as been renamed into queue in Python3

Differential Revision: https://reviews.llvm.org/D55202

llvm-svn: 349009
2018-12-13 07:44:19 +00:00
Serge Guelton 3de410848c Portable Python script across Python version
Python2 supports the two following equivalent construct

	raise ExceptionType, exception_value
and
	raise ExceptionType(exception_value)

Only the later is supported by Python3.

Differential Revision: https://reviews.llvm.org/D55195

llvm-svn: 348126
2018-12-03 12:11:21 +00:00
George Karpenkov d3b0846e7a [analyzer] [tests] Hotfix: missing space
llvm-svn: 343643
2018-10-02 22:31:44 +00:00
George Karpenkov ac98683423 [analyzer] [tests] Allow specifying entire -analyze-config on the command line, make sure it's always propagated
Differential Revision: https://reviews.llvm.org/D52801

llvm-svn: 343636
2018-10-02 21:19:23 +00:00
George Karpenkov 47e5493b1d [analyzer] [testing] Pass through an extra argument for specifying extra analyzer options
Differential Revision: https://reviews.llvm.org/D52585

llvm-svn: 343158
2018-09-27 01:10:59 +00:00
George Karpenkov 13d3748e7c [analyzer] [tests] Style fixes for testing harness.
llvm-svn: 338322
2018-07-30 23:01:20 +00:00
George Karpenkov 6e4ddf49d8 [analyzer] [tests] Pass clang executable path to prefix-less executor scripts.
llvm-svn: 336124
2018-07-02 17:10:40 +00:00
George Karpenkov 5c23d6ab3c [analyzer] [tests] Allow the tested project to specify it's own analyzer wrapper
llvm-svn: 336023
2018-06-29 22:05:32 +00:00
George Karpenkov a262cf3146 [analyzer] [tests] Fix 80 column violation in SATestBuild.py
llvm-svn: 336022
2018-06-29 22:05:13 +00:00
Mikhail R. Gadelha afc62b7032 [analyzer] Fix string not being formatted with extra arguments
Signed-off-by: Mikhail Ramalho <mikhail.ramalho@gmail.com>
llvm-svn: 335739
2018-06-27 14:39:41 +00:00
George Karpenkov 30130b78c5 [analyzer] [tests] Include statistics in tests.
llvm-svn: 335685
2018-06-26 23:17:35 +00:00
George Karpenkov 711058165c [analyzer] [testing] Be less verbose by default in integration testing.
llvm-svn: 328752
2018-03-29 01:23:54 +00:00
George Karpenkov b7120c944b [analyzer] [tests] Update CmpRuns to write to stdout correctly in multithreaded environment
llvm-svn: 325070
2018-02-13 23:36:01 +00:00
George Karpenkov 192d9a186f [analyzer] [tests] Fix a typo in analyzer testing script.
Incorrect option instance construction.

llvm-svn: 324946
2018-02-12 22:13:01 +00:00
George Karpenkov fc782a341a [analyzer] [tests] [NFC] Remove a fragile tightly-coupled component emulating parser output
...when we can just use the real parser instead.

Differential Revision: https://reviews.llvm.org/D43098

llvm-svn: 324759
2018-02-09 18:39:47 +00:00
George Karpenkov f37d3a5f84 [analyzer] [tests] Test different projects concurrently
Differential Revision: https://reviews.llvm.org/D43031

llvm-svn: 324652
2018-02-08 21:22:42 +00:00
George Karpenkov 9ed25edc66 [analyzer] Use stable filenames in analyzer testing infrastructure
Makes finding the right file in test results easier.

Differential Revision: https://reviews.llvm.org/D42445

llvm-svn: 323697
2018-01-29 21:45:07 +00:00
George Karpenkov 3c128cb1e6 [analyzer] [tests] Remove empty folders in reference results, do not store diffs.txt
Storing diffs.txt is now redundant, as we simply dump the CmpRuns output
to stdout (it is saved in CI and tends to be small).
Not generating those files enables us to remove empty folders, which
confuse git, as it would not add them with reference results.

llvm-svn: 316948
2017-10-30 19:40:33 +00:00
George Karpenkov 0a6dba792f [Analyzer] [Tests] Fixing typo from the previous commit.
Can not open a non-existent file with r+.

llvm-svn: 316808
2017-10-27 22:52:36 +00:00
George Karpenkov e58044d432 [Analyzer] [Tests] Dump the output of scan-build to stdout on failure.
Eliminates extra lookup step during debugging.

llvm-svn: 316806
2017-10-27 22:39:54 +00:00
George Karpenkov ff555ce798 [Analyzer] [Tests] Write analyzers crashes to stdout, and not to a separate file
With this change it would be sufficient to look at CI console to see the
failure.

llvm-svn: 316687
2017-10-26 19:00:22 +00:00
George Karpenkov 65839bd429 [Analyzer] [Tests] Consistently use exit codes. Use code=42 to signify different results
llvm-svn: 316632
2017-10-26 01:13:22 +00:00
George Karpenkov a932c8745c [Analyzer] [Tests] Do not discard output from CmpRuns.py when running integration tests
Contrary to the deleted comment, in most cases CmpRuns.py produces a
fairly small amount of output, which is useful to see straight away to
see what has changed when executing the integration tests.

llvm-svn: 316618
2017-10-25 21:49:46 +00:00
George Karpenkov bf92c44616 [Analyzer] [Tests] Minor refactor of testing infrastructure:
Move utilities functions into a separate file to make comprehension
easier.

llvm-svn: 316535
2017-10-24 23:52:48 +00:00
George Karpenkov 318cd1f263 [Analyzer] [Tests] Remove temporary fields from generated reference results.
Pointer to HTML diagnostics is removed (as it is not stored) as well as
the version (as it would be available from the commit message).

llvm-svn: 316534
2017-10-24 23:52:46 +00:00
George Karpenkov 43f683cb33 [Analyzer] Fix bug in testing scripts, which always marked result as failure.
llvm-svn: 316522
2017-10-24 22:24:13 +00:00