import sys
import time
import os
import string
import StringIO
import libxml2
# Memory debug specific
#
# the testsuite description
#
#
# Resolver callback
#
resources = {}
global resources
return None
#
# Load the previous results
#
#results = {}
#previous = {}
#
#try:
# res = libxml2.parseFile(RES)
#except:
# log.write("Could not parse %s" % (RES))
#
# handle a valid instance
#
global log
global nb_instances_success
global nb_instances_failed
if instance == None:
instance = ""
while child != None:
# mem = libxml2.debugMemory(1);
try:
except:
doc = None
if doc == None:
return
if debug:
try:
del ctxt
except:
ret = -1
# if mem != libxml2.debugMemory(1):
# print "validating instance %d line %d leaks" % (
# nb_instances_tests, node.lineNo())
if ret != 0:
else:
#
# handle an invalid instance
#
global log
global nb_instances_success
global nb_instances_failed
if instance == None:
instance = ""
while child != None:
# mem = libxml2.debugMemory(1);
try:
except:
doc = None
if doc == None:
return
if debug:
try:
del ctxt
except:
ret = -1
# mem2 = libxml2.debugMemory(1)
# if mem != mem2:
# print "validating instance %d line %d leaks %d bytes" % (
# nb_instances_tests, node.lineNo(), mem2 - mem)
if ret == 0:
else:
#
# handle an incorrect test
#
global log
global nb_schemas_success
global nb_schemas_failed
schema = ""
while child != None:
try:
except:
rngs = None
if rngs == None:
else:
return rngs
global log
global nb_schemas_success
global nb_schemas_failed
schema = ""
while child != None:
try:
except:
rngs = None
if rngs != None:
else:
# log.write("\nSuccess detecting schema error in:\n-----\n")
# log.write(schema)
# log.write("\n-----\n")
return None
#
# resource handling: keep a dictionary of URL->string mappings
#
global resources
try:
except:
name = None
return;
if dir != None:
# name = libxml2.buildURI(name, dir)
res = ""
while child != None:
#
# dir handling: pseudo directory resources
#
try:
except:
name = None
return;
if dir != None:
# name = libxml2.buildURI(name, dir)
for r in res:
handle_resource(r, name)
#
# handle a testCase element
#
global nb_schemas_tests
global nb_instances_tests
global resources
resources = {}
if debug:
handle_dir(dir, None)
for r in res:
handle_resource(r, None)
if tsts != []:
else:
if tsts != []:
else:
if schema != None:
#
# handle a testSuite element
#
if level >= 1:
if docs != []:
msg = ""
if authors != []:
if quiet == 0:
print msg
msg = ""
if quiet == 0:
print "Tests for section %s" % (msg)
msg = ""
print "Result of tests for section %s" % (msg)
print "found %d test schemas: %d success %d failures" % (
print "found %d test instances: %d success %d failures" % (
#
# Parse the conf file
#
#
# Error and warnng callbacks
#
global log
print "%s doesn't start with a testSuite element, aborting" % (CONF)
if quiet == 0:
print "Running Relax NG testsuite"
if quiet == 0:
print "\nTOTAL:\n"
print "found %d test schemas: %d success %d failures" % (
print "found %d test instances: %d success %d failures" % (
# Memory debug specific
if quiet == 0:
print "OK"
else: