Skip to content

Test with coverage output, publish gcov on Azure pipelines #517

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

Merged
merged 14 commits into from
Aug 20, 2021

Conversation

qiluo-msft
Copy link
Contributor

No description provided.

@qiluo-msft qiluo-msft marked this pull request as ready for review August 2, 2021 10:57
kcudnik
kcudnik previously approved these changes Aug 2, 2021
Copy link
Contributor

@kcudnik kcudnik left a comment

Choose a reason for hiding this comment

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

This seems much simpler than this preposition: https://github.com/Azure/sonic-swss/pull/1737/files
Will this change also include coverage during vstests run or this is only for local unit tests ?

@kcudnik
Copy link
Contributor

kcudnik commented Aug 3, 2021

should we consider disabling optimization when performing code coverage: https://gcc.gnu.org/onlinedocs/gcc/Gcov-and-Optimization.html

@kcudnik
Copy link
Contributor

kcudnik commented Aug 3, 2021

should we consider disabling optimization when performing code coverage: https://gcc.gnu.org/onlinedocs/gcc/Gcov-and-Optimization.html

seems like CODE_COVERAGE override that by default:
224 CODE_COVERAGE_CFLAGS = -O0 -g -fprofile-arcs -ftest-coverage
225 CODE_COVERAGE_CPPFLAGS = -DNDEBUG
226 CODE_COVERAGE_CXXFLAGS = -O0 -g -fprofile-arcs -ftest-coverage

@kcudnik
Copy link
Contributor

kcudnik commented Aug 3, 2021

@qiluo-msft in your build you get the same error:
https://dev.azure.com/mssonic/build/_build/results?buildId=26869&view=logs&j=a5b8631f-d2a8-5bf4-c5b7-ed5dd46e146c&t=93567928-e4d4-5802-f979-ee59d6645988&l=313
you need to install autoconf-archive package additionally, and also CODE_COVERAGE_CXXFLAGS even passed at last are overrided by CXXFLAGS which by default are "-g -O2" so CODE_COVERAGE_CXXFLAGS with "-O0" is ignored
command needed to compile this would be:

make CFLAGS="" CXXFLAGS=""

to disable optimization

@kcudnik
Copy link
Contributor

kcudnik commented Aug 6, 2021

maybe gcovr will need extra parameter "--exclude-throw-branches" explanation: gcovr/gcovr#283
for out current code every SWSS_LOG_ENTER() will show untaken branch (throw) that is not taken

image
this is due to compiler generating possible exception handling in the constructor and seems like gcov is catching that as branch not executed

Also for example compiling sonic-sairedis with -O0, will also need probably swss-common compiled with -O0, since there could be artefacts, for example sizeof(std::string) is different when compiled in -O2 and -O0 since it's contain more debug info and this could lead to some weird exceptions and crashes in code

correction upper claim is actually mitigated by CODE_COVERAGE_CPPFLAGS which contains "-DNDEBUG" which prevents any issues, just code is compiled with -O0 but as production and not debug code

@qiluo-msft
Copy link
Contributor Author

/azpw run

@mssonicbld
Copy link
Collaborator

/AzurePipelines run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@qiluo-msft qiluo-msft merged commit e4c3d0b into sonic-net:master Aug 20, 2021
@qiluo-msft qiluo-msft deleted the qiluo/gcov branch August 20, 2021 10:04
prgeor pushed a commit to prgeor/sonic-swss-common that referenced this pull request Feb 27, 2025
)

* Enables utility to fall back to generic info if vendor specific parser fails

* Added blank line after function end

* Changed per review
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.

3 participants