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

Coverity workflow fail if issue exist #292

Merged
merged 1 commit into from
Jul 21, 2023
Merged

Conversation

tylerzhao7684
Copy link
Contributor

@tylerzhao7684 tylerzhao7684 commented May 10, 2023

Automating checking that a PR should not have a coverity issue

@tylerzhao7684
Copy link
Contributor Author

This workflow now works as follows:

  • If a file change in this PR introduces a Coverity issue & that file originally does not have any Coverity issues, then this workflow would fail, to notify that there are Coverity issues
  • If a file change in this PR edits a file that currently has Coverity issues (Not introduced by the current PR), then this workflow would fail. Error message would tell users to review Coverity issues manually and add a coverity-override tag to this PR when it is confirmed that the current PR does not introduce and new Coverity issues
  • If coverity-override tag is added to the PR, then Coverity workflow is skipped

The reason why we cannot easily detect if the current PR introduces new Coverity issues when it modified an existing file that has Coverity issues, is because we only knows the Coverity issue by examining the output of cov-format-errors --text-output-style multiline --dir results --filesort --file "$(realpath ..)" --strip-path "$(realpath ..)" (i.e. cov-error-base.txt or cov-error.txt). A simple diff is unable to catch if a new Coverity issue is introduced because line number where the Coverity issues are located could be different

@tylerzhao7684
Copy link
Contributor Author

Successful Coverity workflow run when there is no Coverity Issues

@tylerzhao7684
Copy link
Contributor Author

This workflow is failing because it found a Coverity issue due to this change

@tylerzhao7684
Copy link
Contributor Author

The key reason why there are 2 builds in the coverity-pull-request workflow is because it "ignores" the existing coverity case if you don't edit the same file where there is an existing coverity case. It will be ignored because that case will show up in both cov-errors.txt and cov-errors-base.txt, and it will be ignored when we diff the two files.

The only case we need the coverity-override label is when we actually edit the file that has an existing coverity case in this PR. When that happens, the diffing is unable to ignore that error because line numbers have changed in the cov-errors.txt.

zibaiwan
zibaiwan previously approved these changes Jul 20, 2023
Copy link
Contributor

@zibaiwan zibaiwan left a comment

Choose a reason for hiding this comment

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

Hi Tyler, it looks good to me! Please squash the commit and I will merge.

@zibaiwan
Copy link
Contributor

Hi Tyler, can you please correct the commit message? Thanks

@tylerzhao7684
Copy link
Contributor Author

Hi Tyler, can you please correct the commit message? Thanks

Updated

@zibaiwan
Copy link
Contributor

Thanks Tyler!

@zibaiwan zibaiwan merged commit a22ae0c into intel:main Jul 21, 2023
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants