Introduce a cmake option to enable python code coverage. It now
defaults to being disabled and can be enabled via a
-DENABLE_COVERAGE=ON option (#194). Introduce CI on mi100 that
leverages code coverage and publishes results along with a testing
report.
Signed-off-by: Karl W Schulz <karl.schulz@amd.com>
[ROCm/rocprofiler-compute commit: a39514f02f]
This commit is contained in:
committed by
Karl W. Schulz
parent
ef5c3cf780
commit
37382bf95f
@@ -0,0 +1,51 @@
|
||||
name: mi100
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- 'ci'
|
||||
|
||||
# Allows manual execution
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
checks: write
|
||||
pull-requests: write
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: [mi100, rhel9]
|
||||
env:
|
||||
TEST_DIR: ${RUNNER_TEMP}/omniperf
|
||||
PYTHONPATH: /share/sw/omniperf/python-libs
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: recursive
|
||||
token: ${{ secrets.GH_PAT }}
|
||||
- name: Configure
|
||||
run: |
|
||||
mkdir build
|
||||
cd build
|
||||
ml cmake
|
||||
cmake -DENABLE_COVERAGE=ON ..
|
||||
- name: Install Python testing collateral
|
||||
run: pip3 install pytest pytest-cov mock
|
||||
- name: Run [profile] mode
|
||||
run: |
|
||||
cd build
|
||||
ml cmake
|
||||
ctest --verbose -R test_profiler_execution
|
||||
- name: Run [analyze] mode
|
||||
run: |
|
||||
cd build
|
||||
ml cmake
|
||||
srun -N 1 -J omniperf -p ci -t 00:25:00 ctest --verbose -R test_analyze_commands
|
||||
- name: Pytest coverage comment
|
||||
uses: MishaKav/pytest-coverage-comment@v1.1.48
|
||||
with:
|
||||
pytest-xml-coverage-path: 'tests/coverage.xml'
|
||||
junitxml-path: 'tests/test-results.xml'
|
||||
coverage-path-prefix: src/
|
||||
@@ -172,24 +172,30 @@ if(${GIT_CLONE})
|
||||
${PROJECT_SOURCE_DIR}/VERSION.sha @ONLY)
|
||||
endif()
|
||||
|
||||
# Setup testing collateral
|
||||
enable_testing()
|
||||
|
||||
option(ENABLE_COVERAGE "Enable code coverage" OFF)
|
||||
set(COV_OPTION "")
|
||||
if(${ENABLE_COVERAGE})
|
||||
set(COV_OPTION "--cov=src" "--junitxml=tests/test-results.xml" "--cov-append"
|
||||
"--cov-report=term-missing" "--cov-report=xml:tests/coverage.xml")
|
||||
endif()
|
||||
message(STATUS "Code coverage: ${ENABLE_COVERAGE}")
|
||||
|
||||
add_test(
|
||||
NAME test_analyze_commands
|
||||
COMMAND ${Python3_EXECUTABLE} -m pytest
|
||||
${PROJECT_SOURCE_DIR}/tests/test_analyze_commands.py
|
||||
COMMAND pytest ${COV_OPTION} ${PROJECT_SOURCE_DIR}/tests/test_analyze_commands.py
|
||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
|
||||
|
||||
add_test(
|
||||
NAME test_analyze_workloads
|
||||
COMMAND ${Python3_EXECUTABLE} -m pytest
|
||||
${PROJECT_SOURCE_DIR}/tests/test_analyze_workloads.py
|
||||
COMMAND pytest ${COV_OPTION} ${PROJECT_SOURCE_DIR}/tests/test_analyze_workloads.py
|
||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
|
||||
|
||||
add_test(
|
||||
NAME test_saved_analysis
|
||||
COMMAND ${Python3_EXECUTABLE} -m pytest
|
||||
${PROJECT_SOURCE_DIR}/tests/test_saved_analysis.py
|
||||
COMMAND pytest ${COV_OPTION} ${PROJECT_SOURCE_DIR}/tests/test_saved_analysis.py
|
||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
|
||||
|
||||
# if(EXISTS ${PROJECT_SOURCE_DIR}/src/mibench/roofline/roofline.cpp) message(STATUS
|
||||
|
||||
@@ -24,9 +24,8 @@ exclude = '''
|
||||
[tool.pytest.ini_options]
|
||||
addopts = [
|
||||
"--import-mode=importlib",
|
||||
"--cov=src",
|
||||
|
||||
]
|
||||
|
||||
pythonpath = [
|
||||
".",
|
||||
"src",
|
||||
|
||||
Reference in New Issue
Block a user