Commit Graph

99 Commits

Author SHA1 Message Date
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
George Karpenkov 7d36cd7223 [Analyzer] Remove dead code from testing scripts
Differential Revision: https://reviews.llvm.org/D38488

llvm-svn: 315489
2017-10-11 18:42:39 +00:00
George Karpenkov 1b51cbddf4 [Analyzer Tests] Run static analyzer integration tests until the end,
Do not stop at the first failure.

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

llvm-svn: 314992
2017-10-05 17:32:06 +00:00
George Karpenkov 9944babb65 [Analyzer Tests] Fix misc bugs in analyzer reference results updater.
llvm-svn: 314960
2017-10-05 01:02:20 +00:00
George Karpenkov a807660918 [Analyzer] Make testing scripts flake8 compliant
Differential Review: https://reviews.llvm.org/D38213

llvm-svn: 314692
2017-10-02 17:59:12 +00:00
George Karpenkov af76b4a553 [Analyzer] Add nullability to the list of tested checkers in SATestBuild
Differential Revision: https://reviews.llvm.org/D38162

llvm-svn: 314572
2017-09-30 00:05:24 +00:00
George Karpenkov 439a95bde7 [Analyzer] Fix minor errors in python scripts.
llvm-svn: 314042
2017-09-22 22:58:46 +00:00
George Karpenkov aff33385d2 [Analyzer] Static analyzer script for updating reference results
The script updates reference results from the previous run, and stages them.

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

