Skip to content

Commit f7826df

Browse files
nbyavuzanarazel
authored andcommitted
meson: prevent installation of test files during main install
1 parent 53a2858 commit f7826df

File tree

25 files changed

+125
-121
lines changed

25 files changed

+125
-121
lines changed

meson.build

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2818,6 +2818,10 @@ backend_code = declare_dependency(
28182818
dependencies: os_deps + backend_both_deps + backend_deps,
28192819
)
28202820

2821+
# install these files only during test, not main install
2822+
test_install_files = []
2823+
test_install_libs = []
2824+
28212825
# src/backend/meson.build defines backend_mod_code used for extension
28222826
# libraries.
28232827

@@ -2838,6 +2842,10 @@ subdir('doc/src/sgml')
28382842

28392843
generated_sources_ac += {'': ['GNUmakefile']}
28402844

2845+
# After processing src/test, add test_install_libs to the testprep_targets
2846+
# to build them
2847+
testprep_targets += test_install_libs
2848+
28412849

28422850
# If there are any files in the source directory that we also generate in the
28432851
# build directory, they might get preferred over the newly generated files,
@@ -2928,14 +2936,36 @@ meson_install_args = meson_args + ['install'] + {
29282936
'muon': []
29292937
}[meson_impl]
29302938

2939+
# setup tests should be run first,
2940+
# so define priority for these
2941+
setup_tests_priority = 100
29312942
test('tmp_install',
29322943
meson_bin, args: meson_install_args ,
29332944
env: {'DESTDIR':test_install_destdir},
2934-
priority: 100,
2945+
priority: setup_tests_priority,
29352946
timeout: 300,
29362947
is_parallel: false,
29372948
suite: ['setup'])
29382949

2950+
# get full paths of test_install_libs to copy them
2951+
test_install_libs_fp = []
2952+
foreach lib: test_install_libs
2953+
test_install_libs_fp += lib.full_path()
2954+
endforeach
2955+
2956+
install_additional_files = files('src/test/install_additional_files')
2957+
test('install_additional_files',
2958+
python, args: [
2959+
install_additional_files,
2960+
'--sharedir', test_install_location / contrib_data_args['install_dir'],
2961+
'--libdir', test_install_location / dir_lib_pkg,
2962+
'--install_files', test_install_files,
2963+
'--install_libs', test_install_libs_fp,
2964+
],
2965+
priority: setup_tests_priority,
2966+
is_parallel: false,
2967+
suite: ['setup'])
2968+
29392969
test_result_dir = meson.build_root() / 'testrun'
29402970

29412971

src/backend/meson.build

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,9 @@ pg_mod_args = default_mod_args + {
184184
}
185185

186186

187+
pg_test_mod_args = pg_mod_args + {
188+
'install': false
189+
}
187190

188191
###############################################################
189192
# Define a .pc file that can be used to build server extensions

src/test/install_additional_files

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/usr/bin/env python3
2+
3+
import argparse
4+
import shutil
5+
import os
6+
7+
parser = argparse.ArgumentParser()
8+
9+
parser.add_argument('--sharedir', help='installationpath of file', type=str)
10+
parser.add_argument('--libdir', help='installation path of libs', type=str)
11+
parser.add_argument('--install_files', help='list of files to be installed', type=str, nargs='*')
12+
parser.add_argument('--install_libs', help='list of libs to be installed', type=str, nargs='*')
13+
14+
args = parser.parse_args()
15+
16+
def copy_files(src_list: list, dest: str):
17+
# check if dir exists
18+
try:
19+
os.makedirs(dest)
20+
except OSError as e:
21+
if not os.path.isdir(dest):
22+
raise
23+
24+
# check if the src is dir or file
25+
# then call the correct function
26+
for src in src_list:
27+
if os.path.isdir(src):
28+
shutil.copytree(src, dest)
29+
else:
30+
shutil.copy2(src, dest)
31+
32+
copy_files(args.install_files, args.sharedir)
33+
copy_files(args.install_libs, args.libdir)

src/test/modules/delay_execution/meson.build

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# FIXME: prevent install during main install, but not during test :/
2-
31
delay_execution_sources = files(
42
'delay_execution.c',
53
)
@@ -12,9 +10,9 @@ endif
1210

1311
delay_execution = shared_module('delay_execution',
1412
delay_execution_sources,
15-
kwargs: pg_mod_args,
13+
kwargs: pg_test_mod_args,
1614
)
17-
testprep_targets += delay_execution
15+
test_install_libs += delay_execution
1816

