1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-08 21:18:16 +03:00

build: Do not build selftest binaries for builds without --enable-selftest

Add new for_selftest option to SAMBA_BINARY() and SAMBA3_BINARY()

This allows us to be much more consistent (at least in the core Samba)
and documents clearly why the binary should not be installed.

Not modified are
 - test_lp_load
 - notifyd-tests
 - gendrandperf
 - test* from examples/libsmbclient
 - dbwrap_torture
 - split_tokens
 - locktest2
 - msgtest
 - msg_sink
 - msg_source
 - versiontest
 - rpc_open_tcp
 - test_headers

As these are not tested in selftest so any change would also be
untested.  Of course they probably should be added in a different
MR.

Also not modified (because they are not tests, nor part of the
build system) are:
 - smb2mount
 - notifydd
 - log2pacp
 - debug2html
 - smbfilter
 - destroy_netlogon_creds_cli
 - spotlight2*
 - tevent_glib_tracker

These do however appear to be untested.

For now, the source4 forked client tools are left unchanged:
 - smbclient4
 - nmblookup4

Finally, the heimdal binaries are left as install=False as
they are either part of the build system or end-user tools
that we just don't want to install.  These are however tested.

The motivation is commit like c34ec003b7
and da87fa998a, which are both totally
correct but are not needed if the selftest is not run on MacOS.

There are likely other platforms or build environments where building
our test binaries is more pain than valuable, see for example also
https://lists.samba.org/archive/samba/2019-November/227137.html

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Isaac Boukris <iboukris@samba.org>

Autobuild-User(master): Isaac Boukris <iboukris@samba.org>
Autobuild-Date(master): Fri Nov 22 11:48:59 UTC 2019 on sn-devel-184
This commit is contained in:
Andrew Bartlett 2019-11-22 10:06:57 +13:00 committed by Isaac Boukris
parent f8947538b5
commit 6107c79c90
18 changed files with 69 additions and 67 deletions

View File

@ -361,9 +361,13 @@ def SAMBA_BINARY(bld, binname, source,
install=True,
install_path=None,
enabled=True,
fuzzer=False):
fuzzer=False,
for_selftest=False):
'''define a Samba binary'''
if for_selftest and not bld.CONFIG_GET('ENABLE_SELFTEST'):
enabled=False
if not enabled:
SET_TARGET_TYPE(bld, binname, 'DISABLED')
return

View File

