From 35a201cc8ef0c3f5b2df88d2e528aabee1048348 Mon Sep 17 00:00:00 2001 From: Wojtek Kosior Date: Fri, 30 Apr 2021 18:47:09 +0200 Subject: Initial/Final commit --- libxml2-2.9.10/xstc/xstc.py | 693 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 693 insertions(+) create mode 100755 libxml2-2.9.10/xstc/xstc.py (limited to 'libxml2-2.9.10/xstc/xstc.py') diff --git a/libxml2-2.9.10/xstc/xstc.py b/libxml2-2.9.10/xstc/xstc.py new file mode 100755 index 0000000..ca011bb --- /dev/null +++ b/libxml2-2.9.10/xstc/xstc.py @@ -0,0 +1,693 @@ +#!/usr/bin/env python + +# +# This is the MS subset of the W3C test suite for XML Schemas. +# This file is generated from the MS W3c test suite description file. +# + +import sys, os +import exceptions, optparse +import libxml2 + +opa = optparse.OptionParser() + +opa.add_option("-b", "--base", action="store", type="string", dest="baseDir", + default="", + help="""The base directory; i.e. the parent folder of the + "nisttest", "suntest" and "msxsdtest" directories.""") + +opa.add_option("-o", "--out", action="store", type="string", dest="logFile", + default="test.log", + help="The filepath of the log file to be created") + +opa.add_option("--log", action="store_true", dest="enableLog", + default=False, + help="Create the log file") + +opa.add_option("--no-test-out", action="store_true", dest="disableTestStdOut", + default=False, + help="Don't output test results") + +opa.add_option("-s", "--silent", action="store_true", dest="silent", default=False, + help="Disables display of all tests") + +opa.add_option("-v", "--verbose", action="store_true", dest="verbose", + default=False, + help="Displays all tests (only if --silent is not set)") + +opa.add_option("-x", "--max", type="int", dest="maxTestCount", + default="-1", + help="The maximum number of tests to be run") + +opa.add_option("-t", "--test", type="string", dest="singleTest", + default=None, + help="Runs the specified test only") + +opa.add_option("--tsw", "--test-starts-with", type="string", dest="testStartsWith", + default=None, + help="Runs the specified test(s), starting with the given string") + +opa.add_option("--rieo", "--report-internal-errors-only", action="store_true", + dest="reportInternalErrOnly", default=False, + help="Display erroneous tests of type 'internal' only") + +opa.add_option("--rueo", "--report-unimplemented-errors-only", action="store_true", + dest="reportUnimplErrOnly", default=False, + help="Display erroneous tests of type 'unimplemented' only") + +opa.add_option("--rmleo", "--report-mem-leak-errors-only", action="store_true", + dest="reportMemLeakErrOnly", default=False, + help="Display erroneous tests of type 'memory leak' only") + +opa.add_option("-c", "--combines", type="string", dest="combines", + default=None, + help="Combines to be run (all if omitted)") + +opa.add_option("--csw", "--csw", type="string", dest="combineStartsWith", + default=None, + help="Combines to be run (all if omitted)") + +opa.add_option("--rc", "--report-combines", action="store_true", + dest="reportCombines", default=False, + help="Display combine reports") + +opa.add_option("--rec", "--report-err-combines", action="store_true", + dest="reportErrCombines", default=False, + help="Display erroneous combine reports only") + +opa.add_option("--debug", action="store_true", + dest="debugEnabled", default=False, + help="Displays debug messages") + +opa.add_option("--info", action="store_true", + dest="info", default=False, + help="Displays info on the suite only. Does not run any test.") +opa.add_option("--sax", action="store_true", + dest="validationSAX", default=False, + help="Use SAX2-driven validation.") +opa.add_option("--tn", action="store_true", + dest="displayTestName", default=False, + help="Display the test name in every case.") + +(options, args) = opa.parse_args() + +if options.combines is not None: + options.combines = options.combines.split() + +################################################ +# The vars below are not intended to be changed. +# + +msgSchemaNotValidButShould = "The schema should be valid." +msgSchemaValidButShouldNot = "The schema should be invalid." +msgInstanceNotValidButShould = "The instance should be valid." +msgInstanceValidButShouldNot = "The instance should be invalid." +vendorNIST = "NIST" +vendorNIST_2 = "NIST-2" +vendorSUN = "SUN" +vendorMS = "MS" + +################### +# Helper functions. +# +vendor = None + +def handleError(test, msg): + global options + if not options.silent: + test.addLibLog("'%s' LIB: %s" % (test.name, msg)) + if msg.find("Unimplemented") > -1: + test.failUnimplemented() + elif msg.find("Internal") > -1: + test.failInternal() + + +def fixFileNames(fileName): + if (fileName is None) or (fileName == ""): + return "" + dirs = fileName.split("/") + if dirs[1] != "Tests": + fileName = os.path.join(".", "Tests") + for dir in dirs[1:]: + fileName = os.path.join(fileName, dir) + return fileName + +class XSTCTestGroup: + def __init__(self, name, schemaFileName, descr): + global vendor, vendorNIST_2 + self.name = name + self.descr = descr + self.mainSchema = True + self.schemaFileName = fixFileNames(schemaFileName) + self.schemaParsed = False + self.schemaTried = False + + def setSchema(self, schemaFileName, parsed): + if not self.mainSchema: + return + self.mainSchema = False + self.schemaParsed = parsed + self.schemaTried = True + +class XSTCTestCase: + + #