Skip to content

Commit 1ca3234

Browse files
committed
checking exe + buiild dir for plugin, allowing gemc to run in meson build dir
1 parent 9c8999d commit 1ca3234

4 files changed

Lines changed: 42 additions & 56 deletions

File tree

ci/build.sh

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,22 +34,12 @@ meson install || exit 1
3434
echo " > $GEMC recursive content:"
3535
ls -lR $GEMC || exit 1
3636

37-
38-
echo
39-
echo Reconfigure to use gemc in some tests
40-
meson setup build --reconfigure
41-
echo
42-
43-
4437
# if $1 is NOT one of sanitize option, run meson test
4538
if [[ $1 != @(address|thread|undefined|memory|leak) ]]; then
46-
cd build || exit 1
4739
echo " > Running meson test"
4840
meson test -v -j 1 || exit 1
4941
fi
5042

51-
52-
5343
echo
5444
echo " ldd of $GEMC/bin/gemc:"
5545

examples/meson.build

Lines changed: 32 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -32,49 +32,45 @@ foreach branch : examples_map.keys()
3232
geo_test_name = 'geo_' + branch + '_' + example + '_' + format + '_variation_' + variation
3333
run_test_name_asci = 'run_asci_output_' + branch + '_' + example + '_' + format + '_variation_' + variation
3434
run_test_name_root = 'run_root_output_' + branch + '_' + example + '_' + format + '_variation_' + variation
35-
if installed_gemc.found()
36-
test(geo_test_name,
37-
python_exe,
38-
args : [example_dir + example + '.py', '-f', format, '-sql', '../../gemc.db', '-v', variation], # the sql flag is ignored for ascii format
39-
workdir : example_dir,
40-
env : { 'PYTHONDONTWRITEBYTECODE' : '1' },
41-
priority : 10)
42-
test(run_test_name_asci,
43-
installed_gemc,
44-
args : [yaml_file, '-gsystem="[{name: ' + example + ', factory: ' + format + ', variation: ' + variation + '}]"', ascii_output, '-sql=../../gemc.db'],
45-
workdir : example_dir,
46-
priority : -10)
47-
test(run_test_name_root,
48-
installed_gemc,
49-
args : [yaml_file, '-gsystem="[{name: ' + example + ', factory: ' + format + ', variation: ' + variation + '}]"', root_output, '-sql=../../gemc.db'],
50-
workdir : example_dir,
51-
priority : -15)
52-
endif
35+
test(geo_test_name,
36+
python_exe,
37+
args : [example_dir + example + '.py', '-f', format, '-sql', '../../gemc.db', '-v', variation], # the sql flag is ignored for ascii format
38+
workdir : example_dir,
39+
env : { 'PYTHONDONTWRITEBYTECODE' : '1' },
40+
priority : 10)
41+
test(run_test_name_asci,
42+
gemc,
43+
args : [yaml_file, '-gsystem="[{name: ' + example + ', factory: ' + format + ', variation: ' + variation + '}]"', ascii_output, '-sql=../../gemc.db'],
44+
workdir : example_dir,
45+
priority : -10)
46+
test(run_test_name_root,
47+
gemc,
48+
args : [yaml_file, '-gsystem="[{name: ' + example + ', factory: ' + format + ', variation: ' + variation + '}]"', root_output, '-sql=../../gemc.db'],
49+
workdir : example_dir,
50+
priority : -15)
5351
endforeach
5452

5553
# Geometry building tests (runs loop): Loop over runs with fixed variation "default"
5654
foreach run_value : runs
5755
geo_test_name = 'geo_' + branch + '_' + example + '_' + format + '_run_' + run_value
5856
run_test_name_asci = 'run_asci_output_' + branch + '_' + example + '_' + format + '_run_' + run_value
5957
run_test_name_root = 'run_root_output_' + branch + '_' + example + '_' + format + '_run_' + run_value
60-
if installed_gemc.found()
61-
test(geo_test_name,
62-
python_exe,
63-
args : [example_dir + example + '.py', '-f', format, '-sql', '../../gemc.db', '-r', run_value], # the sql flag is ignored for ascii format
64-
workdir : example_dir,
65-
env : { 'PYTHONDONTWRITEBYTECODE' : '1' },
66-
priority : 5)
67-
test(run_test_name_asci,
68-
installed_gemc,
69-
args : [yaml_file, '-gsystem="[{name: ' + example + ', factory: ' + format + ', runno:' + run_value + '}]"', ascii_output, '-sql=../../gemc.db'],
70-
workdir : example_dir,
71-
priority : -20)
72-
test(run_test_name_root,
73-
installed_gemc,
74-
args : [yaml_file, '-gsystem="[{name: ' + example + ', factory: ' + format + ', runno:' + run_value + '}]"', root_output, '-sql=../../gemc.db'],
75-
workdir : example_dir,
76-
priority : -25)
77-
endif
58+
test(geo_test_name,
59+
python_exe,
60+
args : [example_dir + example + '.py', '-f', format, '-sql', '../../gemc.db', '-r', run_value], # the sql flag is ignored for ascii format
61+
workdir : example_dir,
62+
env : { 'PYTHONDONTWRITEBYTECODE' : '1' },
63+
priority : 5)
64+
test(run_test_name_asci,
65+
gemc,
66+
args : [yaml_file, '-gsystem="[{name: ' + example + ', factory: ' + format + ', runno:' + run_value + '}]"', ascii_output, '-sql=../../gemc.db'],
67+
workdir : example_dir,
68+
priority : -20)
69+
test(run_test_name_root,
70+
gemc,
71+
args : [yaml_file, '-gsystem="[{name: ' + example + ', factory: ' + format + ', runno:' + run_value + '}]"', root_output, '-sql=../../gemc.db'],
72+
workdir : example_dir,
73+
priority : -25)
7874
endforeach
7975

8076
endforeach

gfactory/gdl.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,16 @@ struct DynamicLib {
5959
log->debug(NORMAL, "Trying ", dlFileName);
6060
}
6161

62+
// trying installation path build if not found - allows meson tests to run from the build dir
63+
if (!doesFileExists(dlFileName)) {
64+
log->debug(NORMAL, dlFileName, " not found...");
65+
66+
std::filesystem::path gemcRoot = gutilities::gemc_root();
67+
dlFileName = gemcRoot.string() + "/build/" + path;
68+
69+
log->debug(NORMAL, "Trying ", dlFileName);
70+
}
71+
6272
if (doesFileExists(dlFileName)) {
6373
handle = load_lib(dlFileName);
6474
if (handle == nullptr) {

meson.build

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -213,16 +213,6 @@ gemc = executable(
213213
override_options : ['b_pie=true']
214214
)
215215

216-
# Somewhere near the top-level meson.build
217-
prefix = get_option('prefix')
218-
bindir = get_option('bindir')
219-
ibin = join_paths(prefix, bindir)
220-
221-
# Find the installed gemc (only present after `meson install`)
222-
installed_gemc = find_program('gemc',
223-
dirs : [ibin],
224-
required : false)
225-
226216
# test gemc options. Adjust root to fit the geometry
227217
example_test_dir = 'gsystem'
228218
examples_dir = get_option('prefix') + '/test/' + example_test_dir

0 commit comments

Comments
 (0)