build: Do not build selftest binaries for builds without --enable-selftest
authorAndrew Bartlett <abartlet@samba.org>
Thu, 21 Nov 2019 21:06:57 +0000 (10:06 +1300)
committerIsaac Boukris <iboukris@sn-devel-184>
Fri, 22 Nov 2019 11:48:59 +0000 (11:48 +0000)
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

18 files changed:
buildtools/wafsamba/wafsamba.py
lib/async_req/wscript_build
lib/audit_logging/wscript_build
lib/pthreadpool/wscript_build
lib/texpect/wscript
lib/util/wscript_build
libcli/auth/wscript_build
libcli/dns/wscript_build
libcli/drsuapi/wscript_build
libcli/nbt/wscript_build
libcli/smb/wscript
nsswitch/wscript_build
source3/modules/wscript_build
source3/wscript_build
source4/auth/wscript_build
source4/dsdb/samdb/ldb_modules/wscript_build
source4/dsdb/samdb/ldb_modules/wscript_build_server
source4/rpc_server/wscript_build

index 7460fbae020a657ac9670cd3f1b9de511badd74c..5bbcc156fe78fcb334ded567e469e19d362c7a88 100644 (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
index bf79fdd24d164ebf7164e240d20ce1b803102a6b..4486a5b2f06e1d238a2c0505f87609102d0b4878 100644 (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
 )
index 4811e056b72cd1acb5c2d28086c5c87c802536fa..125c94bad90fcdf87af3a00f22c6586f2a4f4898 100644 (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
index 70aa7cbf04198cf245e998f47d086183da20382e..e270f90333f0861f2965d09586b2bf7817c9a170 100644 (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)
index e14c048483f5818348c9912127a2d9b7aa1d711e..aaa3104f1edf03962d8280d29d39bfeba782b4c4 100644 (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)
index 7d446d810d15290751eda46f310b046466684d5b..3a80b93b2c7f2507462444a69e9e4052b150b900 100644 (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)
index f1d513e6449e9265538edb13c1c280a89d948313..c99ea4464afe0899dd49c8fb79118a25fe38452e 100644 (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)
index ea745c1402812069f2c6c22279d6279e74c9c463..2d90aa7ec0ffbe87babb60c42ae05e5817628fb7 100644 (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)
index 271248215be5702f3b059605623ca6e810860020..1aee095130cda506355147aa641916c242402764 100644 (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()
+)
index 090789ce99a9185ed24acf1d6aab5c72be1ed12a..15610765268eb7270fe4be3ea1cad5828c5322ab 100644 (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',
index 2fad5ee37c3d68e2cb49a6d685403b4854391350..66c2b9b7e709bda43416e159475a14edb5c0b804 100644 (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)
index 861ed2f23bf41d9f1082e0a93dfb14fc20878dcb..b754c1684253ae995de3b0aa487008be2b1c545a 100644 (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
index e4f92fac150867f3410a43d7692409340d92421b..cb0c083fcc8fb1ce908fcf0dfa807a2943d80b6c 100644 (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',
index 1cf734fe4c76f111457e743c96c6f1cf88b18629..8d0cc66f9413fdabdb23b872dff8bd66c478d56d 100644 (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',
index daf5c8a422d5ae9d1da28d1bacb9d46819834a50..381a7b19bf09f1979caf6bd79338c0f29ea37fe9 100644 (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')
index 89629ab1cb8d9bb4e8cc39fefd1354c1bf47f1bc..c3e8b54f0bae7eaf51700d81b0a89dd1ddf897eb 100644 (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")
index 2eec7c4fa7d8b66b0502b9b977aa93e3692eb5be..4d0febc715298f89df870c19ad3df44444493c3a 100644 (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',
index 8d896c1722ffd800eb87581193c2add5dd8cb67a..186e6a269e5665e7f9056954c30d2d59fca7ea3a 100644 (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()
+)