Diff for /embedaddon/libxml2/runsuite.c between versions 1.1.1.2 and 1.1.1.3

version 1.1.1.2, 2013/07/22 01:22:20 version 1.1.1.3, 2014/06/15 19:53:29
Line 1 Line 1
 /*  /*
 * runsuite.c: C program to run libxml2 againts published testsuites  * runsuite.c: C program to run libxml2 againts published testsuites
  *   *
  * See Copyright for the status of this software.   * See Copyright for the status of this software.
  *   *
  * daniel@veillard.com   * daniel@veillard.com
  */   */
   
 #ifdef HAVE_CONFIG_H  
 #include "libxml.h"  #include "libxml.h"
 #else  
 #include <stdio.h>  #include <stdio.h>
 #endif  
   
 #if !defined(_WIN32) || defined(__CYGWIN__)  #if !defined(_WIN32) || defined(__CYGWIN__)
 #include <unistd.h>  #include <unistd.h>
Line 38 Line 35
 static FILE *logfile = NULL;  static FILE *logfile = NULL;
 static int verbose = 0;  static int verbose = 0;
   
 #if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__MINGW32__)  
 #define vsnprintf _vsnprintf  
 #define snprintf _snprintf  
 #endif  
   
 /************************************************************************  /************************************************************************
  *                                                                      *   *                                                                      *
Line 130  static int addEntity(char *name, char *content) { Line 123  static int addEntity(char *name, char *content) {
  * which is shared to the current running test. We also don't want to have   * which is shared to the current running test. We also don't want to have
  * network downloads modifying tests.   * network downloads modifying tests.
  */   */
static xmlParserInputPtr static xmlParserInputPtr
 testExternalEntityLoader(const char *URL, const char *ID,  testExternalEntityLoader(const char *URL, const char *ID,
                          xmlParserCtxtPtr ctxt) {                           xmlParserCtxtPtr ctxt) {
     xmlParserInputPtr ret;      xmlParserInputPtr ret;
Line 159  testExternalEntityLoader(const char *URL, const char * Line 152  testExternalEntityLoader(const char *URL, const char *
         fprintf(stderr, "Failed to find resource %s\n", URL);          fprintf(stderr, "Failed to find resource %s\n", URL);
     }      }
 #endif  #endif
      
     return(ret);      return(ret);
 }  }
   
Line 422  installDirs(xmlNodePtr tst, const xmlChar *base) { Line 415  installDirs(xmlNodePtr tst, const xmlChar *base) {
     xmlFree(res);      xmlFree(res);
 }  }
   
static int static int
 xsdTestCase(xmlNodePtr tst) {  xsdTestCase(xmlNodePtr tst) {
     xmlNodePtr test, tmp, cur;      xmlNodePtr test, tmp, cur;
     xmlBufferPtr buf;      xmlBufferPtr buf;
Line 449  xsdTestCase(xmlNodePtr tst) { Line 442  xsdTestCase(xmlNodePtr tst) {
     if (cur == NULL) {      if (cur == NULL) {
         return(xsdIncorectTestCase(tst));          return(xsdIncorectTestCase(tst));
     }      }
    
     test = getNext(cur, "./*");      test = getNext(cur, "./*");
     if (test == NULL) {      if (test == NULL) {
         fprintf(stderr, "Failed to find test in correct line %ld\n",          fprintf(stderr, "Failed to find test in correct line %ld\n",
Line 495  xsdTestCase(xmlNodePtr tst) { Line 488  xsdTestCase(xmlNodePtr tst) {
         if (test == NULL) {          if (test == NULL) {
             fprintf(stderr, "Failed to find test in <valid> line %ld\n",              fprintf(stderr, "Failed to find test in <valid> line %ld\n",
                     xmlGetLineNo(tmp));                      xmlGetLineNo(tmp));
            
         } else {          } else {
             xmlBufferEmpty(buf);              xmlBufferEmpty(buf);
             if (dtd != NULL)              if (dtd != NULL)
Line 554  xsdTestCase(xmlNodePtr tst) { Line 547  xsdTestCase(xmlNodePtr tst) {
         if (test == NULL) {          if (test == NULL) {
             fprintf(stderr, "Failed to find test in <invalid> line %ld\n",              fprintf(stderr, "Failed to find test in <invalid> line %ld\n",
                     xmlGetLineNo(tmp));                      xmlGetLineNo(tmp));
            
         } else {          } else {
             xmlBufferEmpty(buf);              xmlBufferEmpty(buf);
             xmlNodeDump(buf, test->doc, test, 0, 0);              xmlNodeDump(buf, test->doc, test, 0, 0);
Line 615  done: Line 608  done:
     return(ret);      return(ret);
 }  }
   
static int static int
 xsdTestSuite(xmlNodePtr cur) {  xsdTestSuite(xmlNodePtr cur) {
     if (verbose) {      if (verbose) {
         xmlChar *doc = getString(cur, "string(documentation)");          xmlChar *doc = getString(cur, "string(documentation)");
Line 630  xsdTestSuite(xmlNodePtr cur) { Line 623  xsdTestSuite(xmlNodePtr cur) {
         xsdTestCase(cur);          xsdTestCase(cur);
         cur = getNext(cur, "following-sibling::testCase[1]");          cur = getNext(cur, "following-sibling::testCase[1]");
     }      }
        
     return(0);      return(0);
 }  }
   
static int static int
 xsdTest(void) {  xsdTest(void) {
     xmlDocPtr doc;      xmlDocPtr doc;
     xmlNodePtr cur;      xmlNodePtr cur;
Line 672  done: Line 665  done:
     return(ret);      return(ret);
 }  }
   
static int static int
 rngTestSuite(xmlNodePtr cur) {  rngTestSuite(xmlNodePtr cur) {
     if (verbose) {      if (verbose) {
         xmlChar *doc = getString(cur, "string(documentation)");          xmlChar *doc = getString(cur, "string(documentation)");
Line 693  rngTestSuite(xmlNodePtr cur) { Line 686  rngTestSuite(xmlNodePtr cur) {
         xsdTestSuite(cur);          xsdTestSuite(cur);
         cur = getNext(cur, "following-sibling::testSuite[1]");          cur = getNext(cur, "following-sibling::testSuite[1]");
     }      }
        
     return(0);      return(0);
 }  }
   
static int static int
 rngTest1(void) {  rngTest1(void) {
     xmlDocPtr doc;      xmlDocPtr doc;
     xmlNodePtr cur;      xmlNodePtr cur;
Line 735  done: Line 728  done:
     return(ret);      return(ret);
 }  }
   
static int static int
 rngTest2(void) {  rngTest2(void) {
     xmlDocPtr doc;      xmlDocPtr doc;
     xmlNodePtr cur;      xmlNodePtr cur;
Line 945  xstcTestGroup(xmlNodePtr cur, const char *base) { Line 938  xstcTestGroup(xmlNodePtr cur, const char *base) {
         instance = getNext(cur, "./ts:instanceTest[1]");          instance = getNext(cur, "./ts:instanceTest[1]");
         while (instance != NULL) {          while (instance != NULL) {
             if (schemas != NULL) {              if (schemas != NULL) {
                xstcTestInstance(instance, schemas, path, base);                                xstcTestInstance(instance, schemas, path, base);
             } else {              } else {
                 /*                  /*
                 * We'll automatically mark the instances as failed                  * We'll automatically mark the instances as failed

Removed from v.1.1.1.2  
changed lines
  Added in v.1.1.1.3


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>