1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-01 04:58:35 +03:00

tevent: add support for cmocka unit tests

This adds a placeholder for new cmocka tests for tevent. Tests
are added in individual commits.

Signed-off-by: Pavel Březina <pbrezina@redhat.com>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
This commit is contained in:
Pavel Březina 2021-06-03 13:05:46 +02:00 committed by Andreas Schneider
parent 740a217264
commit 5203e70ada

View File

@ -15,9 +15,12 @@ out = 'bin'
import wafsamba
from wafsamba import samba_dist, samba_utils
from waflib import Options, Logs, Context
from waflib import Options, Logs, Context, Errors
samba_dist.DIST_DIRS('lib/tevent:. lib/replace:lib/replace lib/talloc:lib/talloc buildtools:buildtools third_party/waf:third_party/waf')
samba_dist.DIST_DIRS('''lib/tevent:. lib/replace:lib/replace
lib/talloc:lib/talloc buildtools:buildtools
third_party/cmocka:third_party/cmocka
third_party/waf:third_party/waf''')
def options(opt):
opt.BUILTIN_DEFAULT('replace')
@ -30,6 +33,14 @@ def configure(conf):
conf.RECURSE('lib/replace')
conf.RECURSE('lib/talloc')
if conf.CHECK_FOR_THIRD_PARTY():
conf.RECURSE('third_party/cmocka')
else:
if not conf.CHECK_CMOCKA():
raise Errors.WafError('cmocka development package have not been found.\nIf third_party is installed, check that it is in the proper place.')
else:
conf.define('USING_SYSTEM_CMOCKA', 1)
conf.env.standalone_tevent = conf.IN_LAUNCH_DIR()
if not conf.env.standalone_tevent:
@ -71,6 +82,9 @@ def build(bld):
bld.RECURSE('lib/replace')
bld.RECURSE('lib/talloc')
if bld.CHECK_FOR_THIRD_PARTY():
bld.RECURSE('third_party/cmocka')
SRC = '''tevent.c tevent_debug.c tevent_fd.c tevent_immediate.c
tevent_queue.c tevent_req.c tevent_wrapper.c
tevent_poll.c tevent_threads.c
@ -130,8 +144,17 @@ def test(ctx):
samba_utils.ADD_LD_LIBRARY_PATH('bin/shared/private')
pyret = samba_utils.RUN_PYTHON_TESTS(['bindings.py'])
sys.exit(pyret)
unit_test_ret = 0
unit_tests = [
]
for unit_test in unit_tests:
unit_test_cmd = os.path.join(Context.g_module.out, unit_test)
unit_test_ret = unit_test_ret or samba_utils.RUN_COMMAND(unit_test_cmd)
sys.exit(pyret or unit_test_ret)
def dist():
'''makes a tarball for distribution'''