Skip to content
This repository was archived by the owner on Feb 11, 2026. It is now read-only.

Commit ae3ac8b

Browse files
authored
build: cleanup test suites and python files (#428)
1 parent b6dfbfc commit ae3ac8b

12 files changed

Lines changed: 115 additions & 57 deletions

.github/make-benchmark-table.rb

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,28 @@
2727

2828
suites.uniq!
2929

30+
def full_suite_name(s)
31+
case s
32+
when 'st'
33+
return 'Single Threaded'
34+
when 'mt'
35+
return 'Multithreaded'
36+
else
37+
return s
38+
end
39+
end
40+
3041
def row(arr)
3142
puts '| ' + arr.join(' | ') + ' |'
3243
end
3344
puts """### Benchmarks
3445
Algorithm execution times in seconds
3546
3647
"""
37-
row ['Algorithm', *suites.map{|suite|suite.gsub /_/, ' '}]
48+
row ['Algorithm', *suites.map{|suite|full_suite_name suite}]
3849
row (suites.size+1).times.map{ |i| '---' }
3950

40-
results.each do |algo_name, algo_results|
51+
results.sort.each do |algo_name, algo_results|
4152
times = suites.map{ |suite| algo_results[suite] }
4253
row ["`#{algo_name}`", *times]
4354
end

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,10 +197,10 @@ jobs:
197197
- name: benchmark algorithms
198198
if: ${{ matrix.id == 'cpp' }}
199199
run: |
200-
for suite in single_threaded memoize; do
200+
for suite in st mt; do
201201
meson test --benchmark --suite $suite -C iguana_build | tee benchmark_$suite.txt
202202
done
203-
iguana_src/.github/make-benchmark-table.rb benchmark_{single_threaded,memoize}.txt | xargs -0 -I{} echo {} >> $GITHUB_STEP_SUMMARY
203+
iguana_src/.github/make-benchmark-table.rb benchmark_{st,mt}.txt | xargs -0 -I{} echo {} >> $GITHUB_STEP_SUMMARY
204204
### reproducible build test
205205
- name: reproducible build test
206206
if: ${{ matrix.id == 'cpp' }}

bind/python/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ For Python to be able to find and use these bindings, you need to set some envir
3636
3737
## Running the Examples
3838
39-
Example Python scripts are found in this directory as `iguana_ex_*.py`; they will be installed in the `bin/` subdirectory.
39+
Example Python scripts are found in the [`examples/` directory as `iguana_ex_python*.py`](/examples); they will be installed in the `bin/` subdirectory.
4040
4141
Most of them are analogous to the C++ examples, but some may be specific to the Python bindings.
4242

bind/python/meson.build

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1 @@
11
install_subdir('pyiguana', install_dir: project_pythondir)
2-
3-
if (get_option('install_examples'))
4-
python_examples = [
5-
'iguana_ex_python_00_run_functions.py',
6-
'iguana_ex_python_01_action_functions.py',
7-
'iguana_ex_python_hipopy.py',
8-
]
9-
foreach example : python_examples
10-
install_data(example, install_dir: get_option('bindir'), install_mode: 'rwxr-xr-x')
11-
endforeach
12-
endif

bind/python/requirements.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
11
cppyy==3.1.2
2-
cppyy-backend==1.15.2
3-
cppyy-cling==6.30.0
4-
CPyCppyy==1.12.16
52
pkgconfig==1.5.5
63
hipopy==2.0.1
File renamed without changes.
File renamed without changes.

examples/meson.build

Lines changed: 46 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,36 @@
22
example_config_files_prefix = project_etcdir / 'examples'
33
install_subdir('config' / 'examples', install_dir: example_config_files_prefix, strip_directory: true)
44

5-
# example source information
5+
# compiled examples
66
example_sources = {
7-
'iguana_ex_cpp_00_run_functions': {'sources': [ 'iguana_ex_cpp_00_run_functions.cc' ]},
8-
'iguana_ex_cpp_00_run_functions_with_banks': {'sources': [ 'iguana_ex_cpp_00_run_functions_with_banks.cc' ]},
9-
'iguana_ex_cpp_01_action_functions': {'sources': [ 'iguana_ex_cpp_01_action_functions.cc' ]},
7+
# C++
8+
'iguana_ex_cpp_00_run_functions': {
9+
'sources': [ 'iguana_ex_cpp_00_run_functions.cc' ],
10+
'suite': 'cpp',
11+
},
12+
'iguana_ex_cpp_00_run_functions_with_banks': {
13+
'sources': [ 'iguana_ex_cpp_00_run_functions_with_banks.cc' ],
14+
'suite': 'cpp',
15+
},
16+
'iguana_ex_cpp_01_action_functions': {
17+
'sources': [ 'iguana_ex_cpp_01_action_functions.cc' ],
18+
'suite': 'cpp',
19+
},
1020
'iguana_ex_cpp_dataframes': {
1121
'sources': [ 'iguana_ex_cpp_dataframes.cc' ],
22+
'suite': 'cpp',
1223
'build_this': ROOT_dep.found() and hipo_dep_dataframes_found,
1324
'test_this': false, # FIXME: disabled for now, see https://github.com/JeffersonLab/iguana/issues/384
1425
},
1526
'iguana_ex_cpp_config_files': {
1627
'sources': [ 'iguana_ex_cpp_config_files.cc' ],
28+
'suite': 'cpp',
1729
'test_args': [ get_option('prefix') / example_config_files_prefix ],
1830
},
31+
# Fortran
1932
'iguana_ex_fortran_01_action_functions': {
2033
'sources': [ 'iguana_ex_fortran_01_action_functions.f' ],
34+
'suite': 'fortran',
2135
'build_this': get_option('bind_fortran') and ROOT_dep.found(), # depends on physics::InclusiveKinematics, which depends on ROOT
2236
},
2337
}
@@ -37,7 +51,7 @@ foreach example, info : example_sources
3751
test(
3852
example,
3953
example_exe,
40-
suite: [ 'example', 'single_threaded' ],
54+
suite: [ 'example', info.get('suite') ],
4155
args: info.get(
4256
'test_args',
4357
[ get_option('test_data_file'), '100' ], # don't run too many events, or meson test log will be huge
@@ -48,3 +62,30 @@ foreach example, info : example_sources
4862
endif
4963
endif
5064
endforeach
65+
66+
# Python examples
67+
if (get_option('bind_python'))
68+
python_examples = [
69+
'iguana_ex_python_00_run_functions.py',
70+
'iguana_ex_python_01_action_functions.py',
71+
'iguana_ex_python_hipopy.py',
72+
]
73+
foreach example : python_examples
74+
install_data(
75+
example,
76+
install_dir: get_option('bindir'),
77+
install_mode: 'rwxr-xr-x'
78+
)
79+
if fs.is_file(get_option('test_data_file'))
80+
test(
81+
example,
82+
prog_python,
83+
suite: [ 'example', 'python' ],
84+
args: [ example, get_option('test_data_file'), '100' ], # don't run too many events, or meson test log will be huge
85+
workdir: meson.current_source_dir(),
86+
env: project_test_env,
87+
timeout: 240,
88+
)
89+
endif
90+
endforeach
91+
endif

meson.build

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,11 @@ prog_ruby = find_program(
7878
version: '>=3.0.0',
7979
required: use_chameleon,
8080
)
81+
prog_python = find_program(
82+
'python3',
83+
version: '>=3.0.0',
84+
required: get_option('bind_python'),
85+
)
8186
rcdb_dep = dependency(
8287
'rcdb',
8388
fallback: ['rcdb', 'rcdb_dep'],
@@ -179,6 +184,16 @@ project_test_env.set(
179184
'suppressions=' + meson.project_source_root() / 'meson' / 'lsan.supp',
180185
)
181186

187+
# additional test environment variables
188+
project_test_env.prepend(
189+
'PKG_CONFIG_PATH',
190+
get_option('prefix') / get_option('libdir') / 'pkgconfig'
191+
)
192+
project_test_env.prepend(
193+
'PYTHONPATH',
194+
get_option('prefix') / 'python'
195+
)
196+
182197
# set preprocessor macros
183198
add_project_arguments('-DIGUANA_ETCDIR="' + get_option('prefix') / project_etcdir + '"', language: [ 'cpp' ])
184199
if ROOT_dep.found()

0 commit comments

Comments
 (0)