Commit Graph

81 Commits

Author SHA1 Message Date
George Karpenkov cfa1c8b413 [analyzer] [tests] Style fixes for testing harness.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@338322 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-30 23:01:20 +00:00
George Karpenkov 4084c9e303 [analyzer] [tests] Pass clang executable path to prefix-less executor scripts.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@336124 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-02 17:10:40 +00:00
George Karpenkov b87dc38b62 [analyzer] [tests] Allow the tested project to specify it's own analyzer wrapper
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@336023 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-29 22:05:32 +00:00
George Karpenkov 534c44af2b [analyzer] [tests] Fix 80 column violation in SATestBuild.py
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@336022 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-29 22:05:13 +00:00
Mikhail R. Gadelha c5df29be09 [analyzer] Fix string not being formatted with extra arguments
Signed-off-by: Mikhail Ramalho <mikhail.ramalho@gmail.com>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@335739 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-27 14:39:41 +00:00
George Karpenkov 5e73e9b775 [analyzer] [tests] Include statistics in tests.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@335685 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-26 23:17:35 +00:00
George Karpenkov d50f2dcc53 [analyzer] [testing] Be less verbose by default in integration testing.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@328752 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-29 01:23:54 +00:00
George Karpenkov a701b12944 [analyzer] [tests] Update CmpRuns to write to stdout correctly in multithreaded environment
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@325070 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-13 23:36:01 +00:00
George Karpenkov 6187d33bf2 [analyzer] [tests] Fix a typo in analyzer testing script.
Incorrect option instance construction.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@324946 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-12 22:13:01 +00:00
George Karpenkov 3cc1cf93fc [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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@324759 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-09 18:39:47 +00:00
George Karpenkov 880486c0ff [analyzer] [tests] Test different projects concurrently
Differential Revision: https://reviews.llvm.org/D43031

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@324652 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-08 21:22:42 +00:00
George Karpenkov 44c0f4cce2 [analyzer] Use stable filenames in analyzer testing infrastructure
Makes finding the right file in test results easier.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@323697 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-29 21:45:07 +00:00
George Karpenkov 13cb2b7774 [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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316948 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-30 19:40:33 +00:00
George Karpenkov b26cd8eec6 [Analyzer] [Tests] Fixing typo from the previous commit.
Can not open a non-existent file with r+.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316808 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-27 22:52:36 +00:00
George Karpenkov 0d8450b358 [Analyzer] [Tests] Dump the output of scan-build to stdout on failure.
Eliminates extra lookup step during debugging.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316806 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-27 22:39:54 +00:00
George Karpenkov bce8668f19 [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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316687 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-26 19:00:22 +00:00
George Karpenkov 9107ad9e5f [Analyzer] [Tests] Consistently use exit codes. Use code=42 to signify different results
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316632 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-26 01:13:22 +00:00
George Karpenkov d67bfb9c5a [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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316618 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-25 21:49:46 +00:00
George Karpenkov d8eca0ac08 [Analyzer] [Tests] Minor refactor of testing infrastructure:
Move utilities functions into a separate file to make comprehension
easier.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316535 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-24 23:52:48 +00:00
George Karpenkov 7ffb1b28fb [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).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316534 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-24 23:52:46 +00:00
George Karpenkov 15627d6263 [Analyzer] Fix bug in testing scripts, which always marked result as failure.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316522 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-24 22:24:13 +00:00
George Karpenkov 9197bbb6e9 [Analyzer] Remove dead code from testing scripts
Differential Revision: https://reviews.llvm.org/D38488

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@315489 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-11 18:42:39 +00:00
George Karpenkov 9f31f2539f [Analyzer Tests] Run static analyzer integration tests until the end,
Do not stop at the first failure.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@314992 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-05 17:32:06 +00:00
George Karpenkov 86395f102e [Analyzer] Make testing scripts flake8 compliant
Differential Review: https://reviews.llvm.org/D38213

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@314692 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-02 17:59:12 +00:00
George Karpenkov 1d37cb4e87 [Analyzer] Add nullability to the list of tested checkers in SATestBuild
Differential Revision: https://reviews.llvm.org/D38162

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@314572 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-30 00:05:24 +00:00
George Karpenkov 56635e1e5f [Analyzer] Fix minor errors in python scripts.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@314042 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-22 22:58:46 +00:00
George Karpenkov d578df7f78 [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
2017-09-22 01:41:16 +00:00
George Karpenkov 551a3cb90e [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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@313927 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-21 22:12:49 +00:00
Devin Coughlin bff491fabc [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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@281880 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-19 01:36:40 +00:00
Devin Coughlin 1d03689e53 [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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@258594 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-23 01:09:07 +00:00
Devin Coughlin 84b659738b [analyzer] SATestBuild.py: Handle spaces in path passed to --use-analyzer.
I missed this one in r258493.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@258517 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-22 18:45:22 +00:00
Devin Coughlin 01a74c4d2d [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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@258493 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-22 07:08:06 +00:00
Devin Coughlin 6817029164 [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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@252410 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-07 18:27:35 +00:00
Devin Coughlin 2e47fee790 [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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@247767 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-16 01:52:32 +00:00
Devin Coughlin ea63792547 [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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@247617 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-14 21:22:24 +00:00
Ted Kremenek 99bb39afb4 [analyzer] Apply whitespace cleanups by Honggyu Kim.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@246978 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-08 03:50:52 +00:00
Gabor Horvath 5b3f95829b [Static Analyzer] Made it easier to test new checkers using the test suite.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@245637 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-20 22:59:49 +00:00
Gabor Horvath 7d70c91050 [Static Analyzer] Make the paths relative from the project root when generating reference results in the test suite.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@241706 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-08 18:39:31 +00:00
Gabor Horvath cbe5bbcbf0 [Static Analyzer] No longer include the full path of the source file in the single file tests' bug identifiers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@241292 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-02 19:20:46 +00:00
Gabor Horvath 939c4bfc23 [Static Analyzer] Minor improvements to SATest.
Differential Revision: http://reviews.llvm.org/D10812


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@241073 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-30 15:31:17 +00:00
Anna Zaks 9d3048ab77 [analyzer] Rename NewDeleteLeaks checker in the test script.
Fixup to r220289.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@220976 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-31 17:40:14 +00:00
Alp Toker 2b01e1e26d 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@196466 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-05 04:47:09 +00:00
Jordan Rose 1c840db980 [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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190164 91177308-0d34-0410-b5e6-96231b3b80d8
2013-09-06 16:12:41 +00:00
Jordan Rose de5f2ee2aa [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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183689 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-10 19:34:30 +00:00
Anna Zaks e3a9baa45c [analyzer] Always use ccc-analyzer when running scan-build on buildbot
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182982 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-31 02:31:09 +00:00
Jordan Rose e449edc5bd [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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178891 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-05 17:55:07 +00:00
Anton Yartsev 3d11708c49 [analyzer] Moving cplusplus.NewDelete to alpha.* for now.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178529 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-02 05:59:24 +00:00
Anton Yartsev 2de19edab6 [analyzer] Adds cplusplus.NewDelete checker that check for memory leaks, double free, and use-after-free problems of memory managed by new/delete.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177849 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-25 01:35:45 +00:00
Jordan Rose 33e9500784 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173383 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-24 23:07:59 +00:00
Jordan Rose 7bd51ea64f [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'.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168603 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-26 19:59:57 +00:00