diff --git a/projects/rocprofiler-compute/.github/workflows/mi100.yml b/projects/rocprofiler-compute/.github/workflows/mi100.yml new file mode 100644 index 0000000000..e822298813 --- /dev/null +++ b/projects/rocprofiler-compute/.github/workflows/mi100.yml @@ -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/ diff --git a/projects/rocprofiler-compute/CMakeLists.txt b/projects/rocprofiler-compute/CMakeLists.txt index 7306a01d1e..f378374521 100644 --- a/projects/rocprofiler-compute/CMakeLists.txt +++ b/projects/rocprofiler-compute/CMakeLists.txt @@ -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 diff --git a/projects/rocprofiler-compute/pyproject.toml b/projects/rocprofiler-compute/pyproject.toml index 933c110895..a41fe32504 100644 --- a/projects/rocprofiler-compute/pyproject.toml +++ b/projects/rocprofiler-compute/pyproject.toml @@ -24,9 +24,8 @@ exclude = ''' [tool.pytest.ini_options] addopts = [ "--import-mode=importlib", - "--cov=src", - ] + pythonpath = [ ".", "src",