From: Wouter Wijngaards Date: Thu, 2 Apr 2009 14:44:57 +0000 (+0000) Subject: unit test for python module. X-Git-Tag: release-1.3.0~42 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1fa1c9d1b1bf6aaa0210629809c7a4c1247ed6f6;p=thirdparty%2Funbound.git unit test for python module. git-svn-id: file:///svn/unbound/trunk@1581 be551aaa-1e26-0410-a405-d3ace91eadb9 --- diff --git a/Makefile.in b/Makefile.in index 8e34e8a93..7338a2cd5 100644 --- a/Makefile.in +++ b/Makefile.in @@ -293,6 +293,7 @@ libunbound/python/libunbound_wrap.c: $(srcdir)/libunbound/python/libunbound.i $( $(INFO) Swig $< $Q$(SWIG) -python -o $@ $(CPPFLAGS) $< +all: _unbound.la _unbound.la: $(BUILD)libunbound/python/libunbound_wrap.lo libunbound.la $(INFO) Link $@ $Q$(LIBTOOL) --tag=CC --mode=link $(strip $(CC) $(RUNTIME_PATH) $(CFLAGS) $(LDFLAGS) -module -version-number @LIBUNBOUND_CURRENT@:@LIBUNBOUND_REVISION@:@LIBUNBOUND_AGE@ -no-undefined) -o $@ $< -rpath $(PYTHON_SITE_PKG) L. -L.libs -lunbound $(LIBS) diff --git a/doc/Changelog b/doc/Changelog index d146c8442..ccc38affb 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -5,6 +5,7 @@ - fixed bug in unbound-control flush_zone where it would not flush every message in the target domain. This especially impacted NXDOMAIN messages which could remain in the cache regardless. + - python module test package. 1 April 2009: Wouter - suppress errors when trying to contact authority servers that gave diff --git a/pythonmod/interface.i b/pythonmod/interface.i index 0343f7dba..dbf240938 100644 --- a/pythonmod/interface.i +++ b/pythonmod/interface.i @@ -165,11 +165,11 @@ struct query_info { __swig_getmethods__["qclass_str"] = _get_qclass_str if _newclass:qclass_str = _swig_property(_get_qclass_str) - __swig_getmethods__["qname"] = _Unbound._get_qname - if _newclass:qname = _swig_property(_Unbound._get_qname) + __swig_getmethods__["qname"] = _unboundmodule._get_qname + if _newclass:qname = _swig_property(_unboundmodule._get_qname) - __swig_getmethods__["qname_list"] = _Unbound._get_qname_components - if _newclass:qname_list = _swig_property(_Unbound._get_qname_components) + __swig_getmethods__["qname_list"] = _unboundmodule._get_qname_components + if _newclass:qname_list = _swig_property(_unboundmodule._get_qname_components) def _get_qname_str(self): return dnameAsStr(self.qname) __swig_getmethods__["qname_str"] = _get_qname_str @@ -209,19 +209,19 @@ uint16_t ntohs(uint16_t netshort); %extend packed_rrset_key { %pythoncode %{ - def _get_type_str(self): return ldns_rr_type2str(_Unbound.ntohs(self.type)) + def _get_type_str(self): return ldns_rr_type2str(_unboundmodule.ntohs(self.type)) __swig_getmethods__["type_str"] = _get_type_str if _newclass:type_str = _swig_property(_get_type_str) - def _get_class_str(self): return ldns_rr_class2str(_Unbound.ntohs(self.rrset_class)) + def _get_class_str(self): return ldns_rr_class2str(_unboundmodule.ntohs(self.rrset_class)) __swig_getmethods__["rrset_class_str"] = _get_class_str if _newclass:rrset_class_str = _swig_property(_get_class_str) - __swig_getmethods__["dname"] = _Unbound._get_dname - if _newclass:dname = _swig_property(_Unbound._get_dname) + __swig_getmethods__["dname"] = _unboundmodule._get_dname + if _newclass:dname = _swig_property(_unboundmodule._get_dname) - __swig_getmethods__["dname_list"] = _Unbound._get_dname_components - if _newclass:dname_list = _swig_property(_Unbound._get_dname_components) + __swig_getmethods__["dname_list"] = _unboundmodule._get_dname_components + if _newclass:dname_list = _swig_property(_unboundmodule._get_dname_components) def _get_dname_str(self): return dnameAsStr(self.dname) __swig_getmethods__["dname_str"] = _get_dname_str @@ -272,16 +272,16 @@ struct packed_rrset_data { %pythoncode %{ class RRSetData_RRLen: def __init__(self, obj): self.obj = obj - def __getitem__(self, index): return _Unbound._get_data_rr_len(self.obj, index) + def __getitem__(self, index): return _unboundmodule._get_data_rr_len(self.obj, index) def __len__(self): return obj.count + obj.rrsig_count class RRSetData_RRTTL: def __init__(self, obj): self.obj = obj - def __getitem__(self, index): return _Unbound._get_data_rr_ttl(self.obj, index) - def __setitem__(self, index, value): _Unbound._set_data_rr_ttl(self.obj, index, value) + def __getitem__(self, index): return _unboundmodule._get_data_rr_ttl(self.obj, index) + def __setitem__(self, index, value): _unboundmodule._set_data_rr_ttl(self.obj, index, value) def __len__(self): return obj.count + obj.rrsig_count class RRSetData_RRData: def __init__(self, obj): self.obj = obj - def __getitem__(self, index): return _Unbound._get_data_rr_data(self.obj, index) + def __getitem__(self, index): return _unboundmodule._get_data_rr_data(self.obj, index) def __len__(self): return obj.count + obj.rrsig_count %} @@ -364,12 +364,12 @@ struct dns_msg { %pythoncode %{ class ReplyInfo_RRSet: def __init__(self, obj): self.obj = obj - def __getitem__(self, index): return _Unbound._rrset_rrsets_get(self.obj, index) + def __getitem__(self, index): return _unboundmodule._rrset_rrsets_get(self.obj, index) def __len__(self): return obj.rrset_count class ReplyInfo_Ref: def __init__(self, obj): self.obj = obj - def __getitem__(self, index): return _Unbound._rrset_ref_get(self.obj, index) + def __getitem__(self, index): return _unboundmodule._rrset_ref_get(self.obj, index) def __len__(self): return obj.rrset_count %} @@ -460,10 +460,10 @@ struct module_qstate { class ExtState: def __init__(self, obj): self.obj = obj def __str__(self): - return ", ".join([_Unbound.strextstate(_Unbound._ext_state_get(self.obj,a)) for a in range(0, _Unbound.MODULE_COUNT)]) - def __getitem__(self, index): return _Unbound._ext_state_get(self.obj, index) - def __setitem__(self, index, value): _Unbound._ext_state_set(self.obj, index, value) - def __len__(self): return _Unbound.MODULE_COUNT + return ", ".join([_unboundmodule.strextstate(_unboundmodule._ext_state_get(self.obj,a)) for a in range(0, _unboundmodule.MODULE_COUNT)]) + def __getitem__(self, index): return _unboundmodule._ext_state_get(self.obj, index) + def __setitem__(self, index, value): _unboundmodule._ext_state_set(self.obj, index, value) + def __len__(self): return _unboundmodule.MODULE_COUNT %} %inline %{ @@ -485,7 +485,7 @@ struct module_qstate { %pythoncode %{ def set_ext_state(self, id, state): """Sets the ext state""" - _Unbound._ext_state_set(self, id, state) + _unboundmodule._ext_state_set(self, id, state) def __ext_state_get(self): return ExtState(self) __swig_getmethods__["ext_state"] = __ext_state_get @@ -770,7 +770,7 @@ int set_return_msg(struct module_qstate* qstate, def set_return_msg(self, qstate): """Returns 1 if OK""" - status = _Unbound.set_return_msg(qstate, self.rr_name, self.rr_type, self.rr_class, + status = _unboundmodule.set_return_msg(qstate, self.rr_name, self.rr_type, self.rr_class, self.query_flags, self.default_ttl, self.question, self.answer, self.authority, self.additional) diff --git a/smallapp/unbound-checkconf.c b/smallapp/unbound-checkconf.c index b6dc02e03..af5a346a4 100644 --- a/smallapp/unbound-checkconf.c +++ b/smallapp/unbound-checkconf.c @@ -495,11 +495,14 @@ morechecks(struct config_file* cfg, const char* fname) free(cfg->chrootdir); cfg->chrootdir = NULL; - if(strcmp(cfg->module_conf, "iterator") != 0 && - strcmp(cfg->module_conf, "validator iterator") != 0 && - strcmp(cfg->module_conf, "python iterator") != 0 && - strcmp(cfg->module_conf, "python validator iterator") != 0 && - strcmp(cfg->module_conf, "validator python iterator") != 0) { + if(strcmp(cfg->module_conf, "iterator") != 0 + && strcmp(cfg->module_conf, "validator iterator") != 0 +#ifdef WITH_PYTHONMODULE + && strcmp(cfg->module_conf, "python iterator") != 0 + && strcmp(cfg->module_conf, "python validator iterator") != 0 + && strcmp(cfg->module_conf, "validator python iterator") != 0 +#endif + ) { fatal_exit("module conf '%s' is not known to work", cfg->module_conf); } diff --git a/testdata/pymod.tpkg b/testdata/pymod.tpkg new file mode 100644 index 000000000..7361ffe1c Binary files /dev/null and b/testdata/pymod.tpkg differ