Skip to content

Increase coverage #518

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

Draft
wants to merge 52 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
d51431a
refactor CMake scripts: centralize target linking functionality
allnes Jul 2, 2025
b0c18d4
Merge branch 'master' of https://github.com/learning-process/parallel…
allnes Jul 2, 2025
ab3303f
Merge branch 'master' of https://github.com/learning-process/parallel…
allnes Jul 3, 2025
dcb0687
enhance performance module: improve code documentation, refactor perf…
allnes Jul 3, 2025
85390be
comment out unnecessary dependencies in ubuntu workflow
allnes Jul 3, 2025
203af69
simplify GetStringParamName implementation in performance module
allnes Jul 3, 2025
ac0be77
Merge branch 'master' into an/increase-coverage-1
allnes Jul 4, 2025
27fec47
Merge branch 'master' into an/increase-coverage-1
allnes Jul 4, 2025
fb5020f
Merge branch 'master' into an/increase-coverage-1
allnes Jul 4, 2025
8a8dc40
Merge branch 'master' of https://github.com/learning-process/parallel…
allnes Jul 5, 2025
a1e3e0e
Merge branch 'an/increase-coverage-1' of https://github.com/allnes/pa…
allnes Jul 5, 2025
dea8e28
add test isolation and extend coverage in task and performance modules
allnes Jul 5, 2025
50ec435
refactor performance tests: remove redundant whitespace and improve f…
allnes Jul 5, 2025
e632eb1
refactor performance tests: streamline includes, improve initializati…
allnes Jul 5, 2025
3882703
extend test coverage: add extensive tests for `util`, `runners`, `tas…
allnes Jul 5, 2025
691279b
update util tests: handle optional thread environment variable in Ope…
allnes Jul 5, 2025
085f6de
refactor util tests: improve naming consistency for test cases to enh…
allnes Jul 5, 2025
b69b13b
refactor task tests: improve naming consistency for test cases to enh…
allnes Jul 5, 2025
798909a
refactor task tests: improve naming consistency for TaskGetter test c…
allnes Jul 5, 2025
e472e1d
refactor runners tests: improve naming consistency for InitJSONPtr te…
allnes Jul 5, 2025
5b87e70
refactor performance tests: improve naming consistency across test ca…
allnes Jul 5, 2025
24a935a
refactor util tests: improve naming consistency for test cases and en…
allnes Jul 5, 2025
d7557cc
refactor task framework: rename and extend lifecycle handling for bet…
allnes Jul 5, 2025
167f6b1
refactor codebase: standardize comment formatting across modules for …
allnes Jul 5, 2025
990ff81
refactor static analysis workflow: adjust error message formatting fo…
allnes Jul 5, 2025
51b9f39
refactor task framework: replace `ExpectIncompleteLifecycle` with cus…
allnes Jul 5, 2025
fc89c73
refactor util tests: remove redundant OpenMP thread control checks to…
allnes Jul 5, 2025
87e8b8d
refactor task framework: adjust `ExpectIncompleteLifecycle` implement…
allnes Jul 5, 2025
09bcdab
refactor run_tests: extend functionality with `processes_coverage` mo…
allnes Jul 6, 2025
6dbf2f6
refactor github workflow: simplify code coverage tool paths for impro…
allnes Jul 6, 2025
6c4ba81
refactor github workflow: adjust coverage report path configuration f…
allnes Jul 6, 2025
bdb4ef2
refactor github workflow: dynamically detect gcov_data directories to…
allnes Jul 6, 2025
ab9d06a
refactor github workflow: simplify MPI coverage file handling by cons…
allnes Jul 6, 2025
7c666be
refactor github workflow: avoid conflicts during MPI coverage file co…
allnes Jul 6, 2025
f82ccfd
Merge branch 'master' into an/increase-coverage-1
allnes Jul 6, 2025
bcb43cb
refactor github workflow: add LLVM coverage support and update test/r…
allnes Jul 6, 2025
29da4bc
Merge remote-tracking branch 'origin/an/increase-coverage-1' into an/…
allnes Jul 6, 2025
336cf13
Merge branch 'master' into an/increase-coverage-1
allnes Jul 6, 2025
ba616e7
refactor scripts and CMake configs: improve formatting, enhance docst…
allnes Jul 6, 2025
004d097
refactor scripts: ensure files end with a newline for consistency and…
allnes Jul 6, 2025
9e56870
refactor scripts and workflow: add `PPC_DISABLE_VALGRIND` check in te…
allnes Jul 6, 2025
1c469c3
refactor GitHub workflow: enhance coverage reporting with verbosity, …
allnes Jul 6, 2025
8c74eea
refactor GitHub workflow and script: adjust LLVM coverage report path…
allnes Jul 7, 2025
932ce74
refactor script: improve LLVM coverage handling with detailed file ch…
allnes Jul 7, 2025
52402b6
refactor script: adjust formatting for consistency and clean up trail…
allnes Jul 7, 2025
8dab636
refactor tasks: remove redundant `GetInput` check in `RunImpl` for im…
allnes Jul 7, 2025
b274f4a
refactor script: enhance `.profraw` file detection to include MPI ran…
allnes Jul 7, 2025
3db4e3c
Add comprehensive tests to improve `GetNamespace` coverage
allnes Jul 7, 2025
99af464
Add extensive tests for `GetNamespace` to improve edge case coverage
allnes Jul 7, 2025
8224f84
fix: remove redundant trailing newlines in test files for consistency
allnes Jul 7, 2025
004b420
fix: update `GetNamespace` tests to handle compiler-specific behavior
allnes Jul 8, 2025
64d5430
refactor tests: enhance `GetNamespace` coverage and modernize type usage
allnes Jul 8, 2025
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
9 changes: 7 additions & 2 deletions .github/workflows/static-analysis-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ jobs:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Search for linter suppression markers
- name: Search for forbidden patterns in student tasks
run: |
export BASE_REF=${{ github.event.pull_request.base.ref }}
export CHANGED_FILES="$(git diff --name-only origin/$BASE_REF HEAD | grep '^tasks/')"
Expand All @@ -92,5 +92,10 @@ jobs:
echo "::error::Found 'IWYU pragma' in $file."
exit 1
fi
if grep -n "ExpectIncompleteLifecycle" "$file"; then
echo "::error::Found 'ExpectIncompleteLifecycle' in $file." \
"This function is for internal testing only and should not be used in student tasks."
exit 1
fi
done
echo "No linter suppression markers found in changed files."
echo "No forbidden patterns found in changed files."
62 changes: 35 additions & 27 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -331,10 +331,10 @@ jobs:
env:
PPC_NUM_PROC: 1
PPC_ASAN_RUN: 1
gcc-build-codecov:
needs:
- gcc-test-extended
- clang-test-extended
clang-build-codecov:
# needs:
# - gcc-test-extended
# - clang-test-extended
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
Expand All @@ -343,58 +343,66 @@ jobs:
- name: Setup environment
run: |
sudo apt-get update
sudo apt-get install --no-install-recommends -y \
gcc-14 g++-14 ninja-build libmpich-dev libomp-dev valgrind gcovr
sudo apt-get install --no-install-recommends -y ninja-build libmpich-dev libomp-dev valgrind python3-pip
wget https://apt.llvm.org/llvm.sh
chmod u+x llvm.sh
sudo ./llvm.sh 20 all
python3 -m pip install -r requirements.txt
- name: ccache
uses: hendrikmuhs/[email protected]
with:
key: ${{ runner.os }}-gcc
key: ${{ runner.os }}-clang-coverage
create-symlink: true
max-size: 1G
- name: CMake configure
run: >
cmake -S . -B build -G Ninja
-D CMAKE_C_COMPILER_LAUNCHER=ccache -D CMAKE_CXX_COMPILER_LAUNCHER=ccache
-D CMAKE_BUILD_TYPE=RELEASE
-D CMAKE_VERBOSE_MAKEFILE=ON -D USE_COVERAGE=ON
-D CMAKE_VERBOSE_MAKEFILE=ON -D USE_LLVM_COVERAGE=ON
env:
CC: clang-20
CXX: clang++-20
- name: Build project
run: |
cmake --build build --parallel
env:
CC: clang-20
CXX: clang++-20
- name: Run tests (MPI)
run: scripts/run_tests.py --running-type="processes"
run: scripts/run_tests.py --running-type="processes_coverage" --counts 2
env:
PPC_NUM_PROC: 2
PPC_NUM_THREADS: 2
LLVM_PROFILE_FILE: "build/llvm_profile_%p_%m.profraw"
PPC_DISABLE_VALGRIND: 1
- name: Run tests (threads)
run: scripts/run_tests.py --running-type="threads" --counts 1 2 3 4
env:
PPC_NUM_PROC: 1
- name: Generate gcovr Coverage Data
LLVM_PROFILE_FILE: "build/llvm_profile_%p_%m.profraw"
PPC_DISABLE_VALGRIND: 1
- name: Generate LLVM Coverage Data
run: |
mkdir cov-report
cd build
gcovr -r ../ \
--exclude '.*3rdparty/.*' \
--exclude '/usr/.*' \
--exclude '.*tasks/.*/tests/.*' \
--exclude '.*modules/.*/tests/.*' \
--exclude '.*tasks/common/runners/.*' \
--exclude '.*modules/runners/.*' \
--exclude '.*modules/util/include/perf_test_util.hpp' \
--exclude '.*modules/util/include/func_test_util.hpp' \
--exclude '.*modules/util/src/func_test_util.cpp' \
--xml --output ../coverage.xml \
--html=../cov-report/index.html --html-details
scripts/generate_llvm_coverage.py \
--build-dir build \
--output-dir cov-report \
--llvm-profdata llvm-profdata-20 \
--llvm-cov llvm-cov-20
# Check if files were generated
ls -la build/coverage.lcov
ls -la build/cov-report/
- name: Upload coverage reports to Codecov
uses: codecov/[email protected]
with:
files: coverage.xml
files: ./build/coverage.lcov
verbose: true
name: llvm-codecov
- name: Upload coverage report artifact
id: upload-cov
uses: actions/upload-artifact@v4
with:
name: cov-report
path: 'cov-report'
path: 'build/cov-report'
- name: Comment coverage report link
# TODO: Support PRs from forks and handle cases with insufficient write permissions
continue-on-error: true
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ include(cmake/sphinx.cmake)
add_subdirectory(docs)

if( USE_SCOREBOARD OR USE_DOCS )
return()
return()
endif()

############################ Configures #############################
Expand Down
8 changes: 7 additions & 1 deletion cmake/configure.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)

set(CMAKE_COMPILE_WARNING_AS_ERROR ON)

if(USE_COVERAGE)
if(USE_COVERAGE OR USE_LLVM_COVERAGE)
set(CMAKE_INSTALL_RPATH "${CMAKE_BINARY_DIR}/ppc_onetbb/install/lib")
else()
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
Expand Down Expand Up @@ -75,6 +75,12 @@ if(UNIX)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --coverage")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage")
endif(USE_COVERAGE)
if(USE_LLVM_COVERAGE)
set(CMAKE_C_FLAGS
"${CMAKE_C_FLAGS} -fprofile-instr-generate -fcoverage-mapping")
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} -fprofile-instr-generate -fcoverage-mapping")
endif(USE_LLVM_COVERAGE)
endif()

if(MSVC)
Expand Down
1 change: 1 addition & 0 deletions cmake/gtest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ ExternalProject_Add(
"${CMAKE_CURRENT_BINARY_DIR}/ppc_googletest/build" --prefix
"${CMAKE_CURRENT_BINARY_DIR}/ppc_googletest/install")

# Link Google Test library to target
function(ppc_link_gtest exec_func_lib)
# Add external project include directories
target_include_directories(
Expand Down
7 changes: 4 additions & 3 deletions cmake/onetbb.cmake
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
include(ExternalProject)

if(WIN32)
set(ppc_onetbb_TEST_COMMAND
set(PPC_ONETBB_TEST_COMMAND
"${CMAKE_COMMAND}" -E copy_directory
"${CMAKE_CURRENT_BINARY_DIR}/ppc_onetbb/install/bin"
"${CMAKE_RUNTIME_OUTPUT_DIRECTORY}")
else()
set(ppc_onetbb_TEST_COMMAND "")
set(PPC_ONETBB_TEST_COMMAND "")
endif()

ExternalProject_Add(
Expand All @@ -31,7 +31,7 @@ ExternalProject_Add(
INSTALL_COMMAND
"${CMAKE_COMMAND}" --install "${CMAKE_CURRENT_BINARY_DIR}/ppc_onetbb/build"
--prefix "${CMAKE_CURRENT_BINARY_DIR}/ppc_onetbb/install"
TEST_COMMAND ${ppc_onetbb_TEST_COMMAND})
TEST_COMMAND ${PPC_ONETBB_TEST_COMMAND})

install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/ppc_onetbb/install/"
DESTINATION "${CMAKE_INSTALL_PREFIX}")
Expand All @@ -43,6 +43,7 @@ else()
set(PPC_TBB_LIB_NAME tbb)
endif()

# Link TBB library to target
function(ppc_link_tbb exec_func_lib)
# Add external project include directories
target_include_directories(${exec_func_lib}
Expand Down
1 change: 1 addition & 0 deletions cmake/stb.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Link STB image library to target
function(ppc_link_stb exec_func_lib)
add_library(stb_image STATIC
${CMAKE_SOURCE_DIR}/3rdparty/stb_image_wrapper.cpp)
Expand Down
38 changes: 19 additions & 19 deletions modules/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
message(STATUS "Core components")
set(exec_func_tests "core_func_tests")
set(exec_func_lib "core_module_lib")
set(EXEC_FUNC_TESTS "core_func_tests")
set(EXEC_FUNC_LIB "core_module_lib")

subdirlist(subdirs ${CMAKE_CURRENT_SOURCE_DIR})

Expand All @@ -18,36 +18,36 @@ foreach(subd ${subdirs})
list(APPEND FUNC_TESTS_SOURCE_FILES ${TMP_FUNC_TESTS_SOURCE_FILES})
endforeach()

project(${exec_func_lib})
add_library(${exec_func_lib} STATIC ${LIB_SOURCE_FILES})
set_target_properties(${exec_func_lib} PROPERTIES LINKER_LANGUAGE CXX)
project(${EXEC_FUNC_LIB})
add_library(${EXEC_FUNC_LIB} STATIC ${LIB_SOURCE_FILES})
set_target_properties(${EXEC_FUNC_LIB} PROPERTIES LINKER_LANGUAGE CXX)

# Add include directories to target
target_include_directories(
${exec_func_lib} PUBLIC ${CMAKE_SOURCE_DIR}/3rdparty
${EXEC_FUNC_LIB} PUBLIC ${CMAKE_SOURCE_DIR}/3rdparty
${CMAKE_SOURCE_DIR}/modules ${CMAKE_SOURCE_DIR}/tasks)

ppc_link_envpp(${exec_func_lib})
ppc_link_json(${exec_func_lib})
ppc_link_gtest(${exec_func_lib})
ppc_link_threads(${exec_func_lib})
ppc_link_openmp(${exec_func_lib})
ppc_link_tbb(${exec_func_lib})
ppc_link_mpi(${exec_func_lib})
ppc_link_stb(${exec_func_lib})
ppc_link_envpp(${EXEC_FUNC_LIB})
ppc_link_json(${EXEC_FUNC_LIB})
ppc_link_gtest(${EXEC_FUNC_LIB})
ppc_link_threads(${EXEC_FUNC_LIB})
ppc_link_openmp(${EXEC_FUNC_LIB})
ppc_link_tbb(${EXEC_FUNC_LIB})
ppc_link_mpi(${EXEC_FUNC_LIB})
ppc_link_stb(${EXEC_FUNC_LIB})

add_executable(${exec_func_tests} ${FUNC_TESTS_SOURCE_FILES})
add_executable(${EXEC_FUNC_TESTS} ${FUNC_TESTS_SOURCE_FILES})

target_link_libraries(${exec_func_tests} PUBLIC ${exec_func_lib})
target_link_libraries(${EXEC_FUNC_TESTS} PUBLIC ${EXEC_FUNC_LIB})

enable_testing()
add_test(NAME ${exec_func_tests} COMMAND ${exec_func_tests})
add_test(NAME ${EXEC_FUNC_TESTS} COMMAND ${EXEC_FUNC_TESTS})

# Installation rules
install(
TARGETS ${exec_func_lib}
TARGETS ${EXEC_FUNC_LIB}
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin)

install(TARGETS ${exec_func_tests} RUNTIME DESTINATION bin)
install(TARGETS ${EXEC_FUNC_TESTS} RUNTIME DESTINATION bin)
Loading
Loading