Skip to content

Commit

Permalink
Improve coverage report (#1609)
Browse files Browse the repository at this point in the history
* Improve coverage report

* Temporary skip tests failed due to dpctl

* Tuned config to exclude dpctl files from the report

* Filtered exporting coverage data by dpnp source

* Removed w/a with temporary muted tests
  • Loading branch information
antonwolfy authored Oct 30, 2023
1 parent 38b0c4f commit 5d8cf2d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
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

0 comments on commit 5d8cf2d

Please sign in to comment.