Skip to content

Commit

Permalink
Code Coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
szmyd committed Jun 19, 2023
1 parent 37710bf commit 62494cd
Show file tree
Hide file tree
Showing 7 changed files with 73 additions and 30 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/build_commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ jobs:
build-type: ${{ inputs.build-type }}
malloc-impl: ${{ inputs.malloc-impl }}
prerelease: ${{ inputs.prerelease }}
if: ${{ github.event_name != 'pull_request' }}
IOMgrDeps:
needs: SislDeps
uses: eBay/iomanager/.github/workflows/build_dependencies.yml@master
Expand All @@ -34,6 +35,7 @@ jobs:
build-type: ${{ inputs.build-type }}
malloc-impl: ${{ inputs.malloc-impl }}
prerelease: ${{ inputs.prerelease }}
if: ${{ github.event_name != 'pull_request' }}
HomestoreDeps:
needs: IOMgrDeps
uses: ./.github/workflows/build_dependencies.yml
Expand All @@ -44,3 +46,14 @@ jobs:
malloc-impl: ${{ inputs.malloc-impl }}
prerelease: ${{ inputs.prerelease }}
testing: 'True'
if: ${{ github.event_name != 'pull_request' }}
HomestoreBuild:
uses: ./.github/workflows/build_dependencies.yml
with:
branch: ${{ github.ref }}
platform: ${{ inputs.platform }}
build-type: ${{ inputs.build-type }}
malloc-impl: ${{ inputs.malloc-impl }}
prerelease: ${{ inputs.prerelease }}
testing: 'True'
if: ${{ github.event_name == 'pull_request' }}
41 changes: 33 additions & 8 deletions .github/workflows/build_dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ jobs:
python -m pip install --upgrade pip
python -m pip install pyelftools
python -m pip install conan~=1.0
python -m pip install gcovr
conan user
conan profile new --detect default
conan export deps/iomgr oss/master
Expand Down Expand Up @@ -220,12 +221,36 @@ jobs:

