Skip to content

Improve coverage report #1609

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 5 commits into from
Oct 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/generate_coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,26 +39,32 @@ jobs:
- name: Install Lcov
run: |
sudo apt-get install lcov

- name: Install dpnp dependencies
run: |
conda install cython llvm cmake">=3.21" scikit-build ninja pytest pytest-cov coverage[toml] \
dpctl dpcpp_linux-64 sysroot_linux-64">=2.28" mkl-devel-dpcpp tbb-devel onedpl-devel ${{ env.CHANNELS }}

- name: Conda info
run: |
conda info
conda list

- name: Build dpnp with coverage
run: |
python scripts/gen_coverage.py --pytest-opts="--ignore tests/test_random.py"

- name: Install coverall dependencies
run: |
sudo gem install coveralls-lcov
pip install coveralls==3.2.0

- name: Upload coverage data to coveralls.io
run: |
echo "Processing pytest-coverage"
export DPNP_PYTEST_LCOV=$(find . -name dpnp_pytest.lcov)
coveralls-lcov -v -n $DPNP_PYTEST_LCOV > pytest-dpnp-c-api-coverage.json

# merge file with coverage data and upload
echo "Merging files with coverage data"
coveralls --service=github --merge=pytest-dpnp-c-api-coverage.json
Expand Down
1 change: 1 addition & 0 deletions dpnp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ function(build_dpnp_cython_ext _trgt _src _dest)
add_dependencies(${_trgt} ${_trgt_deps})
if (DPNP_GENERATE_COVERAGE)
target_compile_definitions(${_trgt} PRIVATE CYTHON_TRACE=1 CYTHON_TRACE_NOGIL=1)
target_compile_options(${_trgt} PRIVATE "-fno-sycl-use-footer")
endif()
target_compile_definitions(${_trgt} PRIVATE NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION)
# NumPy
Expand Down
15 changes: 10 additions & 5 deletions scripts/gen_coverage.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,14 @@ def find_objects():
objects = []
dpnp_path = os.getcwd()
search_path = os.path.join(dpnp_path, "dpnp")
files = os.listdir(search_path)
for file in files:
if file.endswith("_c.so"):
objects.extend(["-object", os.path.join(search_path, file)])
for root, _, files in os.walk(search_path):
for file in files:
if (
file.endswith("_c.so")
or root.find("extensions") != -1
and file.find("_impl.cpython") != -1
):
objects.extend(["-object", os.path.join(root, file)])
return objects

objects = find_objects()
Expand All @@ -112,7 +116,8 @@ def find_objects():
"-ignore-filename-regex=/tmp/icpx*",
"-instr-profile=" + instr_profile_fn,
]
+ objects,
+ objects
+ ["-sources", "dpnp"],
stdout=fh,
)

Expand Down