1917
tests += {
2018
'name': 'delay_execution',

src/test/modules/dummy_index_am/meson.build

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# FIXME: prevent install during main install, but not during test :/
2-
31
dummy_index_am_sources = files(
42
'dummy_index_am.c',
53
)
@@ -12,14 +10,13 @@ endif
1210

1311
dummy_index_am = shared_module('dummy_index_am',
1412
dummy_index_am_sources,
15-
kwargs: pg_mod_args,
13+
kwargs: pg_test_mod_args,
1614
)
17-
testprep_targets += dummy_index_am
15+
test_install_libs += dummy_index_am
1816

19-
install_data(
17+
test_install_files += files(
2018
'dummy_index_am.control',
2119
'dummy_index_am--1.0.sql',
22-
kwargs: contrib_data_args,
2320
)
2421

2522
tests += {

src/test/modules/dummy_seclabel/meson.build

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# FIXME: prevent install during main install, but not during test :/
2-
31
dummy_seclabel_sources = files(
42
'dummy_seclabel.c',
53
)
@@ -12,14 +10,13 @@ endif
1210

1311
dummy_seclabel = shared_module('dummy_seclabel',
1412
dummy_seclabel_sources,
15-
kwargs: pg_mod_args,
13+
kwargs: pg_test_mod_args,
1614
)
17-
testprep_targets += dummy_seclabel
15+
test_install_libs += dummy_seclabel
1816

19-
install_data(
17+
test_install_files += files(
2018
'dummy_seclabel.control',
2119
'dummy_seclabel--1.0.sql',
22-
kwargs: contrib_data_args,
2320
)
2421

2522
tests += {

src/test/modules/plsample/meson.build

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# FIXME: prevent install during main install, but not during test :/
2-
31
plsample_sources = files(
42
'plsample.c',
53
)
@@ -12,16 +10,14 @@ endif
1210

1311
plsample = shared_module('plsample',
1412
plsample_sources,
15-
kwargs: pg_mod_args,
13+
kwargs: pg_test_mod_args,
1614
)
17-
testprep_targets += plsample
15+
test_install_libs += plsample
1816

19-
install_data(
17+
test_install_files += files(
2018
'plsample.control',
2119
'plsample--1.0.sql',
22-
kwargs: contrib_data_args,
2320
)
24-
2521
tests += {
2622
'name': 'plsample',
2723
'sd': meson.current_source_dir(),

src/test/modules/spgist_name_ops/meson.build

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# FIXME: prevent install during main install, but not during test :/
2-
31
spgist_name_ops_sources = files(
42
'spgist_name_ops.c',
53
)
@@ -12,16 +10,14 @@ endif
1210

1311
spgist_name_ops = shared_module('spgist_name_ops',
1412
spgist_name_ops_sources,
15-
kwargs: pg_mod_args,
13+
kwargs: pg_test_mod_args,
1614
)
17-
testprep_targets += spgist_name_ops
15+
test_install_libs += spgist_name_ops
1816

19-
install_data(
17+
test_install_files += files(
2018
'spgist_name_ops.control',
2119
'spgist_name_ops--1.0.sql',
22-
kwargs: contrib_data_args,
2320
)
24-
2521
tests += {
2622
'name': 'spgist_name_ops',
2723
'sd': meson.current_source_dir(),

src/test/modules/ssl_passphrase_callback/meson.build

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ if not ssl.found()
22
subdir_done()
33
endif
44

5-
# FIXME: prevent install during main install, but not during test :/
6-
75
ssl_passphrase_callback_sources = files(
86
'ssl_passphrase_func.c',
97
)
@@ -16,11 +14,11 @@ endif
1614

1715
ssl_passphrase_callback = shared_module('ssl_passphrase_func',
1816
ssl_passphrase_callback_sources,
19-
kwargs: pg_mod_args + {
17+
kwargs: pg_test_mod_args + {
2018
'dependencies': [ssl, pg_mod_args['dependencies']],
2119
},
2220
)
23-
testprep_targets += ssl_passphrase_callback
21+
test_install_libs += ssl_passphrase_callback
2422

2523
# Targets to generate or remove the ssl certificate and key. Need to be copied
2624
# to the source afterwards. Normally not needed.

src/test/modules/test_bloomfilter/meson.build

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# FIXME: prevent install during main install, but not during test :/
2-
31
test_bloomfilter_sources = files(
42
'test_bloomfilter.c',
53
)
@@ -12,14 +10,13 @@ endif
1210

1311
test_bloomfilter = shared_module('test_bloomfilter',
1412
test_bloomfilter_sources,
15-
kwargs: pg_mod_args,
13+
kwargs: pg_test_mod_args,
1614
)
17-
testprep_targets += test_bloomfilter
15+
test_install_libs += test_bloomfilter
1816

19-
install_data(
17+
test_install_files += files(
2018
'test_bloomfilter.control',
2119
'test_bloomfilter--1.0.sql',
22-
kwargs: contrib_data_args,
2320
)
2421

2522
tests += {

0 commit comments

Comments
 (0)