This project illustrates a base structure of projects which we can easily write, test, run, watch code coverage and checks UB (using ASAN/UBSAN
).
It used to copy it as is
to save my time when creating new projects.
skeleton
- main executable target, links with thecommon
,dataapi
and uses its functionalitydataapi
- contains functionality of the projectdataapitests
- tests written using gtest library, testsdataapi
andcommon
common
- static library containing common helpful functionality shared between all other targetsdataapi_sanitized
- sanitized version of library, used to linking withdataapitests_sanitized
common_sanitized
- sanitized version of library, used to linking withdataapitests_sanitized
dataapitests_sanitized
- sanitized version of test cases, used to checkUB
in codecoverage
- runs test cases and checks code coverage (also createshtml
file with information about covered and non covered code regions)test
- runs test casespackage
- createsrpm
package
cmake -B build
orcmake -B build -DBUILD_TESTS=ON
if we want to build tests
cmake --build build -j16
- just to build all targetscmake --build build -j16 --target test
- builds and runs all test cases (will work if we generated project withBUILD_TESTS=ON
key)cmake --build build -j16 --target coverage
- builds and runs all test cases, then shows us up a table with code coverage (also you can open./build/dataapitests/coverate.html
to watch which regions of code your test cases covered)cmake --build build -j16 --target dataapitests_sanitized
- builds and runs all test cases with sanitizers (ASAN/UBSAN
)cmake --build build -j16 --target package
- createsRPM
package