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
c34ec003b7d45aa4196ff93a0ac29694b25e5309
and
da87fa998ab71328f30bcdf5b41aee8675aee48a, 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
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
bld.SAMBA_BINARY('async_connect_send_test',
source='async_connect_send_test.c',
deps='LIBASYNC_REQ',
- install=False
+ for_selftest=True
)
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',
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',
samba-util
LIBTSOCKET
''',
- install=False,
+ for_selftest=True,
ldflags='''
-Wl,--wrap,json_object_set_new
-Wl,--wrap,json_object_update
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)
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)
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)
cmocka
talloc
''',
- install=False
+ for_selftest=True
)
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',
gensec
cmocka
''',
- install=False)
+ for_selftest=True)
bld.SAMBA_BINARY('test_gnutls',
source='tests/test_gnutls.c',
cmocka
samba-util
''',
- install=False)
+ for_selftest=True)
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',
bld.SAMBA_BINARY('dns_lookuptest',
source='dns_lookuptest.c',
deps='dns_lookup',
- install=False)
+ for_selftest=True)
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()
+)
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',
bld.SAMBA_BINARY('test_smb1cli_session',
source='test_smb1cli_session.c',
deps='cmocka cli_smb_common',
- install=False)
+ for_selftest=True)
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
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',
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.
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',
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',
libsmb
LOCKING
''',
- install=False)
+ for_selftest=True)
bld.SAMBA3_BINARY('smbtorture' + bld.env.suffix3,
source='''
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',
smbconf
popt_samba3
''',
- install=False)
+ for_selftest=True)
bld.SAMBA3_BINARY('msgtest',
source='torture/msgtest.c',
popt_samba3_cmdline
''',
enabled=bld.env.spotlight_backend_es,
- install=False)
+ for_selftest=True)
bld.SAMBA3_BINARY('pdbtest',
source='torture/pdbtest.c',
AUTH_COMMON
auth
''',
- install=False)
+ for_selftest=True)
bld.SAMBA3_BINARY('vfstest',
source='''
smbconf
SMBREADLINE
''',
- install=False)
+ for_selftest=True)
bld.SAMBA3_BINARY('versiontest',
source='lib/version_test.c',
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',
talloc
msrpc3
''',
- install=False)
+ for_selftest=True)
bld.SAMBA3_BINARY('vlp',
source='printing/tests/vlp.c',
talloc
smbconf
''',
- install=False)
+ for_selftest=True)
pyrpc_util = bld.pyembed_libname('pyrpc_util')
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',
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')
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\"',
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',
gnutls
DSDB_MODULE_HELPERS
''',
- install=False)
+ for_selftest=True)
if bld.AD_DC_BUILD_IS_ENABLED():
bld.PROCESS_SEPARATE_RULE("server")
audit_logging
DSDB_MODULE_HELPERS
''',
- install=False)
+ for_selftest=True)
bld.SAMBA_BINARY('test_audit_log',
source='tests/test_audit_log.c',
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',
-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',
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',
-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',
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()
+)