| OLD | NEW |
| 1 #!/usr/bin/python -u | 1 #!/usr/bin/python -u |
| 2 # | 2 # |
| 3 # generate a tester program for the API | 3 # generate a tester program for the API |
| 4 # | 4 # |
| 5 import sys | 5 import sys |
| 6 import os | 6 import os |
| 7 import string | 7 import string |
| 8 try: | 8 try: |
| 9 import libxml2 | 9 import libxml2 |
| 10 except: | 10 except: |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 # These functions have side effects on the global state | 167 # These functions have side effects on the global state |
| 168 # and hence generate errors on memory allocation tests | 168 # and hence generate errors on memory allocation tests |
| 169 # | 169 # |
| 170 skipped_memcheck = [ "xmlLoadCatalog", "xmlAddEncodingAlias", | 170 skipped_memcheck = [ "xmlLoadCatalog", "xmlAddEncodingAlias", |
| 171 "xmlSchemaInitTypes", "xmlNanoFTPProxy", "xmlNanoFTPScanProxy", | 171 "xmlSchemaInitTypes", "xmlNanoFTPProxy", "xmlNanoFTPScanProxy", |
| 172 "xmlNanoHTTPScanProxy", "xmlResetLastError", "xmlCatalogConvert", | 172 "xmlNanoHTTPScanProxy", "xmlResetLastError", "xmlCatalogConvert", |
| 173 "xmlCatalogRemove", "xmlLoadCatalogs", "xmlCleanupCharEncodingHandlers", | 173 "xmlCatalogRemove", "xmlLoadCatalogs", "xmlCleanupCharEncodingHandlers", |
| 174 "xmlInitCharEncodingHandlers", "xmlCatalogCleanup", | 174 "xmlInitCharEncodingHandlers", "xmlCatalogCleanup", |
| 175 "xmlSchemaGetBuiltInType", | 175 "xmlSchemaGetBuiltInType", |
| 176 "htmlParseFile", "htmlCtxtReadFile", # loads the catalogs | 176 "htmlParseFile", "htmlCtxtReadFile", # loads the catalogs |
| 177 "xmlTextReaderSchemaValidate", "xmlSchemaCleanupTypes" # initialize the schem
as type system | 177 "xmlTextReaderSchemaValidate", "xmlSchemaCleanupTypes", # initialize the sche
mas type system |
| 178 "xmlCatalogResolve", "xmlIOParseDTD" # loads the catalogs |
| 178 ] | 179 ] |
| 179 | 180 |
| 180 # | 181 # |
| 181 # Extra code needed for some test cases | 182 # Extra code needed for some test cases |
| 182 # | 183 # |
| 183 extra_pre_call = { | 184 extra_pre_call = { |
| 184 "xmlSAXUserParseFile": """ | 185 "xmlSAXUserParseFile": """ |
| 185 #ifdef LIBXML_SAX1_ENABLED | 186 #ifdef LIBXML_SAX1_ENABLED |
| 186 if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL; | 187 if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL; |
| 187 #endif | 188 #endif |
| (...skipping 12 matching lines...) Expand all Loading... |
| 200 #ifdef LIBXML_SAX1_ENABLED | 201 #ifdef LIBXML_SAX1_ENABLED |
| 201 if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL; | 202 if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL; |
| 202 #endif | 203 #endif |
| 203 """, | 204 """, |
| 204 "xmlParserInputBufferCreateFd": | 205 "xmlParserInputBufferCreateFd": |
| 205 "if (fd >= 0) fd = -1;", | 206 "if (fd >= 0) fd = -1;", |
| 206 } | 207 } |
| 207 extra_post_call = { | 208 extra_post_call = { |
| 208 "xmlAddChild": | 209 "xmlAddChild": |
| 209 "if (ret_val == NULL) { xmlFreeNode(cur) ; cur = NULL ; }", | 210 "if (ret_val == NULL) { xmlFreeNode(cur) ; cur = NULL ; }", |
| 211 "xmlAddEntity": |
| 212 "if (ret_val != NULL) { xmlFreeNode(ret_val) ; ret_val = NULL; }", |
| 210 "xmlAddChildList": | 213 "xmlAddChildList": |
| 211 "if (ret_val == NULL) { xmlFreeNodeList(cur) ; cur = NULL ; }", | 214 "if (ret_val == NULL) { xmlFreeNodeList(cur) ; cur = NULL ; }", |
| 212 "xmlAddSibling": | 215 "xmlAddSibling": |
| 213 "if (ret_val == NULL) { xmlFreeNode(elem) ; elem = NULL ; }", | 216 "if (ret_val == NULL) { xmlFreeNode(elem) ; elem = NULL ; }", |
| 214 "xmlAddNextSibling": | 217 "xmlAddNextSibling": |
| 215 "if (ret_val == NULL) { xmlFreeNode(elem) ; elem = NULL ; }", | 218 "if (ret_val == NULL) { xmlFreeNode(elem) ; elem = NULL ; }", |
| 216 "xmlAddPrevSibling": | 219 "xmlAddPrevSibling": |
| 217 "if (ret_val == NULL) { xmlFreeNode(elem) ; elem = NULL ; }", | 220 "if (ret_val == NULL) { xmlFreeNode(elem) ; elem = NULL ; }", |
| 218 "xmlDocSetRootElement": | 221 "xmlDocSetRootElement": |
| 219 "if (doc == NULL) { xmlFreeNode(root) ; root = NULL ; }", | 222 "if (doc == NULL) { xmlFreeNode(root) ; root = NULL ; }", |
| (...skipping 30 matching lines...) Expand all Loading... |
| 250 "xmlCopyNamespaceList": "if (ret_val != NULL) xmlFreeNsList(ret_val);", | 253 "xmlCopyNamespaceList": "if (ret_val != NULL) xmlFreeNsList(ret_val);", |
| 251 "xmlNewTextWriter": "if (ret_val != NULL) out = NULL;", | 254 "xmlNewTextWriter": "if (ret_val != NULL) out = NULL;", |
| 252 "xmlNewTextWriterPushParser": "if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ct
xt->myDoc = NULL;} if (ret_val != NULL) ctxt = NULL;", | 255 "xmlNewTextWriterPushParser": "if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ct
xt->myDoc = NULL;} if (ret_val != NULL) ctxt = NULL;", |
| 253 "xmlNewIOInputStream": "if (ret_val != NULL) input = NULL;", | 256 "xmlNewIOInputStream": "if (ret_val != NULL) input = NULL;", |
| 254 "htmlParseChunk": "if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc =
NULL;}", | 257 "htmlParseChunk": "if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc =
NULL;}", |
| 255 "htmlParseDocument": "if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc
= NULL;}", | 258 "htmlParseDocument": "if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc
= NULL;}", |
| 256 "xmlParseDocument": "if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc
= NULL;}", | 259 "xmlParseDocument": "if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc
= NULL;}", |
| 257 "xmlParseChunk": "if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = N
ULL;}", | 260 "xmlParseChunk": "if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = N
ULL;}", |
| 258 "xmlParseExtParsedEnt": "if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->my
Doc = NULL;}", | 261 "xmlParseExtParsedEnt": "if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->my
Doc = NULL;}", |
| 259 "xmlDOMWrapAdoptNode": "if ((node != NULL) && (node->parent == NULL)) {xmlUnl
inkNode(node);xmlFreeNode(node);node = NULL;}", | 262 "xmlDOMWrapAdoptNode": "if ((node != NULL) && (node->parent == NULL)) {xmlUnl
inkNode(node);xmlFreeNode(node);node = NULL;}", |
| 263 "xmlBufferSetAllocationScheme": "if ((buf != NULL) && (scheme == XML_BUFFER_A
LLOC_IMMUTABLE) && (buf->content != NULL) && (buf->content != static_buf_content
)) { xmlFree(buf->content); buf->content = NULL;}" |
| 260 } | 264 } |
| 261 | 265 |
| 262 modules = [] | 266 modules = [] |
| 263 | 267 |
| 264 def is_skipped_module(name): | 268 def is_skipped_module(name): |
| 265 for mod in skipped_modules: | 269 for mod in skipped_modules: |
| 266 if mod == name: | 270 if mod == name: |
| 267 return 1 | 271 return 1 |
| 268 return 0 | 272 return 0 |
| 269 | 273 |
| (...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 950 lst.write("\n") | 954 lst.write("\n") |
| 951 lst.write("\n") | 955 lst.write("\n") |
| 952 lst.write("\n") | 956 lst.write("\n") |
| 953 lst.write("Missing support per module"); | 957 lst.write("Missing support per module"); |
| 954 for module in missing_functions.keys(): | 958 for module in missing_functions.keys(): |
| 955 lst.write("module %s:\n %s\n" % (module, missing_functions[module])) | 959 lst.write("module %s:\n %s\n" % (module, missing_functions[module])) |
| 956 | 960 |
| 957 lst.close() | 961 lst.close() |
| 958 | 962 |
| 959 | 963 |
| OLD | NEW |