llvm-svn: 313950
2017-09-22 01:43:12 +00:00
George Karpenkov 3abfc3b0d7 [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

llvm-svn: 313949
2017-09-22 01:41:16 +00:00
George Karpenkov be6c329515 [Analyzer] Use CC environment variable to select analyzer path in SATestBuild.
This change is required to easily test the given checkout of the analyzer,
rather than the one bundled with a system compiler.

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

llvm-svn: 313927
2017-09-21 22:12:49 +00:00
George Karpenkov 2d155092cb [Analyzer] Add simple help to SATestAdd.py
Differential Revision: https://reviews.llvm.org/D38003

llvm-svn: 313924
2017-09-21 21:47:33 +00:00
George Karpenkov 7a256839d9 [Analyzer] Remove dead code from CmpRuns.py.
Differential Revision: https://reviews.llvm.org/D38003

llvm-svn: 313923
2017-09-21 21:47:13 +00:00
Devin Coughlin 0dfc6f0809 [analyzer] SATestBuild.py: Treat '#' as comment in projectMap.csv
Treat lines in projectMap.csv that start with '#' as comments. This enables a
workflow where projects can be temporarily disabled with a comment describing
when they should be turned back on.

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

llvm-svn: 281880
2016-09-19 01:36:40 +00:00
Devin Coughlin 9ea8033d1b [analyzer] SATestBuild.py: Remove html and log when producing reference results.
The html reports are huge -- every issue in a given file results in a separate
copy of the source code, in HTML form, for the file. This gets very large
quickly and it doesn't make sense to check this into a reference repository.
Also remove the log when generating reference results because it can leak
absolute path names. We still keep both the html and the log around when
producing non-reference results.

llvm-svn: 258594
2016-01-23 01:09:07 +00:00
Devin Coughlin 86f61a9a62 [analyzer] SATestBuild.py: Handle spaces in path passed to --use-analyzer.
I missed this one in r258493.

llvm-svn: 258517
2016-01-22 18:45:22 +00:00
Devin Coughlin ab95cd2794 [analyzer] Update SATestBuild.py to handle spaces in paths.
The Jenkins workspace on the new Green Dragon builder for the static analyzer has spaces
in its path.

llvm-svn: 258493
2016-01-22 07:08:06 +00:00
Devin Coughlin 2cb767d32b [analyzer] Update SATestBuild.py to enable a 'download and patch' model for projects.
Currently the SATestBuild.py and SATestAdd.py buildbot scripts expect project
sources to be checked into the project repository. This commit changes these
scripts to additionally support a model where project sources are downloaded
rather than checked into the repository. Sometimes projects may need to be
modified (for example, to support a newer versions of clang), so the updated scripts
also allow for an optional patch file that will be applied to the downloaded
project source before analysis.

To support this workflow, this commit changes the expected layout of
a project in the repository. The project-specific helper scripts will stay
in the root of each project directory, but the benchmark source itself (if
checked into the repo) should now be stored in a subdirectory named
'CachedSource':

  project_name/
    cleanup_run_static_analyzer.sh [optional]
    run_static_analyzer.cmd [required]
    download_project.sh [optional]
    CachedSource/ [optional]
    changes_for_analyzer.patch [optional]

If the 'CachedSource' source directory is not present, the download script will
be executed. This script should download the project source into 'CachedSource'.
Then, if 'changes_for_analyzer.patch' is present its changes will
be applied to a copy of 'CachedSource' before analysis.

Differential Revision: http://reviews.llvm.org/D14345

llvm-svn: 252410
2015-11-07 18:27:35 +00:00
Gabor Horvath efec16307c [analyzer] Bug identification
This patch adds hashes to the plist and html output to be able to identfy bugs
for suppressing false positives or diff results against a baseline. This hash
aims to be resilient for code evolution and is usable to identify bugs in two
different snapshots of the same software. One missing piece however is a 
permanent unique identifier of the checker that produces the warning. Once that
issue is resolved, the hashes generated are going to change. Until that point
this feature is marked experimental, but it is suitable for early adoption.

Differential Revision: http://reviews.llvm.org/D10305 

Original patch by: Bence Babati!

llvm-svn: 251011
2015-10-22 11:53:04 +00:00
Devin Coughlin f3695c87cd [analyzer] SATestBuild.py: Move additional checkers logic so SATestAdd.py can use it as well.
Move the logic looking for additional checkers in the SA_ADDITIONAL_CHECKERS
environmental variable from SATestBuild's main() to runScanBuild(). This allows
SATestAdd.py to use the variable as well. Without it, we won't include
additional checkers when building reference results for the build bot.

Differential Revision: http://reviews.llvm.org/D12891

llvm-svn: 247767
2015-09-16 01:52:32 +00:00
Devin Coughlin bace032eb8 [analyzer] Update SATestBuild.py to set -isysroot for preprocessed files
Update the static analyzer buildbot script to set -isysroot to the OS X SDK path
when analyzing preprocessed files on OS X.

Differential Revision: http://reviews.llvm.org/D12769

llvm-svn: 247617
2015-09-14 21:22:24 +00:00
Ted Kremenek 3a0678e33c [analyzer] Apply whitespace cleanups by Honggyu Kim.
llvm-svn: 246978
2015-09-08 03:50:52 +00:00
Gabor Horvath da32a86341 [Static Analyzer] Made it easier to test new checkers using the test suite.
llvm-svn: 245637
2015-08-20 22:59:49 +00:00
Gabor Horvath c3177f2ed4 [Static Analyzer] Make the paths relative from the project root when generating reference results in the test suite.
llvm-svn: 241706
2015-07-08 18:39:31 +00:00
Gabor Horvath 2ed9456015 [Static Analyzer] No longer include the full path of the source file in the single file tests' bug identifiers.
llvm-svn: 241292
2015-07-02 19:20:46 +00:00
Gabor Horvath 93fde94d81 [Static Analyzer] Minor improvements to SATest.
Differential Revision: http://reviews.llvm.org/D10812

llvm-svn: 241073
2015-06-30 15:31:17 +00:00
Anna Zaks 8a020310b8 [analyzer] Rename NewDeleteLeaks checker in the test script.
Fixup to r220289.

llvm-svn: 220976
2014-10-31 17:40:14 +00:00
Alp Toker d473363876 Correct hyphenations in comments and assert messages
This patch tries to avoid unrelated changes other than fixing a few
hyphen-related ambiguities in nearby lines.

llvm-svn: 196466
2013-12-05 04:47:09 +00:00
Jordan Rose 7bd9186cdd [analyzer] SATestBuild: strip trailing newlines from command file.
When running a make-based command, SATestBuild tries to append a -jN flag
with an appropriate N to run the build in parallel. However, it failed
to take into account that each line read includes a trailing newline
(unless it is the last line of a file without a trailing newline), which
resulted in the "-jN" appearing on a line on its own.

llvm-svn: 190164
2013-09-06 16:12:41 +00:00
Jordan Rose c7b992edcf [analyzer] SATestBuild: Don't require reference results to have logs.
The Logs directory isn't used for testing, so it's filtered out ahead of
time. However, there's then no reason to include it in version control at
all. Don't error if it's not present.

llvm-svn: 183689
2013-06-10 19:34:30 +00:00
Anna Zaks 7b4f8a4181 [analyzer] Always use ccc-analyzer when running scan-build on buildbot
llvm-svn: 182982
2013-05-31 02:31:09 +00:00
Jordan Rose 10ad081fc6 [analyzer] Re-enable cplusplus.NewDelete (but not NewDeleteLeaks).
As mentioned in the previous commit message, the use-after-free and
double-free warnings for 'delete' are worth enabling even while the
leak warnings still have false positives.

llvm-svn: 178891
2013-04-05 17:55:07 +00:00
Anton Yartsev 01acbcebbb [analyzer] Moving cplusplus.NewDelete to alpha.* for now.
llvm-svn: 178529
2013-04-02 05:59:24 +00:00
Anton Yartsev 13df03624b [analyzer] Adds cplusplus.NewDelete checker that check for memory leaks, double free, and use-after-free problems of memory managed by new/delete.
llvm-svn: 177849
2013-03-25 01:35:45 +00:00
Jordan Rose b042cc7822 [analyzer] CmpRuns.py: Accept single files as input.
This allows us to compare two direct invocations of the analyzer on a
single source file without having to wrap the output plists in their
own directories.

llvm-svn: 177804
2013-03-23 01:21:26 +00:00
Jordan Rose b18179da33 scan-build: Add a --keep-empty option for better testing.
SATestBuild expects to compare output directories for each invocation of
scan-build that it runs, but scan-build clears out empty directories by
default. We were coincidentally not getting that behavior until r173294.

llvm-svn: 173383
2013-01-24 23:07:59 +00:00
Jordan Rose 64e4cf001b [analyzer] SATestBuild.py: allow make builds to disable parallelization
Before, SATestBuild unilaterally added '-j<n>' to every project built with
'make'. Now, we check and see if there's a -j option already specified, which
allows a project to explicitly be marked '-j1'.

llvm-svn: 168603
2012-11-26 19:59:57 +00:00
Jordan Rose 8832924acb [analyzer] SATestBuild.py: fix broken string concatenation
This has been broken for a while, but the branch was never being taken.
(We were trying to do 'str + floatVal'; now we do 'str % intVal' and use
the '%d' format.)

llvm-svn: 168174
2012-11-16 17:41:21 +00:00
Anna Zaks fab9bb6890 [analyzer] CmpRuns: move the clang_version info into the run (out of
report)

llvm-svn: 168105
2012-11-15 22:42:44 +00:00
Jordan Rose f477505d03 [analyzer] SATestBuild.py: correctly add -j option for projects using make.
llvm-svn: 168099
2012-11-15 22:03:53 +00:00
Anna Zaks 9821e57c09 [analyzer] Ensure that CmpRuns recursively walks the output directory.
llvm-svn: 167981
2012-11-14 21:32:16 +00:00
Anna Zaks 69e2bf9e0c [analyzer] Test SimpleStream on the buildbot.
llvm-svn: 167317
2012-11-02 21:30:07 +00:00
Anna Zaks 639b40484e [analyzer] CmpRuns: cleanup APIs, allow processing of plists with no
clang_version, fix the compare routine.

llvm-svn: 166129
2012-10-17 21:09:26 +00:00