dependencies: os_deps + backend_both_deps + backend_deps,
)
+# install these files only during test, not main install
+test_install_data = []
+test_install_libs = []
+
# src/backend/meson.build defines backend_mod_code used for extension
# libraries.
generated_sources_ac += {'': ['GNUmakefile']}
+# After processing src/test, add test_install_libs to the testprep_targets
+# to build them
+testprep_targets += test_install_libs
+
# If there are any files in the source directory that we also generate in the
# build directory, they might get preferred over the newly generated files,
'muon': []
}[meson_impl]
+# setup tests should be run first,
+# so define priority for these
+setup_tests_priority = 100
test('tmp_install',
meson_bin, args: meson_install_args ,
env: {'DESTDIR':test_install_destdir},
- priority: 100,
+ priority: setup_tests_priority,
timeout: 300,
is_parallel: false,
suite: ['setup'])
+# get full paths of test_install_libs to copy them
+test_install_libs_fp = []
+foreach lib: test_install_libs
+ test_install_libs_fp += lib.full_path()
+endforeach
+
+install_test_files = files('src/tools/install_test_files')
+test('install_test_files',
+ python, args: [
+ install_test_files,
+ '--datadir', test_install_location / contrib_data_args['install_dir'],
+ '--libdir', test_install_location / dir_lib_pkg,
+ '--install-data', test_install_data,
+ '--install-libs', test_install_libs_fp,
+ ],
+ priority: setup_tests_priority,
+ is_parallel: false,
+ suite: ['setup'])
+
test_result_dir = meson.build_root() / 'testrun'
dependencies: backend_mod_deps,
)
+# normal extension modules
pg_mod_args = default_mod_args + {
'dependencies': [backend_mod_code],
'cpp_args': pg_mod_cpp_args,
'link_depends': pg_mod_link_depend,
}
+# extension modules that shouldn't be installed by default, as they're only
+# for testing
+pg_test_mod_args = pg_mod_args + {
+ 'install': false
+}
+
# Shared modules that, on some system, link against the server binary. Only
# Copyright (c) 2022-2023, PostgreSQL Global Development Group
-# FIXME: prevent install during main install, but not during test :/
-
delay_execution_sources = files(
'delay_execution.c',
)
delay_execution = shared_module('delay_execution',
delay_execution_sources,
- kwargs: pg_mod_args,
+ kwargs: pg_test_mod_args,
)
-testprep_targets += delay_execution
+test_install_libs += delay_execution
tests += {
'name': 'delay_execution',
# Copyright (c) 2022-2023, PostgreSQL Global Development Group
-# FIXME: prevent install during main install, but not during test :/
-
dummy_index_am_sources = files(
'dummy_index_am.c',
)
dummy_index_am = shared_module('dummy_index_am',
dummy_index_am_sources,
- kwargs: pg_mod_args,
+ kwargs: pg_test_mod_args,
)
-testprep_targets += dummy_index_am
+test_install_libs += dummy_index_am
-install_data(
+test_install_data += files(
'dummy_index_am.control',
'dummy_index_am--1.0.sql',
- kwargs: contrib_data_args,
)
tests += {
# Copyright (c) 2022-2023, PostgreSQL Global Development Group
-# FIXME: prevent install during main install, but not during test :/
-
dummy_seclabel_sources = files(
'dummy_seclabel.c',
)
dummy_seclabel = shared_module('dummy_seclabel',
dummy_seclabel_sources,
- kwargs: pg_mod_args,
+ kwargs: pg_test_mod_args,
)
-testprep_targets += dummy_seclabel
+test_install_libs += dummy_seclabel
-install_data(
+test_install_data += files(
'dummy_seclabel.control',
'dummy_seclabel--1.0.sql',
- kwargs: contrib_data_args,
)
tests += {
# Copyright (c) 2022-2023, PostgreSQL Global Development Group
-# FIXME: prevent install during main install, but not during test :/
-
plsample_sources = files(
'plsample.c',
)
plsample = shared_module('plsample',
plsample_sources,
- kwargs: pg_mod_args,
+ kwargs: pg_test_mod_args,
)
-testprep_targets += plsample
+test_install_libs += plsample
-install_data(
+test_install_data += files(
'plsample.control',
'plsample--1.0.sql',
- kwargs: contrib_data_args,
)
-
tests += {
'name': 'plsample',
'sd': meson.current_source_dir(),
# Copyright (c) 2022-2023, PostgreSQL Global Development Group
-# FIXME: prevent install during main install, but not during test :/
-
spgist_name_ops_sources = files(
'spgist_name_ops.c',
)
spgist_name_ops = shared_module('spgist_name_ops',
spgist_name_ops_sources,
- kwargs: pg_mod_args,
+ kwargs: pg_test_mod_args,
)
-testprep_targets += spgist_name_ops
+test_install_libs += spgist_name_ops
-install_data(
+test_install_data += files(
'spgist_name_ops.control',
'spgist_name_ops--1.0.sql',
- kwargs: contrib_data_args,
)
-
tests += {
'name': 'spgist_name_ops',
'sd': meson.current_source_dir(),
subdir_done()
endif
-# FIXME: prevent install during main install, but not during test :/
-
ssl_passphrase_callback_sources = files(
'ssl_passphrase_func.c',
)
ssl_passphrase_callback = shared_module('ssl_passphrase_func',
ssl_passphrase_callback_sources,
- kwargs: pg_mod_args + {
+ kwargs: pg_test_mod_args + {
'dependencies': [ssl, pg_mod_args['dependencies']],
},
)
-testprep_targets += ssl_passphrase_callback
+test_install_libs += ssl_passphrase_callback
# Targets to generate or remove the ssl certificate and key. Need to be copied
# to the source afterwards. Normally not needed.
# Copyright (c) 2022-2023, PostgreSQL Global Development Group
-# FIXME: prevent install during main install, but not during test :/
-
test_bloomfilter_sources = files(
'test_bloomfilter.c',
)
test_bloomfilter = shared_module('test_bloomfilter',
test_bloomfilter_sources,
- kwargs: pg_mod_args,
+ kwargs: pg_test_mod_args,
)
-testprep_targets += test_bloomfilter
+test_install_libs += test_bloomfilter
-install_data(
+test_install_data += files(
'test_bloomfilter.control',
'test_bloomfilter--1.0.sql',
- kwargs: contrib_data_args,
)
tests += {
# Copyright (c) 2022-2023, PostgreSQL Global Development Group
-# FIXME: prevent install during main install, but not during test :/
-
test_copy_callbacks_sources = files(
'test_copy_callbacks.c',
)
test_copy_callbacks = shared_module('test_copy_callbacks',
test_copy_callbacks_sources,
- kwargs: pg_mod_args,
+ kwargs: pg_test_mod_args,
)
-testprep_targets += test_copy_callbacks
+test_install_libs += test_copy_callbacks
-install_data(
+test_install_data += files(
'test_copy_callbacks.control',
'test_copy_callbacks--1.0.sql',
- kwargs: contrib_data_args,
)
tests += {
# Copyright (c) 2022-2023, PostgreSQL Global Development Group
-# FIXME: prevent install during main install, but not during test :/
-
test_custom_rmgrs_sources = files(
'test_custom_rmgrs.c',
)
test_custom_rmgrs = shared_module('test_custom_rmgrs',
test_custom_rmgrs_sources,
- kwargs: pg_mod_args,
+ kwargs: pg_test_mod_args,
)
-testprep_targets += test_custom_rmgrs
+test_install_libs += test_custom_rmgrs
-install_data(
+test_install_data += files(
'test_custom_rmgrs.control',
'test_custom_rmgrs--1.0.sql',
- kwargs: contrib_data_args,
)
tests += {
# Copyright (c) 2022-2023, PostgreSQL Global Development Group
-# FIXME: prevent install during main install, but not during test :/
-
test_ddl_deparse_sources = files(
'test_ddl_deparse.c',
)
test_ddl_deparse = shared_module('test_ddl_deparse',
test_ddl_deparse_sources,
- kwargs: pg_mod_args,
+ kwargs: pg_test_mod_args,
)
-testprep_targets += test_ddl_deparse
+test_install_libs += test_ddl_deparse
-install_data(
+test_install_data += files(
'test_ddl_deparse.control',
'test_ddl_deparse--1.0.sql',
- kwargs: contrib_data_args,
)
tests += {
# Copyright (c) 2022-2023, PostgreSQL Global Development Group
-# FIXME: prevent install during main install, but not during test :/
-install_data(
+test_install_data += files(
'test_ext1--1.0.sql',
'test_ext1.control',
'test_ext2--1.0.sql',
'test_ext_evttrig--1.0--2.0.sql',
'test_ext_evttrig--1.0.sql',
'test_ext_evttrig.control',
- kwargs: contrib_data_args,
)
tests += {
# Copyright (c) 2022-2023, PostgreSQL Global Development Group
-# FIXME: prevent install during main install, but not during test :/
-
test_ginpostinglist_sources = files(
'test_ginpostinglist.c',
)
test_ginpostinglist = shared_module('test_ginpostinglist',
test_ginpostinglist_sources,
- kwargs: pg_mod_args,
+ kwargs: pg_test_mod_args,
)
-testprep_targets += test_ginpostinglist
+test_install_libs += test_ginpostinglist
-install_data(
+test_install_data += files(
'test_ginpostinglist.control',
'test_ginpostinglist--1.0.sql',
- kwargs: contrib_data_args,
)
tests += {
# Copyright (c) 2022-2023, PostgreSQL Global Development Group
-# FIXME: prevent install during main install, but not during test :/
-
test_integerset_sources = files(
'test_integerset.c',
)
test_integerset = shared_module('test_integerset',
test_integerset_sources,
- kwargs: pg_mod_args,
+ kwargs: pg_test_mod_args,
)
-testprep_targets += test_integerset
+test_install_libs += test_integerset
-install_data(
+test_install_data += files(
'test_integerset.control',
'test_integerset--1.0.sql',
- kwargs: contrib_data_args,
)
tests += {
# Copyright (c) 2022-2023, PostgreSQL Global Development Group
-# FIXME: prevent install during main install, but not during test :/
-
test_lfind_sources = files(
'test_lfind.c',
)
test_lfind = shared_module('test_lfind',
test_lfind_sources,
- kwargs: pg_mod_args,
+ kwargs: pg_test_mod_args,
)
-testprep_targets += test_lfind
+test_install_libs += test_lfind
-install_data(
+test_install_data += files(
'test_lfind.control',
'test_lfind--1.0.sql',
- kwargs: contrib_data_args,
)
tests += {
# Copyright (c) 2022-2023, PostgreSQL Global Development Group
-# FIXME: prevent install during main install, but not during test :/
-
test_oat_hooks_sources = files(
'test_oat_hooks.c',
)
test_oat_hooks = shared_module('test_oat_hooks',
test_oat_hooks_sources,
- kwargs: pg_mod_args,
+ kwargs: pg_test_mod_args,
)
-testprep_targets += test_oat_hooks
+test_install_libs += test_oat_hooks
tests += {
'name': 'test_oat_hooks',
# Copyright (c) 2022-2023, PostgreSQL Global Development Group
-# FIXME: prevent install during main install, but not during test :/
-
test_parser_sources = files(
'test_parser.c',
)
test_parser = shared_module('test_parser',
test_parser_sources,
- kwargs: pg_mod_args,
+ kwargs: pg_test_mod_args,
)
-testprep_targets += test_parser
+test_install_libs += test_parser
-install_data(
+test_install_data += files(
'test_parser.control',
'test_parser--1.0.sql',
- kwargs: contrib_data_args,
)
tests += {
# Copyright (c) 2022-2023, PostgreSQL Global Development Group
-# FIXME: prevent install during main install, but not during test :/
-
test_pg_db_role_setting_sources = files(
'test_pg_db_role_setting.c',
)
test_pg_db_role_setting = shared_module('test_pg_db_role_setting',
test_pg_db_role_setting_sources,
- kwargs: pg_mod_args,
+ kwargs: pg_test_mod_args,
)
-testprep_targets += test_pg_db_role_setting
+test_install_libs += test_pg_db_role_setting
-install_data(
+test_install_data += files(
'test_pg_db_role_setting.control',
'test_pg_db_role_setting--1.0.sql',
- kwargs: contrib_data_args,
)
tests += {
# Copyright (c) 2022-2023, PostgreSQL Global Development Group
-# FIXME: prevent install during main install, but not during test :/
-install_data(
+test_install_data += files(
'test_pg_dump.control',
'test_pg_dump--1.0.sql',
- kwargs: contrib_data_args,
)
tests += {
# Copyright (c) 2022-2023, PostgreSQL Global Development Group
-# FIXME: prevent install during main install, but not during test :/
-
test_predtest_sources = files(
'test_predtest.c',
)
test_predtest = shared_module('test_predtest',
test_predtest_sources,
- kwargs: pg_mod_args,
+ kwargs: pg_test_mod_args,
)
-testprep_targets += test_predtest
+test_install_libs += test_predtest
-install_data(
+test_install_data += files(
'test_predtest.control',
'test_predtest--1.0.sql',
- kwargs: contrib_data_args,
)
tests += {
# Copyright (c) 2022-2023, PostgreSQL Global Development Group
-# FIXME: prevent install during main install, but not during test :/
-
test_rbtree_sources = files(
'test_rbtree.c',
)
test_rbtree = shared_module('test_rbtree',
test_rbtree_sources,
- kwargs: pg_mod_args,
+ kwargs: pg_test_mod_args,
)
-testprep_targets += test_rbtree
+test_install_libs += test_rbtree
-install_data(
+test_install_data += files(
'test_rbtree.control',
'test_rbtree--1.0.sql',
- kwargs: contrib_data_args,
)
tests += {
# Copyright (c) 2022-2023, PostgreSQL Global Development Group
-# FIXME: prevent install during main install, but not during test :/
-
test_regex_sources = files(
'test_regex.c',
)
test_regex = shared_module('test_regex',
test_regex_sources,
- kwargs: pg_mod_args,
+ kwargs: pg_test_mod_args,
)
-testprep_targets += test_regex
+test_install_libs += test_regex
-install_data(
+test_install_data += files(
'test_regex.control',
'test_regex--1.0.sql',
- kwargs: contrib_data_args,
)
tests += {
# Copyright (c) 2022-2023, PostgreSQL Global Development Group
-# FIXME: prevent install during main install, but not during test :/
-
test_rls_hooks_sources = files(
'test_rls_hooks.c',
)
test_rls_hooks = shared_module('test_rls_hooks',
test_rls_hooks_sources,
- kwargs: pg_mod_args,
+ kwargs: pg_test_mod_args,
)
-testprep_targets += test_rls_hooks
+test_install_libs += test_rls_hooks
tests += {
'name': 'test_rls_hooks',
# Copyright (c) 2022-2023, PostgreSQL Global Development Group
-# FIXME: prevent install during main install, but not during test :/
-
test_shm_mq_sources = files(
'setup.c',
'test.c',
test_shm_mq = shared_module('test_shm_mq',
test_shm_mq_sources,
- kwargs: pg_mod_args,
+ kwargs: pg_test_mod_args,
)
-testprep_targets += test_shm_mq
+test_install_libs += test_shm_mq
-install_data(
+test_install_data += files(
'test_shm_mq.control',
'test_shm_mq--1.0.sql',
- kwargs: contrib_data_args,
)
tests += {
# Copyright (c) 2022-2023, PostgreSQL Global Development Group
-# FIXME: prevent install during main install, but not during test :/
-
test_slru_sources = files(
'test_slru.c',
)
test_slru = shared_module('test_slru',
test_slru_sources,
- kwargs: pg_mod_args,
+ kwargs: pg_test_mod_args,
)
-testprep_targets += test_slru
+test_install_libs += test_slru
-install_data(
+test_install_data += files(
'test_slru.control',
'test_slru--1.0.sql',
- kwargs: contrib_data_args,
)
tests += {
# Copyright (c) 2022-2023, PostgreSQL Global Development Group
-# FIXME: prevent install during main install, but not during test :/
-
test_worker_spi_sources = files(
'worker_spi.c',
)
test_worker_spi = shared_module('worker_spi',
test_worker_spi_sources,
- kwargs: pg_mod_args,
+ kwargs: pg_test_mod_args,
)
-testprep_targets += test_worker_spi
+test_install_libs += test_worker_spi
-install_data(
+test_install_data += files(
'worker_spi.control',
'worker_spi--1.0.sql',
- kwargs: contrib_data_args,
)
tests += {
regress_module = shared_module('regress',
['regress.c'],
- kwargs: pg_mod_args + {
- 'install': false,
- },
+ kwargs: pg_test_mod_args,
)
-testprep_targets += regress_module
+test_install_libs += regress_module
# Get some extra C modules from contrib/spi but mark them as not to be
# installed.
autoinc_regress = shared_module('autoinc',
['../../../contrib/spi/autoinc.c'],
- kwargs: pg_mod_args + {
- 'install': false,
- },
+ kwargs: pg_test_mod_args,
)
-testprep_targets += autoinc_regress
+test_install_libs += autoinc_regress
refint_regress = shared_module('refint',
['../../../contrib/spi/refint.c'],
c_args: refint_cflags,
- kwargs: pg_mod_args + {
- 'install': false,
- },
+ kwargs: pg_test_mod_args,
)
-testprep_targets += refint_regress
+test_install_libs += refint_regress
tests += {
--- /dev/null
+#!/usr/bin/env python3
+
+# Helper to install additional files into the temporary installation
+# for tests, beyond those that are installed by meson/ninja install.
+
+import argparse
+import shutil
+import os
+
+parser = argparse.ArgumentParser()
+
+parser.add_argument('--datadir', type=str)
+parser.add_argument('--libdir', type=str)
+parser.add_argument('--install-data', type=str, nargs='*')
+parser.add_argument('--install-libs', type=str, nargs='*')
+
+args = parser.parse_args()
+
+
+def copy_files(src_list: list, dest: str):
+ os.makedirs(dest, exist_ok=True)
+
+ for src in src_list:
+ shutil.copy2(src, dest)
+
+
+copy_files(args.install_data, args.datadir)
+copy_files(args.install_libs, args.libdir)