@ -10,5 +10,5 @@ bld.SAMBA_SUBSYSTEM('LIBASYNC_REQ',
bld.SAMBA_BINARY('async_connect_send_test',
source='async_connect_send_test.c',
deps='LIBASYNC_REQ',
install=False
for_selftest=True
)

View File

@ -9,7 +9,7 @@ bld.SAMBA_SUBSYSTEM(
source='audit_logging.c'
)
if bld.AD_DC_BUILD_IS_ENABLED() and bld.CONFIG_GET('ENABLE_SELFTEST'):
if bld.AD_DC_BUILD_IS_ENABLED():
bld.SAMBA_BINARY(
'audit_logging_test',
source='tests/audit_logging_test.c',
@ -21,10 +21,10 @@ if bld.AD_DC_BUILD_IS_ENABLED() and bld.CONFIG_GET('ENABLE_SELFTEST'):
samba-util
LIBTSOCKET
''',
install=False
for_selftest=True
)
if bld.AD_DC_BUILD_IS_ENABLED() and bld.CONFIG_GET('ENABLE_SELFTEST'):
if bld.AD_DC_BUILD_IS_ENABLED():
bld.SAMBA_BINARY(
'audit_logging_error_test',
source='tests/audit_logging_error_test.c',
@ -36,7 +36,7 @@ if bld.AD_DC_BUILD_IS_ENABLED() and bld.CONFIG_GET('ENABLE_SELFTEST'):
samba-util
LIBTSOCKET
''',
install=False,
for_selftest=True,
ldflags='''
-Wl,--wrap,json_object_set_new
-Wl,--wrap,json_object_update

View File

@ -25,11 +25,11 @@ bld.SAMBA_BINARY('pthreadpooltest',
source='tests.c',
deps='PTHREADPOOL',
enabled=bld.env.WITH_PTHREADPOOL,
install=False)
for_selftest=True)
bld.SAMBA_BINARY('pthreadpooltest_cmocka',
source='tests_cmocka.c',
deps='PTHREADPOOL cmocka',
ldflags='-Wl,--wrap=pthread_create',
enabled=bld.env.WITH_PTHREADPOOL and bld.env['HAVE_LDWRAP'],
install=False)
for_selftest=True)

View File

@ -4,4 +4,4 @@ def configure(conf):
conf.CHECK_FUNCS_IN('openpty', 'util', checklibc=True, headers='pty.h util.h bsd/libutil.h libutil.h')
def build(bld):
bld.SAMBA_BINARY('texpect', 'texpect.c', deps='popt util replace', install=False)
bld.SAMBA_BINARY('texpect', 'texpect.c', deps='popt util replace', for_selftest=True)

View File

@ -269,22 +269,22 @@ else:
source='tests/rfc1738.c',
deps='cmocka replace samba-util',
local_include=False,
install=False)
for_selftest=True)
bld.SAMBA_BINARY('test_ms_fnmatch',
source='tests/test_ms_fnmatch.c',
deps='cmocka replace samba-util',
local_include=False,
install=False)
for_selftest=True)
bld.SAMBA_BINARY('test_talloc_keep_secret',
source='tests/test_talloc_keep_secret.c',
deps='cmocka replace samba-util',
local_include=False,
install=False)
for_selftest=True)
bld.SAMBA_BINARY('test_byteorder',
source='tests/test_byteorder.c',
deps='cmocka replace samba-util',
local_include=False,
install=False)
for_selftest=True)

View File

@ -52,7 +52,7 @@ bld.SAMBA_BINARY(
cmocka
talloc
''',
install=False
for_selftest=True
)
bld.SAMBA_BINARY('test_rc4_passwd_buffer',
@ -62,7 +62,7 @@ bld.SAMBA_BINARY('test_rc4_passwd_buffer',
LIBCLI_AUTH
cmocka
''',
install=False)
for_selftest=True)
bld.SAMBA_BINARY('test_schannel',
source='tests/test_schannel.c',
@ -70,7 +70,7 @@ bld.SAMBA_BINARY('test_schannel',
gensec
cmocka
''',
install=False)
for_selftest=True)
bld.SAMBA_BINARY('test_gnutls',
source='tests/test_gnutls.c',
@ -79,4 +79,4 @@ bld.SAMBA_BINARY('test_gnutls',
cmocka
samba-util
''',
install=False)
for_selftest=True)

View File

@ -9,7 +9,7 @@ bld.SAMBA_BINARY('resolvconftest',
source='resolvconftest.c',
deps='clidns',
enabled=bld.CONFIG_SET('HAVE_FMEMOPEN'),
install=False)
for_selftest=True)
bld.SAMBA_SUBSYSTEM('dns_lookup',
source='dns_lookup.c',
@ -18,4 +18,4 @@ bld.SAMBA_SUBSYSTEM('dns_lookup',
bld.SAMBA_BINARY('dns_lookuptest',
source='dns_lookuptest.c',
deps='dns_lookup',
install=False)
for_selftest=True)

View File

@ -6,15 +6,14 @@ bld.SAMBA_SUBSYSTEM('LIBCLI_DRSUAPI',
public_deps='LIBCLI_AUTH samdb z'
)
if bld.CONFIG_GET('ENABLE_SELFTEST'):
bld.SAMBA_BINARY(
'test_repl_decrypt',
source='tests/test_repl_decrypt.c',
deps='''
LIBCLI_DRSUAPI
cmocka
talloc
''',
install=False,
enabled=bld.AD_DC_BUILD_IS_ENABLED()
)
bld.SAMBA_BINARY(
'test_repl_decrypt',
source='tests/test_repl_decrypt.c',
deps='''
LIBCLI_DRSUAPI
cmocka
talloc
''',
for_selftest=True,
enabled=bld.AD_DC_BUILD_IS_ENABLED()
)

View File

@ -21,7 +21,7 @@ bld.SAMBA_BINARY('nmblookup' + bld.env.suffix4,
source='tools/nmblookup.c',
manpages='man/nmblookup4.1',
deps='samba-hostconfig samba-util cli-nbt popt POPT_SAMBA netif LIBCLI_RESOLVE',
install=False
install=False,
)
bld.SAMBA_PYTHON('python_netbios',

View File

@ -69,4 +69,4 @@ def build(bld):
bld.SAMBA_BINARY('test_smb1cli_session',
source='test_smb1cli_session.c',
deps='cmocka cli_smb_common',
install=False)
for_selftest=True)

View File

@ -14,14 +14,14 @@ bld.SAMBA_LIBRARY('winbind-client',
bld.SAMBA_BINARY('nsstest',
source='nsstest.c',
deps='replace dl',
install=False
for_selftest=True
)
if bld.CONFIG_SET('HAVE_PTHREAD'):
bld.SAMBA_BINARY('stress-nss-libwbclient',
source='stress-nss-libwbclient.c',
deps='wbclient pthread',
install=False
for_selftest=True
)
# The nss_wrapper code relies strictly on the linux implementation and

View File

@ -7,7 +7,7 @@ bld.SAMBA3_SUBSYSTEM('NFS4_ACLS',
bld.SAMBA3_BINARY('test_nfs4_acls',
source='test_nfs4_acls.c',
deps='smbd_base cmocka',
install=False)
for_selftest=True)
bld.SAMBA3_SUBSYSTEM('vfs_acl_common',
source='vfs_acl_common.c',

View File

@ -112,7 +112,7 @@ bld.SAMBA3_BINARY('test_tldap',
smbconf
cmocka
''',
install=False)
for_selftest=True)
# libpdb.so should not expose internal symbols that are only usable
# to the statically linked modules that are merged into libpdb.
@ -207,7 +207,7 @@ bld.SAMBA_BINARY('test_registry_regfio',
source='registry/tests/test_regfio.c',
deps='cmocka samba3-util smbconf REGFIO',
local_include=False,
install=False)
for_selftest=True)
# Do not link against this use 'smbconf'
bld.SAMBA3_SUBSYSTEM('SMBREGISTRY',
@ -1158,7 +1158,7 @@ bld.SAMBA3_BINARY('smbspool_krb5_wrapper',
bld.SAMBA3_BINARY('smbspool_argv_wrapper',
source='script/tests/smbspool_argv_wrapper.c',
install=False)
for_selftest=True)
bld.SAMBA3_BINARY('locktest2',
source='torture/locktest2.c',
@ -1168,7 +1168,7 @@ bld.SAMBA3_BINARY('locktest2',
libsmb
LOCKING
''',
install=False)
for_selftest=True)
bld.SAMBA3_BINARY('smbtorture' + bld.env.suffix3,
source='''
@ -1225,7 +1225,7 @@ bld.SAMBA3_BINARY('smbtorture' + bld.env.suffix3,
samba-cluster-support
''',
cflags='-DWINBINDD_SOCKET_DIR=\"%s\"' % bld.env.WINBINDD_SOCKET_DIR,
install=False)
for_selftest=True)
bld.SAMBA3_BINARY('smbconftort',
source='lib/smbconf/testsuite.c',
@ -1234,7 +1234,7 @@ bld.SAMBA3_BINARY('smbconftort',
smbconf
popt_samba3
''',
install=False)
for_selftest=True)
bld.SAMBA3_BINARY('msgtest',
source='torture/msgtest.c',
@ -1276,7 +1276,7 @@ bld.SAMBA3_BINARY('test_mdsparser_es',
popt_samba3_cmdline
''',
enabled=bld.env.spotlight_backend_es,
install=False)
for_selftest=True)
bld.SAMBA3_BINARY('pdbtest',
source='torture/pdbtest.c',
@ -1287,7 +1287,7 @@ bld.SAMBA3_BINARY('pdbtest',
AUTH_COMMON
auth
''',
install=False)
for_selftest=True)
bld.SAMBA3_BINARY('vfstest',
source='''
@ -1301,7 +1301,7 @@ bld.SAMBA3_BINARY('vfstest',
smbconf
SMBREADLINE
''',
install=False)
for_selftest=True)
bld.SAMBA3_BINARY('versiontest',
source='lib/version_test.c',
@ -1313,7 +1313,7 @@ bld.SAMBA3_BINARY('versiontest',
bld.SAMBA3_BINARY('timelimit',
source='script/tests/timelimit.c',
install=False)
for_selftest=True)
bld.SAMBA3_BINARY('rpc_open_tcp',
source='torture/rpc_open_tcp.c',
@ -1321,7 +1321,7 @@ bld.SAMBA3_BINARY('rpc_open_tcp',
talloc
msrpc3
''',
install=False)
for_selftest=True)
bld.SAMBA3_BINARY('vlp',
source='printing/tests/vlp.c',
@ -1329,7 +1329,7 @@ bld.SAMBA3_BINARY('vlp',
talloc
smbconf
''',
install=False)
for_selftest=True)
pyrpc_util = bld.pyembed_libname('pyrpc_util')
@ -1380,7 +1380,7 @@ bld.SAMBA3_BINARY('tevent_glib_glue_test',
popt_samba3
tevent-glib-glue''',
enabled=bld.CONFIG_SET('WITH_TEVENT_GLIB_GLUE'),
install=False)
for_selftest=True)
bld.SAMBA3_BINARY('tevent_glib_tracker',
source='utils/async-tracker.c',

View File

@ -46,7 +46,7 @@ bld.SAMBA_BINARY('test_kerberos',
source='tests/kerberos.c',
deps='cmocka authkrb5 krb5samba com_err CREDENTIALS_KRB5',
local_include=False,
install=False
for_selftest=True
)
pytalloc_util = bld.pyembed_libname('pytalloc-util')

View File

@ -27,7 +27,7 @@ bld.SAMBA_BINARY('test_unique_object_sids',
cmocka
DSDB_MODULE_HELPERS
''',
install=False)
for_selftest=True)
bld.SAMBA_BINARY('test_encrypted_secrets_tdb',
source='tests/test_encrypted_secrets.c',
cflags='-DTEST_BE=\"tdb\"',
@ -40,7 +40,7 @@ bld.SAMBA_BINARY('test_encrypted_secrets_tdb',
gnutls
DSDB_MODULE_HELPERS
''',
install=False)
for_selftest=True)
if conf.env.HAVE_LMDB:
bld.SAMBA_BINARY('test_encrypted_secrets_mdb',
source='tests/test_encrypted_secrets.c',
@ -54,7 +54,7 @@ if conf.env.HAVE_LMDB:
gnutls
DSDB_MODULE_HELPERS
''',
install=False)
for_selftest=True)
if bld.AD_DC_BUILD_IS_ENABLED():
bld.PROCESS_SEPARATE_RULE("server")

View File

@ -21,7 +21,7 @@ bld.SAMBA_BINARY('test_audit_util',
audit_logging
DSDB_MODULE_HELPERS
''',
install=False)
for_selftest=True)
bld.SAMBA_BINARY('test_audit_log',
source='tests/test_audit_log.c',
@ -35,7 +35,7 @@ bld.SAMBA_BINARY('test_audit_log',
DSDB_MODULE_HELPERS
DSDB_MODULE_HELPERS_AUDIT
''',
install=False)
for_selftest=True)
bld.SAMBA_BINARY('test_audit_log_errors',
source='tests/test_audit_log_errors.c',
@ -54,7 +54,7 @@ bld.SAMBA_BINARY('test_audit_log_errors',
-Wl,--wrap,json_add_version
-Wl,--wrap,json_add_timestamp
''',
install=False)
for_selftest=True)
bld.SAMBA_BINARY('test_group_audit',
source='tests/test_group_audit.c',
@ -68,7 +68,7 @@ bld.SAMBA_BINARY('test_group_audit',
DSDB_MODULE_HELPERS
DSDB_MODULE_HELPERS_AUDIT
''',
install=False)
for_selftest=True)
bld.SAMBA_BINARY('test_group_audit_errors',
source='tests/test_group_audit_errors.c',
@ -87,7 +87,7 @@ bld.SAMBA_BINARY('test_group_audit_errors',
-Wl,--wrap,json_add_version
-Wl,--wrap,json_add_timestamp
''',
install=False)
for_selftest=True)
bld.SAMBA_MODULE('ldb_samba_dsdb',
source='samba_dsdb.c',

View File

@ -167,16 +167,15 @@ bld.SAMBA_MODULE('service_dcerpc',
deps='dcerpc_server'
)
if bld.CONFIG_GET('ENABLE_SELFTEST'):
bld.SAMBA_BINARY(
'test_rpc_dns_server_dnsutils',
source='tests/rpc_dns_server_dnsutils_test.c',
deps='''
bld.SAMBA_BINARY(
'test_rpc_dns_server_dnsutils',
source='tests/rpc_dns_server_dnsutils_test.c',
deps='''
dnsserver_common
dcerpc_server
cmocka
talloc
''',
install=False,
enabled=bld.AD_DC_BUILD_IS_ENABLED()
)
''',
for_selftest=True,
enabled=bld.AD_DC_BUILD_IS_ENABLED()
)