This is an archive of the discontinued LLVM Phabricator instance.

[analyzer] Update SATestBuild.py to enable a 'download and patch' model for projects.
ClosedPublic

Authored by dcoughlin on Nov 4 2015, 11:34 AM.

Details

Summary

Currently the SATestBuild.py and SATestAdd.py buildbot scripts expect project
sources to be checked into the project repository. This patch 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 patch 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.

Diff Detail

Repository
rL LLVM

Event Timeline

dcoughlin updated this revision to Diff 39229.Nov 4 2015, 11:34 AM
dcoughlin retitled this revision from to [analyzer] Update SATestBuild.py to enable a 'download and patch' model for projects. .
dcoughlin updated this object.
dcoughlin added reviewers: zaks.anna, krememek.
dcoughlin updated this object.
dcoughlin added a subscriber: cfe-commits.

Hi!

I think it is great to support this model in these scripts. Do you plan to check the list of the project urls in to the repository as well? I think it would be great to do so, so one can easily reproduce a buildbot error locally, or even run the whole testsuit. It also makes it easier to setup alternative build bots and to contribute projects to the official one.

What do you think?

I have one minor high level note about the handling of patches. I think it in case a project would need more modifications, it is cleaner to have a separate patch file for each kind of them. Maybe it would be worth to support patching the project with multiple patches? E.g. applying all patches with a name prefix.

Hi!

I think it is great to support this model in these scripts. Do you plan to check the list of the project urls in to the repository as well?

The project URLs are implicitly included in the download script (which is checked into the repository). So, for example, here is a sample script to download the OmniGroup project from github:

curl -L -O https://github.com/omnigroup/OmniGroup/archive/c9074bc24c46516687acf44824ad8b00c2146ad6.zip
unzip c9074bc24c46516687acf44824ad8b00c2146ad6.zip
mv OmniGroup-c9074bc24c46516687acf44824ad8b00c2146ad6 CachedSource

I have one minor high level note about the handling of patches. I think it in case a project would need more modifications, it is cleaner to have a separate patch file for each kind of them. Maybe it would be worth to support patching the project with multiple patches? E.g. applying all patches with a name prefix.

I originally did it this way but I found that became cumbersome. In order to fix an issue I had to copy the original pristine source, apply all previous patches to that copy, then copy the patched tree, then fix the issue in the second copy and the diff first copy with the second to generate the incremental patch.

With the single-patch approach the workflow is: copy the pristine source, apply the patch to the copy, fix the issue in the copy, and diff the pristine and the (now fixed) copy.

Since these patches are checked into the repo, they can always be differed with older versions of the patch to see what has changed.

This revision was automatically updated to reflect the committed changes.