- name: Create and test Package
run: |
conan create \
-o sisl:prerelease=${{ inputs.prerelease }} \
-o sisl:malloc_impl=${{ inputs.malloc-impl }} \
-o sisl:testing=False \
-o iomgr:testing=off \
-s build_type=${{ inputs.build-type }} \
--build missing \
deps/homestore
if [[ "${{ inputs.platform }}" == "ubuntu-22.04" && \
"${{ inputs.build-type }}" == "Debug" && \
"${{ inputs.malloc-impl }}" == "libc" && \
"${{ inputs.prerelease }}" == "False" ]]; then
conan install \
-o sisl:prerelease=${{ inputs.prerelease }} \
-o sisl:malloc_impl=${{ inputs.malloc-impl }} \
-o sisl:testing=False \
-o iomgr:testing=off \
-o coverage=True \
-s build_type=${{ inputs.build-type }} \
--build missing \
deps/homestore
conan build deps/homestore
else
sanitize=$([[ "${{ inputs.build-type }}" == "Debug" && "${{ inputs.malloc-impl }}" == "libc" && "${{ inputs.prerelease }}" == "True" ]] && echo "True" || echo "False")
conan create \
-o sisl:prerelease=${{ inputs.prerelease }} \
-o sisl:malloc_impl=${{ inputs.malloc-impl }} \
-o sisl:testing=False \
-o iomgr:testing=off \
-o homestore:sanitize=${sanitize} \
-s build_type=${{ inputs.build-type }} \
--build missing \
deps/homestore
fi
if: ${{ inputs.testing == 'True' }}

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
gcov: true
6 changes: 4 additions & 2 deletions .github/workflows/merge_conan_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ jobs:
exclude:
- build-type: Debug
platform: ubuntu-20.04
- build-type: Debug
malloc-impl: tcmalloc
- malloc-impl: tcmalloc
platform: ubuntu-20.04
- malloc-impl: jemalloc
Expand All @@ -29,8 +31,8 @@ jobs:
- malloc-impl: libc
build-type: Release
platform: ubuntu-22.04
- prerelease: "False"
build-type: Debug
- prerelease: "True"
platform: ubuntu-20.04
uses: ./.github/workflows/build_commit.yml
with:
platform: ${{ matrix.platform }}
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/pr_conan_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ jobs:
exclude:
- build-type: Debug
platform: ubuntu-20.04
- build-type: Debug
malloc-impl: tcmalloc
- malloc-impl: tcmalloc
platform: ubuntu-20.04
- malloc-impl: jemalloc
Expand All @@ -28,8 +30,8 @@ jobs:
- malloc-impl: libc
build-type: Release
platform: ubuntu-22.04
- prerelease: "False"
build-type: Debug
- prerelease: "True"
platform: ubuntu-20.04
uses: ./.github/workflows/build_commit.yml
with:
platform: ${{ matrix.platform }}
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# HomeStore
[![Conan Build](https://github.com/eBay/HomeStore/actions/workflows/merge_conan_build.yml/badge.svg?branch=master)](https://github.com/eBay/HomeStore/actions/workflows/merge_conan_build.yml)
[![CodeCov](https://codecov.io/gh/eBay/homestore/branch/master/graph/badge.svg)](https://codecov.io/gh/eBay/homestore)

Homestore is a generic storage engine upon which different storage solutions, like block store, key/value stores, object stores, databases can be built. This storage engine architecture is tuned towards modern storage devices and systems programming to provide ultra high performance. It has a pluggable model throughout to make it easy to extend the functionality to tune to specific use cases or data patterns. This document tries to explain what is the motivation to create another storage engine among an already impressive array of engines.

Expand Down
10 changes: 6 additions & 4 deletions cmake/debug_flags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,11 @@ set (REALLY_NO_OPTIMIZATION_FLAGS "${REALLY_NO_OPTIMIZATION_FLAGS} -fno-web"
set (REALLY_NO_OPTIMIZATION_FLAGS "${REALLY_NO_OPTIMIZATION_FLAGS} -fno-tree-slp-vectorize" )# E&C.
set (REALLY_NO_OPTIMIZATION_FLAGS "${REALLY_NO_OPTIMIZATION_FLAGS} -fthreadsafe-statics" )# Slightly smaller in code that doesn't need to be TS.

if ("${TEST_TARGET}" STREQUAL "coverage")
include (cmake/CodeCoverage.cmake)
APPEND_COVERAGE_COMPILER_FLAGS()
SETUP_TARGET_FOR_COVERAGE_GCOVR_XML(NAME coverage EXECUTABLE ctest DEPENDENCIES )
if (DEFINED CONAN_BUILD_COVERAGE)
if (${CONAN_BUILD_COVERAGE})
include (cmake/CodeCoverage.cmake)
APPEND_COVERAGE_COMPILER_FLAGS()
SETUP_TARGET_FOR_COVERAGE_GCOVR_XML(NAME coverage EXECUTABLE ctest DEPENDENCIES )
endif ()
endif ()
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${REALLY_NO_OPTIMIZATION_FLAGS}")
26 changes: 12 additions & 14 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@ class HomestoreConan(ConanFile):
options = {
"shared": ['True', 'False'],
"fPIC": ['True', 'False'],
"coverage": ['True', 'False'],
"sanitize": ['True', 'False'],
"testing" : ['coverage', 'full', 'min', 'off', 'epoll_mode', 'spdk_mode'],
"testing" : ['full', 'min', 'off', 'epoll_mode', 'spdk_mode'],
"skip_testing": ['True', 'False'],
}
default_options = {
'shared': False,
'fPIC': True,
'coverage': False,
'sanitize': False,
'testing': 'epoll_mode',
'skip_testing': False,
Expand All @@ -40,10 +42,12 @@ def configure(self):
if self.options.shared:
del self.options.fPIC
if self.settings.build_type == "Debug":
if self.options.coverage and self.options.sanitize:
raise ConanInvalidConfiguration("Sanitizer does not work with Code Coverage!")
if self.options.sanitize:
self.options['sisl'].sanitize = True
else:
self.options.sanitize = False
self.options['sisl'].malloc_impl = 'libc'
elif self.options.coverage:
self.options.testing = 'min'

def imports(self):
self.copy(root_package="sisl", pattern="*", dst="bin/scripts/python/flip/", src="bindings/flip/python/", keep_path=False)
Expand Down Expand Up @@ -72,16 +76,12 @@ def build(self):
'MEMORY_SANITIZER_ON': 'OFF'}
test_target = None

if self.options.sanitize:
definitions['MEMORY_SANITIZER_ON'] = 'ON'

definitions['TEST_TARGET'] = self.options.testing
if self.options.testing == 'coverage':
test_target = 'coverage'

if self.settings.build_type == 'Debug':
definitions['CMAKE_BUILD_TYPE'] = 'Debug'

if self.options.sanitize:
definitions['MEMORY_SANITIZER_ON'] = 'ON'
elif self.options.coverage:
definitions['CONAN_BUILD_COVERAGE'] = 'ON'
cmake.configure(defs=definitions)
cmake.build()
if not self.options.testing == 'off' and not self.options.skip_testing:
Expand All @@ -104,7 +104,5 @@ def package_info(self):
self.cpp_info.exelinkflags.append("-fsanitize=address")
self.cpp_info.sharedlinkflags.append("-fsanitize=undefined")
self.cpp_info.exelinkflags.append("-fsanitize=undefined")
elif self.options.testing == 'coverage':
self.cpp_info.system_libs.append('gcov')
if self.settings.os == "Linux":
self.cpp_info.system_libs.append("aio")

0 comments on commit 62494cd

Please sign in to comment.