From 5d8cf2daa131e7694fab9ad751c47418ef91a430 Mon Sep 17 00:00:00 2001 From: Anton <100830759+antonwolfy@users.noreply.github.com> Date: Mon, 30 Oct 2023 13:08:00 +0100 Subject: [PATCH] Improve coverage report (#1609) * 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 --- .github/workflows/generate_coverage.yaml | 6 ++++++ dpnp/CMakeLists.txt | 1 + scripts/gen_coverage.py | 15 ++++++++++----- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/.github/workflows/generate_coverage.yaml b/.github/workflows/generate_coverage.yaml index 776e521f66e..668b69e1fb5 100644 --- a/.github/workflows/generate_coverage.yaml +++ b/.github/workflows/generate_coverage.yaml @@ -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 diff --git a/dpnp/CMakeLists.txt b/dpnp/CMakeLists.txt index df4971cfa38..d64ab73fb18 100644 --- a/dpnp/CMakeLists.txt +++ b/dpnp/CMakeLists.txt @@ -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 diff --git a/scripts/gen_coverage.py b/scripts/gen_coverage.py index cdb6188d2a7..5af2ccb3fc6 100644 --- a/scripts/gen_coverage.py +++ b/scripts/gen_coverage.py @@ -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() @@ -112,7 +116,8 @@ def find_objects(): "-ignore-filename-regex=/tmp/icpx*", "-instr-profile=" + instr_profile_fn, ] - + objects, + + objects + + ["-sources", "dpnp"], stdout=fh, )