libcli/dns/cmocka-tests waf scripting
Dimitris Gravanis
dimgrav at gmail.com
Sat Aug 19 15:26:23 UTC 2017
Hi,
In my Samba fork
<https://github.com/dimgrav/samba/tree/master/libcli/dns>, in
libcli/dns/cmocka-tests/, I've written a wscript to configure and build
the unit tests in the directory. The script is attached below.
Running |wax configure| completes successfully, |wax build| results in
this error:
|AttributeError: 'BuildContext' object has no attribute 'SAMBA_BINARY'|
The wscript_build in libcli/dns (top level) is:
|bld.SAMBA_SUBSYSTEM('clidns',||
|| source='cli_dns.c',||
|| public_deps='LIBTSOCKET tevent-util')|
Can anyone help me fix the script to properly use SAMBA_BINARY as an
object attribute? I looked into testsuites/unittests/ and The Waf Book
to figure out Waf scripting for cmocka unit tests, I've also gone
through top level wscript and wscript_build scripts, as well as almost
every other in Samba, I believe I have understood the recursive building
concept well enough, but obviously I lack significant background in Waf
and its Samba implementations :).
Cheers,
Dimitris
--
Δ. Γραβάνης | D. Gravanis
-------------- next part --------------
#!/usr/bin/env python
import os
APPNAME = 'DNS Client Tests'
top = '.'
out = 'build-tests'
# configuration options
def options(opt):
opt.get_option_group('configure options')
# configures and builds test suites for cmocka-tests
def configure(conf):
print('prefix set to: ' + conf.options.prefix)
print('src dir (blank: default): ' + conf.options.top)
print('bld dir (blank: default): ' + conf.options.out)
print('configuring test suites in build dir...')
return
def build(bld):
print('building cli_crypto_test...')
bld.SAMBA_BINARY('cli_crypto_test',
source='cli_crypto_test.c',
deps='LIBTSOCKET tevent-util cmocka',
install=False)
print('building dns_tcp_test...')
bld.SAMBA_BINARY('dns_tcp_test',
source='dns_tcp_test.c',
deps='LIBTSOCKET tevent-util cmocka',
install=False)
print('building dns_udp_test...')
bld.SAMBA_BINARY('dns_udp_test',
source='dns_udp_test.c',
deps='LIBTSOCKET tevent-util cmocka',
install=False)
# builds the combined client test (not yet implemented)
'''
bld.SAMBA_BINARY('client_tests',
source='cli_tests.c',
deps='LIBTSOCKET tevent-util cmocka',
install=False)
'''
print('DONE')
# creates tarball
def dist(ctx):
ctx.base_name = 'libcli-dns-tests'
ctx.algo = 'tar.gz'
ctx.excl = '**/wscript'
More information about the samba-technical
mailing list