mirror of
				https://github.com/postgres/postgres.git
				synced 2025-11-03 09:13:20 +03:00 
			
		
		
		
	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
This commit is contained in:
		
							
								
								
									
										11
									
								
								meson.build
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								meson.build
									
									
									
									
									
								
							@@ -3078,6 +3078,16 @@ frontend_shlib_code = declare_dependency(
 | 
				
			|||||||
  dependencies: [shlib_code, os_deps, libintl],
 | 
					  dependencies: [shlib_code, os_deps, libintl],
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# For frontend code that doesn't use fe_utils - this mainly exists for libpq's
 | 
				
			||||||
 | 
					# tests, which are defined before fe_utils is defined, as fe_utils depends on
 | 
				
			||||||
 | 
					# libpq.
 | 
				
			||||||
 | 
					frontend_no_fe_utils_code = declare_dependency(
 | 
				
			||||||
 | 
					  include_directories: [postgres_inc],
 | 
				
			||||||
 | 
					  link_with: [common_static, pgport_static],
 | 
				
			||||||
 | 
					  sources: generated_headers,
 | 
				
			||||||
 | 
					  dependencies: [os_deps, libintl],
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Dependencies both for static and shared libpq
 | 
					# Dependencies both for static and shared libpq
 | 
				
			||||||
libpq_deps += [
 | 
					libpq_deps += [
 | 
				
			||||||
  thread_dep,
 | 
					  thread_dep,
 | 
				
			||||||
@@ -3145,7 +3155,6 @@ subdir('src')
 | 
				
			|||||||
subdir('contrib')
 | 
					subdir('contrib')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
subdir('src/test')
 | 
					subdir('src/test')
 | 
				
			||||||
subdir('src/interfaces/libpq/test')
 | 
					 | 
				
			||||||
subdir('src/interfaces/ecpg/test')
 | 
					subdir('src/interfaces/ecpg/test')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
subdir('doc/src/sgml')
 | 
					subdir('doc/src/sgml')
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,8 +1,5 @@
 | 
				
			|||||||
# Copyright (c) 2022-2024, PostgreSQL Global Development Group
 | 
					# Copyright (c) 2022-2024, PostgreSQL Global Development Group
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# test/ is entered via top-level meson.build, that way it can use the default
 | 
					 | 
				
			||||||
# args for executables (which depend on libpq).
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
libpq_sources = files(
 | 
					libpq_sources = files(
 | 
				
			||||||
  'fe-auth-scram.c',
 | 
					  'fe-auth-scram.c',
 | 
				
			||||||
  'fe-auth.c',
 | 
					  'fe-auth.c',
 | 
				
			||||||
@@ -107,6 +104,7 @@ install_data('pg_service.conf.sample',
 | 
				
			|||||||
  install_dir: dir_data,
 | 
					  install_dir: dir_data,
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					subdir('test')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
tests += {
 | 
					tests += {
 | 
				
			||||||
  'name': 'libpq',
 | 
					  'name': 'libpq',
 | 
				
			||||||
@@ -125,6 +123,7 @@ tests += {
 | 
				
			|||||||
      'with_gssapi': gssapi.found() ? 'yes' : 'no',
 | 
					      'with_gssapi': gssapi.found() ? 'yes' : 'no',
 | 
				
			||||||
      'with_krb_srvnam': 'postgres',
 | 
					      'with_krb_srvnam': 'postgres',
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
 | 
					    'deps': libpq_test_deps,
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,5 +1,7 @@
 | 
				
			|||||||
# Copyright (c) 2022-2024, PostgreSQL Global Development Group
 | 
					# Copyright (c) 2022-2024, PostgreSQL Global Development Group
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					libpq_test_deps = []
 | 
				
			||||||
 | 
					
 | 
				
			||||||
libpq_uri_regress_sources = files(
 | 
					libpq_uri_regress_sources = files(
 | 
				
			||||||
  'libpq_uri_regress.c',
 | 
					  'libpq_uri_regress.c',
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
@@ -10,9 +12,9 @@ if host_system == 'windows'
 | 
				
			|||||||
    '--FILEDESC', 'libpq test program',])
 | 
					    '--FILEDESC', 'libpq test program',])
 | 
				
			||||||
endif
 | 
					endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
testprep_targets += executable('libpq_uri_regress',
 | 
					libpq_test_deps += executable('libpq_uri_regress',
 | 
				
			||||||
  libpq_uri_regress_sources,
 | 
					  libpq_uri_regress_sources,
 | 
				
			||||||
  dependencies: [frontend_code, libpq],
 | 
					  dependencies: [frontend_no_fe_utils_code, libpq],
 | 
				
			||||||
  kwargs: default_bin_args + {
 | 
					  kwargs: default_bin_args + {
 | 
				
			||||||
    'install': false,
 | 
					    'install': false,
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
@@ -29,10 +31,12 @@ if host_system == 'windows'
 | 
				
			|||||||
    '--FILEDESC', 'libpq test program',])
 | 
					    '--FILEDESC', 'libpq test program',])
 | 
				
			||||||
endif
 | 
					endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
testprep_targets += executable('libpq_testclient',
 | 
					libpq_test_deps += executable('libpq_testclient',
 | 
				
			||||||
  libpq_testclient_sources,
 | 
					  libpq_testclient_sources,
 | 
				
			||||||
  dependencies: [frontend_code, libpq],
 | 
					  dependencies: [frontend_no_fe_utils_code, libpq],
 | 
				
			||||||
  kwargs: default_bin_args + {
 | 
					  kwargs: default_bin_args + {
 | 
				
			||||||
    'install': false,
 | 
					    'install': false,
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					testprep_targets += libpq_test_deps
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user