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

[Build] Support to collect the test coverage in cobertura format #3019

Merged
merged 3 commits into from
Jan 23, 2024

Conversation

xumia
Copy link
Collaborator

@xumia xumia commented Jan 21, 2024

What I did

  1. Support to dump the gcda files in the each of docker-sonic-vs containers when running the tests of sonic-swss.
  2. Support to collect the coverage in the cobertura format directly from the sonic-swss build and the docker-sonic-vs containers during the component tests.
  3. Simply the logic to collect the coverage. Use the dotnet tool reportgenerator to merge all the coverage files in cobertura format.
  4. Reduce build time using the sonicbld agent pool (36 minutes -> 20 minutes), reduce test time by running the tests in parallel (8 pytest processes) and using more powerful agent pool sonic-common-test (4hours -> 1 hours).
  5. Improve the test stability, retry 3 times if failed.

Why I did it
Fix the coverage issue, some of the files are not covered in the coverage report.
Reduce the build/test time.

How I verified it
see the full coverage page in the build result.

Details if related

  1. __gcov_flush removed in GCC11, changed to use gcov_dump, see https://gcc.gnu.org/onlinedocs/gcc/Gcov-and-Optimization.html. The gcov shared library does not work as expected, changed to link the gcov ctor in the programs directly.
  2. Add the --enable-coverage option in the conftest.py to collect the coverage.
  3. Add a test utility tests/run-tests.py to run the test module with retry.
  4. Change gcovpreload.c to gcovpreload.cpp, some of the gcc options are not supported if using the suffix xxxx.c, such as -std=c++14, -Wno-reorder.

@prsunny
Copy link
Collaborator

prsunny commented Jan 23, 2024

@xumia, Could you check the coverage coverage.Azure.sonic-swss.amd64 . Seems stuck? If its not applicable, we can move it from mandatory requirement.

@xumia
Copy link
Collaborator Author

xumia commented Jan 23, 2024

@xumia, Could you check the coverage coverage.Azure.sonic-swss.amd64 . Seems stuck? If its not applicable, we can move it from mandatory requirement.

We can change the setting from coverage.Azure.sonic-swss.amd64 to coverage.Azure.sonic-swss.vstest.

@prsunny prsunny merged commit 41330ab into sonic-net:master Jan 23, 2024
14 checks passed
@xumia xumia deleted the fix-gov-cover-3-3 branch January 23, 2024 23:58
liushilongbuaa added a commit to liushilongbuaa/sonic-swss that referenced this pull request Feb 4, 2024
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