Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

makefiles/scan-build: separate scan-build-analyze and make it produce an error #10391

Merged
merged 5 commits into from
Nov 22, 2018

Conversation

cladmi
Copy link
Contributor

@cladmi cladmi commented Nov 14, 2018

Contribution description

This refactors the scan-build integration to have a separate scan-build-analyze that does not displays the webpage and make it produce an error if it find warnings when WERROR=1

It would help using it in automated testing.

There are also other refactoring inlined that I can split on request or this PR gets stuck too long:

  • Add RIOT_CI_BUILD as it is the current test configuration
  • Make the scan-build output be per board
  • cleanup

Testing procedure

I am using gnrc_networking example that, when writing the PR, still has warnings, but may change before getting merged.

scan-build-analyze

When executing scan-build-analyze no webpage is opened at the end with this PR.
It was opened in master as it was just basically a internal implementation function.

Executing the following commands fails as warnings are found

make -C examples/gnrc_networking scan-build-analyze
...
scan-build: 9 bugs found.
scan-build: Run 'scan-view /home/harter/work/git/RIOT/examples/gnrc_networking/scan-build/native/2018-11-14-142947-25380-1' to examine bug reports.
/home/harter/work/git/RIOT/makefiles/scan-build.inc.mk:83: recipe for target '..scan-build-analyze' failed
make: *** [..scan-build-analyze] Error 1
make: Leaving directory '/home/harter/work/git/RIOT/examples/gnrc_networking'

Also same behavior with docker

BUILD_IN_DOCKER=1 DOCKER="sudo docker" make -C examples/gnrc_networking scan-build-analyze

No error is produced when using WERROR=0

make -C examples/gnrc_networking scan-build-analyze WERROR=0

scan-build: 9 bugs found.
scan-build: Run 'scan-view /home/harter/work/git/RIOT/examples/gnrc_networking/scan-build/native/2018-11-14-142759-23535-1' to examine bug reports.
make: Leaving directory '/home/harter/work/git/RIOT/examples/gnrc_networking'

In master it did not return an error and always opened the webpage.

scan-build did not change

This executes scan-build and opens a webpage with the result. Even when using docker for both this PR and master

Note: there is a "Showing most recent report in your web browser... and xdg-open" that shows it is opening the result, and it should open in your browser

make -C examples/gnrc_networking scan-build
...
scan-build: 9 bugs found.
scan-build: Run 'scan-view /home/harter/work/git/RIOT/examples/gnrc_networking/scan-build/2018-11-14-142520-20167-1' to examine bug reports.
Showing most recent report in your web browser...
xdg-open /home/harter/work/git/RIOT/examples/gnrc_networking/scan-build/2018-11-14-142520-20167-1/index.html

Can also be done with docker

Issues/PRs references

Was found while trying to run scan-build during the release RIOT-OS/Release-Specs#81 (comment)

This is also required to use scan-build-analyze with RIOT-OS/Release-Specs#87 as compilation command. Or just any automated testing that would rely on it. (CI nightly?).

This is required to have reference builds context using the right
RIOT_VERSION_OVERRIDE=buildtest.
Update the SCANBUILD_OUTPUTDIR to be per board.
Also remove un-necessary export and 'CURDIR'.
This correctly defines a `scan-build-analyze` target that does not display the
result webpage.

`scan-build-view` has now been moved to a private target as should not
be used directly.

The handling of displaying the page on the host system and implementing
'scan-build-analyze' are now explicitely done with separate targets and
not double implemented target when in docker or on the host that were executed
twice with different implementations.
This makes doing 'scan-build-analyze' produce an error at execution if
WERROR=1.

When used from `scan-build` it will not procude an error to display the result
webpage.
@cladmi cladmi added Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation Area: tests Area: tests and testing framework Area: build system Area: Build system Area: toolchain Area: toolchains; everything related to compilation, libc, linking, … labels Nov 14, 2018
@cladmi cladmi added this to the Release 2019.01 milestone Nov 14, 2018
@cladmi cladmi added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Nov 16, 2018
Copy link
Contributor

@jcarrano jcarrano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code is OK and the test commands run OK.

@cladmi cladmi added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR and removed CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Nov 22, 2018
@cladmi
Copy link
Contributor Author

cladmi commented Nov 22, 2018

Re-triggering murdock, got lost in a reboot I think.

@miri64 miri64 added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR and removed CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Nov 22, 2018
@cladmi cladmi merged commit 79b0a55 into RIOT-OS:master Nov 22, 2018
@cladmi cladmi deleted the pr/make/scan_build_integration branch November 22, 2018 14:25
@cladmi
Copy link
Contributor Author

cladmi commented Nov 27, 2018

Thank for the review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: build system Area: Build system Area: tests Area: tests and testing framework Area: toolchain Area: toolchains; everything related to compilation, libc, linking, … CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants