]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
unit test for python module.
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Thu, 2 Apr 2009 14:44:57 +0000 (14:44 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Thu, 2 Apr 2009 14:44:57 +0000 (14:44 +0000)
git-svn-id: file:///svn/unbound/trunk@1581 be551aaa-1e26-0410-a405-d3ace91eadb9

Makefile.in
doc/Changelog
pythonmod/interface.i
smallapp/unbound-checkconf.c
testdata/pymod.tpkg [new file with mode: 0644]

index 8e34e8a93711a1903c16f6b938311163f0e8768a..7338a2cd512e3eadc79c3e69686565059e30fb3c 100644 (file)
@@ -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)
index d146c8442a0e4da99dcf69c8bd22121d0bcc384f..ccc38affbe68b0ed6702033c6fdee83d410219a1 100644 (file)
@@ -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
index 0343f7dba8293ec0d07955a74845ed32961fa411..dbf240938f64441c2dc7f817d6ed456ffde6ab50 100644 (file)
@@ -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)
 
index b6dc02e0318b6b30a50040820eae7c12977fc1cd..af5a346a43b38a894e411cc543a6dd253f77fee7 100644 (file)
@@ -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 (file)
index 0000000..7361ffe
Binary files /dev/null and b/testdata/pymod.tpkg differ