1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
|
# cppunit_runners.py
def has_child_node(nodeList, name ):
## nodeList = nodeList
## name = name
"""Returns true if the xml node list nodeList contains a node of the given name."""
for node in nodeList:
if node.nodeName == name:
return True
return False
# def has_child_node()
from xml.dom import minidom
buildReceivers = [] # Liste der Leute die den Mail enpfangen
runTests = []
solutionDirs = [] # Source directories to watch for changes
projectName = []
configFile = minidom.parse('config.xml')
#print configFile.toxml()
# Read global data
glob = configFile.getElementsByTagName(u"run")[0].getElementsByTagName(u"global")[0]
#print glob.toxml()
basePath = glob.getElementsByTagName(u"hicadbasepath")[0].getAttribute(u"path")
#print basePath
repository = glob.getElementsByTagName(u"output")[0].getAttribute(u"path")
#print repository
for receivers in glob.getElementsByTagName(u"notify")[0].getElementsByTagName(u"email"):
buildReceivers.append( receivers.getAttribute(u"name") )
#print receivers.toxml()
### Read configuration data
Test = configFile.getElementsByTagName(u"run")[0].getElementsByTagName(u"tests")[0]
#print Test.toxml()
testSuite = Test.getElementsByTagName(u"suite")[0]
#print TestSuite.toxml()
suiteType = Test.getElementsByTagName(u"suite")[0].getAttribute(u"type")
#print suiteType
conf = testSuite.getElementsByTagName(u"configuration")[0]
#print conf.toxml()
testSuiteRunner = conf.getElementsByTagName(u"suiterunner")[0].getAttribute(u"script")
#print testSuiteRunner
testCasePath = conf.getElementsByTagName(u"testcasepath")[0].getAttribute(u"path")
#print testCasePath
if ( has_child_node( conf.getElementsByTagName(u"runtests")[0].childNodes, u"debug") ):
runTests.append(u"debug")
if ( has_child_node( conf.getElementsByTagName(u"runtests")[0].childNodes, u"release") ):
runTests.append(u"release")
#print runTests
for receivers in conf.getElementsByTagName(u"notify")[0].getElementsByTagName(u"email"):
buildReceivers.append( receivers.getAttribute(u"name") )
#print receivers.toxml()
for Name in testSuite.getElementsByTagName(u"test"):
projectName.append( Name.getAttribute(u"name") )
print projectName
for Solution in testSuite.getElementsByTagName(u"test"):
solutionDirs.append( Solution.getAttribute(u"path") )
print solutionDirs |
Partager