import sys
import time
import os
import string
import StringIO
import libxml2
# Memory debug specific
#
# the testsuite description
#
#
# Error and warnng callbacks
#
global log
#
# Resolver callback
#
resources = {}
global resources
return None
#
# handle a valid instance
#
global log
global nb_instances_success
global nb_instances_failed
if instance == None:
instance = ""
while child != None:
try:
except:
doc = None
if doc == None:
return
if debug:
try:
del ctxt
except:
ret = -1
print "validating instance %d line %d leaks" % (
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
# if mem != libxml2.debugMemory(1):
# print "validating instance %d line %d leaks" % (
# nb_instances_tests, node.lineNo())
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 docs != []:
msg = ""
if authors != []:
if quiet == 0:
print msg
msg = ""
if quiet == 0:
print "Tests for section %s" % (msg)
if sections != []:
msg = ""
print "Result of tests for section %s" % (msg)
elif docs != []:
msg = ""
print "Result of tests for %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"
print "\nTOTAL:\nfound %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: