Skip to content

Commit

Permalink
build: Do not build selftest binaries for builds without --enable-sel…
Browse files Browse the repository at this point in the history
…ftest

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 c34ec00
and da87fa9, 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 <[email protected]>
Reviewed-by: Isaac Boukris <[email protected]>

Autobuild-User(master): Isaac Boukris <[email protected]>
Autobuild-Date(master): Fri Nov 22 11:48:59 UTC 2019 on sn-devel-184
  • Loading branch information
abartlet authored and Isaac Boukris committed Nov 22, 2019
1 parent f894753 commit 6107c79
Show file tree
Hide file tree
Showing 18 changed files with 69 additions and 67 deletions.
6 changes: 5 additions & 1 deletion buildtools/wafsamba/wafsamba.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/async_req/wscript_build
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
8 changes: 4 additions & 4 deletions lib/audit_logging/wscript_build
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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',
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions lib/pthreadpool/wscript_build
Original file line number Diff line number Diff line change
Expand Up @@ -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)
2 changes: 1 addition & 1 deletion lib/texpect/wscript
Original file line number Diff line number Diff line change
Expand Up @@ -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)
8 changes: 4 additions & 4 deletions lib/util/wscript_build
Original file line number Diff line number Diff line change
Expand Up @@ -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)
8 changes: 4 additions & 4 deletions libcli/auth/wscript_build
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ bld.SAMBA_BINARY(
cmocka
talloc
''',
install=False
for_selftest=True
)

bld.SAMBA_BINARY('test_rc4_passwd_buffer',
Expand All @@ -62,15 +62,15 @@ 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',
deps='''
gensec
cmocka
''',
install=False)
for_selftest=True)

bld.SAMBA_BINARY('test_gnutls',
source='tests/test_gnutls.c',
Expand All @@ -79,4 +79,4 @@ bld.SAMBA_BINARY('test_gnutls',
cmocka
samba-util
''',
install=False)
for_selftest=True)
4 changes: 2 additions & 2 deletions libcli/dns/wscript_build
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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)
23 changes: 11 additions & 12 deletions libcli/drsuapi/wscript_build
Original file line number Diff line number Diff line change
Expand Up @@ -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()
)
2 changes: 1 addition & 1 deletion libcli/nbt/wscript_build
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion libcli/smb/wscript
Original file line number Diff line number Diff line change
Expand Up @@ -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)
4 changes: 2 additions & 2 deletions nsswitch/wscript_build
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion source3/modules/wscript_build
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
26 changes: 13 additions & 13 deletions source3/wscript_build
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand All @@ -1168,7 +1168,7 @@ bld.SAMBA3_BINARY('locktest2',
libsmb
LOCKING
''',
install=False)
for_selftest=True)

bld.SAMBA3_BINARY('smbtorture' + bld.env.suffix3,
source='''
Expand Down Expand Up @@ -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',
Expand All @@ -1234,7 +1234,7 @@ bld.SAMBA3_BINARY('smbconftort',
smbconf
popt_samba3
''',
install=False)
for_selftest=True)

bld.SAMBA3_BINARY('msgtest',
source='torture/msgtest.c',
Expand Down Expand Up @@ -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',
Expand All @@ -1287,7 +1287,7 @@ bld.SAMBA3_BINARY('pdbtest',
AUTH_COMMON
auth
''',
install=False)
for_selftest=True)

bld.SAMBA3_BINARY('vfstest',
source='''
Expand All @@ -1301,7 +1301,7 @@ bld.SAMBA3_BINARY('vfstest',
smbconf
SMBREADLINE
''',
install=False)
for_selftest=True)

bld.SAMBA3_BINARY('versiontest',
source='lib/version_test.c',
Expand All @@ -1313,23 +1313,23 @@ 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',
deps='''
talloc
msrpc3
''',
install=False)
for_selftest=True)

bld.SAMBA3_BINARY('vlp',
source='printing/tests/vlp.c',
deps='''
talloc
smbconf
''',
install=False)
for_selftest=True)


pyrpc_util = bld.pyembed_libname('pyrpc_util')
Expand Down Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion source4/auth/wscript_build
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
6 changes: 3 additions & 3 deletions source4/dsdb/samdb/ldb_modules/wscript_build
Original file line number Diff line number Diff line change
Expand Up @@ -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\"',
Expand All @@ -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',
Expand All @@ -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")
Loading

0 comments on commit 6107c79

Please sign in to comment.