Skip to content
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

ci: re-enable coverage tests #313

Merged
merged 11 commits into from
Dec 12, 2024
57 changes: 29 additions & 28 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ jobs:
-Dtest_data_file=$(pwd)/test_data.hipo \
-Dtest_num_events=${{ env.num_events }} \
-Dtest_output_dir=$(pwd)/validation_results \
-Dtest_multithreading=${{ env.num_threads }} \
-Dtest_num_threads=${{ env.num_threads }} \
${{ matrix.opts }}
- name: dump all build options
run: meson configure iguana_build --no-pager
Expand All @@ -413,6 +413,7 @@ jobs:
- run: tree iguana
### run tests
- name: meson test
if: ${{ matrix.id != 'documentation' }}
working-directory: iguana_build
run: |
if [ "${{ env.verbose_test }}" = "true" ]; then
Expand All @@ -423,26 +424,26 @@ jobs:
fi
### run benchmarks
- name: benchmark algorithms
if: ${{ matrix.id == 'coverage' }} # use the coverage job's GITHUB_STEP_SUMMARY
if: ${{ matrix.id == 'cpp' && inputs.id == 'linux-latest' }}
run: |
for suite in single_threaded memoize; do
meson test --benchmark --suite $suite -C iguana_build | tee benchmark_$suite.txt
done
iguana_src/.github/make-benchmark-table.rb benchmark_{single_threaded,memoize}.txt | xargs -0 -I{} echo {} >> $GITHUB_STEP_SUMMARY
### coverage
# - name: coverage
# if: ${{ matrix.id == 'coverage' }}
# run: |
# ninja -C iguana_build coverage-html
# ninja -C iguana_build coverage-text
# mv iguana_build/meson-logs/coveragereport coverage-report
# echo '### Coverage Report' >> $GITHUB_STEP_SUMMARY
# echo '```' >> $GITHUB_STEP_SUMMARY
# cat iguana_build/meson-logs/coverage.txt >> $GITHUB_STEP_SUMMARY
# echo '```' >> $GITHUB_STEP_SUMMARY
# echo '' >> $GITHUB_STEP_SUMMARY
# echo '- for details, see the `coverage-report` artifact' >> $GITHUB_STEP_SUMMARY
# echo '- to compare to the report from the `main` branch, see <https://jeffersonlab.github.io/iguana/coverage-report>' >> $GITHUB_STEP_SUMMARY
- name: coverage
if: ${{ matrix.id == 'coverage' }}
run: |
ninja -C iguana_build coverage-html
ninja -C iguana_build coverage-text
mv iguana_build/meson-logs/coveragereport coverage-report
echo '### Coverage Report' >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
cat iguana_build/meson-logs/coverage.txt >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
echo '' >> $GITHUB_STEP_SUMMARY
echo '- for details, see the `coverage-report` artifact' >> $GITHUB_STEP_SUMMARY
echo '- to compare to the report from the `main` branch, see <https://jeffersonlab.github.io/iguana/coverage-report>' >> $GITHUB_STEP_SUMMARY
### test relocatability
- name: test relocatability
if: ${{ matrix.id == 'cpp' }} # don't bother re-running santizers, etc.
Expand Down Expand Up @@ -511,13 +512,13 @@ jobs:
name: meson_logs_${{ matrix.id }}
retention-days: 5
path: iguana_build/meson-logs
# - name: upload coverage artifacts
# uses: actions/upload-artifact@v4
# if: ${{ matrix.id == 'coverage' }}
# with:
# name: coverage-report
# retention-days: 5
# path: coverage-report
- name: upload coverage artifacts
uses: actions/upload-artifact@v4
if: ${{ matrix.id == 'coverage' }}
with:
name: coverage-report
retention-days: 5
path: coverage-report
- name: upload validator artifacts
uses: actions/upload-artifact@v4
if: ${{ matrix.id == 'cpp' }}
Expand Down Expand Up @@ -551,18 +552,18 @@ jobs:
with:
name: doc_doxygen
path: doxygen
# - name: download coverage report
# uses: actions/download-artifact@v4
# with:
# name: coverage-report
# path: coverage-report
- name: download coverage report
uses: actions/download-artifact@v4
with:
name: coverage-report
path: coverage-report
- run: tree
- name: collect
run: |
mkdir pages
cp iguana_src/.github/pages-index.html pages/index.html
mv doxygen pages/
# - run: mv coverage-report pages/
- run: mv coverage-report pages/
- run: tree
- uses: actions/upload-pages-artifact@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
],
"include": [
{ "id": "cpp", "CC": "gcc", "CXX": "g++", "opts": "-Dbuildtype=release -Dz_require_root=true -Dtest_validator_all_stats=true" },
{ "id": "coverage", "CC": "gcc", "CXX": "g++", "opts": "-Dbuildtype=release -Dz_require_root=true -Db_coverage=true" },
{ "id": "coverage", "CC": "gcc", "CXX": "g++", "opts": "-Dbuildtype=release -Dz_require_root=true -Db_coverage=true -Dz_test_multithreading=false" },
{ "id": "documentation", "CC": "gcc", "CXX": "g++", "opts": "-Dbuildtype=release -Dz_require_root=true -Dinstall_documentation=true" },
{ "id": "address-sanitizer", "CC": "clang", "CXX": "clang++", "opts": "-Dbuildtype=debug -Dz_require_root=true -Db_sanitize=address -Db_lundef=false -Db_pie=true" },
{ "id": "thread-sanitizer", "CC": "clang", "CXX": "clang++", "opts": "-Dbuildtype=debug -Dz_require_root=true -Db_sanitize=thread -Db_lundef=false -Db_pie=true" },
Expand Down
3 changes: 2 additions & 1 deletion meson.options
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ option('test_data_file', type: 'string', value: '', description: '
option('test_num_events', type: 'string', value: '10', description: 'Number of events from `test_data_file` to test')
option('test_output_dir', type: 'string', value: '', description: 'Output directory for tests. Must be an absolute path. If unspecified, tests will still run, but will not produce output files.')
option('test_validator_all_stats', type: 'boolean', value: false, description: 'If true, use all statistics for validators, rather than `test_num_events`')
option('test_multithreading', type: 'integer', value: 4, min: 0, description: 'run multithreading tests with this many threads (use 0 for hardware max)')
option('test_num_threads', type: 'integer', value: 4, min: 0, description: 'run multithreading tests with this many threads (use 0 for hardware max)')

# expert options: the defaults should be reasonable for a local installation; different values may be preferred for installation in common areas
option('z_install_envfile', type: 'boolean', value: true, description: 'Install a sourceable environment variable file')
option('z_require_root', type: 'boolean', value: false, description: 'Fail if ROOT is not found')
option('z_require_rcdb', type: 'boolean', value: false, description: 'Fail if RCDB is not found')
option('z_test_multithreading', type: 'boolean', value: true, description: 'Enable multithreading tests')
52 changes: 27 additions & 25 deletions src/iguana/tests/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -57,31 +57,33 @@ foreach algo : algo_dict
)

# multithreaded tests
foreach concurrency_model : [ 'memoize' ] # note: we used to have more, so leave this array in case we want more
multithreading_args = [
'multithreading',
'-j', get_option('test_multithreading').to_string(),
'-m', concurrency_model,
'-V', # vary run number
]
test(
'-'.join(['multithreading', concurrency_model, test_name_algo]),
test_exe,
suite: [ 'algorithm', 'multithreading', concurrency_model ],
args: multithreading_args + [ '-n', get_option('test_num_events') ] + test_args,
is_parallel: false,
env: project_test_env,
timeout: 0,
)
benchmark(
'-'.join(['benchmark', f'multithreading_@concurrency_model@', test_name_algo]),
test_exe,
suite: [ 'algorithm', 'multithreading', concurrency_model ],
args: multithreading_args + [ '-n', '0' ] + test_args, # benchmark all the events
env: project_test_env,
timeout: 0,
)
endforeach
if get_option('z_test_multithreading')
foreach concurrency_model : [ 'memoize' ] # note: we used to have more, so leave this array in case we want more
multithreading_args = [
'multithreading',
'-j', get_option('test_num_threads').to_string(),
'-m', concurrency_model,
'-V', # vary run number
]
test(
'-'.join(['multithreading', concurrency_model, test_name_algo]),
test_exe,
suite: [ 'algorithm', 'multithreading', concurrency_model ],
args: multithreading_args + [ '-n', get_option('test_num_events') ] + test_args,
is_parallel: false,
env: project_test_env,
timeout: 0,
)
benchmark(
'-'.join(['benchmark', f'multithreading_@concurrency_model@', test_name_algo]),
test_exe,
suite: [ 'algorithm', 'multithreading', concurrency_model ],
args: multithreading_args + [ '-n', '0' ] + test_args, # benchmark all the events
env: project_test_env,
timeout: 0,
)
endforeach
endif

endif

Expand Down
Loading