Skip to content

Commit ad80e58

Browse files
committed
meson: Add missing dependencies for libpq tests
The missing dependency was, e.g., visible when doing ninja clean && ninja meson-test-prereq && meson test --no-rebuild --suite setup --suite libpq This is a bit more complicated than other related fixes, because until now libpq's tests depended on 'frontend_code', which includes a dependency on fe_utils, which in turns on libpq. That in turn required src/interfaces/libpq/test to be entered from the top-level, not from libpq/meson.build. Because of that the test definitions in libpq/meson.build could not declare a dependency on the binaries defined in libpq/test/meson.build. To fix this, this commit creates frontend_no_fe_utils_code, which allows us to recurse into libpq/test from withing libpq/meson.build. Apply this to all branches with meson support, as part of an effort to fix incorrect test dependencies that can lead to test failures. Discussion: https://postgr.es/m/CAGECzQSvM3iSDmjF+=Kof5an6jN8UbkP_4cKKT9w6GZavmb5yQ@mail.gmail.com Discussion: https://postgr.es/m/bdba588f-69a9-4f3e-9b95-62d07210a32e@eisentraut.org Backpatch: 16-, where meson support was added
1 parent 5acf063 commit ad80e58

File tree

3 files changed

+20
-8
lines changed

3 files changed

+20
-8
lines changed

meson.build

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2951,6 +2951,16 @@ frontend_shlib_code = declare_dependency(
29512951
dependencies: [shlib_code, os_deps, libintl],
29522952
)
29532953

2954+
# For frontend code that doesn't use fe_utils - this mainly exists for libpq's
2955+
# tests, which are defined before fe_utils is defined, as fe_utils depends on
2956+
# libpq.
2957+
frontend_no_fe_utils_code = declare_dependency(
2958+
include_directories: [postgres_inc],
2959+
link_with: [common_static, pgport_static],
2960+
sources: generated_headers,
2961+
dependencies: [os_deps, libintl],
2962+
)
2963+
29542964
# Dependencies both for static and shared libpq
29552965
libpq_deps += [
29562966
thread_dep,
@@ -3018,7 +3028,6 @@ subdir('src')
30183028
subdir('contrib')
30193029

30203030
subdir('src/test')
3021-
subdir('src/interfaces/libpq/test')
30223031
subdir('src/interfaces/ecpg/test')
30233032

30243033
subdir('doc/src/sgml')

src/interfaces/libpq/meson.build

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
# Copyright (c) 2022-2023, PostgreSQL Global Development Group
22

3-
# test/ is entered via top-level meson.build, that way it can use the default
4-
# args for executables (which depend on libpq).
5-
63
libpq_sources = files(
74
'fe-auth-scram.c',
85
'fe-auth.c',
@@ -107,6 +104,7 @@ install_data('pg_service.conf.sample',
107104
install_dir: dir_data,
108105
)
109106

107+
subdir('test')
110108

111109
tests += {
112110
'name': 'libpq',
@@ -120,6 +118,7 @@ tests += {
120118
't/004_load_balance_dns.pl',
121119
],
122120
'env': {'with_ssl': ssl_library},
121+
'deps': libpq_test_deps,
123122
},
124123
}
125124

src/interfaces/libpq/test/meson.build

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Copyright (c) 2022-2023, PostgreSQL Global Development Group
22

3+
libpq_test_deps = []
4+
35
libpq_uri_regress_sources = files(
46
'libpq_uri_regress.c',
57
)
@@ -10,9 +12,9 @@ if host_system == 'windows'
1012
'--FILEDESC', 'libpq test program',])
1113
endif
1214

13-
testprep_targets += executable('libpq_uri_regress',
15+
libpq_test_deps += executable('libpq_uri_regress',
1416
libpq_uri_regress_sources,
15-
dependencies: [frontend_code, libpq],
17+
dependencies: [frontend_no_fe_utils_code, libpq],
1618
kwargs: default_bin_args + {
1719
'install': false,
1820
}
@@ -29,10 +31,12 @@ if host_system == 'windows'
2931
'--FILEDESC', 'libpq test program',])
3032
endif
3133

32-
testprep_targets += executable('libpq_testclient',
34+
libpq_test_deps += executable('libpq_testclient',
3335
libpq_testclient_sources,
34-
dependencies: [frontend_code, libpq],
36+
dependencies: [frontend_no_fe_utils_code, libpq],
3537
kwargs: default_bin_args + {
3638
'install': false,
3739
}
3840
)
41+
42+
testprep_targets += libpq_test_deps

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy