Skip to content

Commit

Permalink
add a group without args option
Browse files Browse the repository at this point in the history
  • Loading branch information
zhajio1988 committed Mar 6, 2019
1 parent 54b9937 commit a331975
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
7 changes: 4 additions & 3 deletions groupCfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@ def _parseTests(self):
testList = test.split("-")
testArgs = test.split(" ")[1:]
#print('22', testArgs)
if testList[1:]:
if testList[1:] and self.argsOption:
self._getTestArgs(testList[1:], appendArgs)
#print("debug point appendArgs1", appendArgs)
testArgs.append(" ".join(['-'+ x for x in appendArgs]))
#print("debug point testArgs1", testArgs)
index = self._buildInOpts['tests'].index(test)
self._buildInOpts['tests'].pop(index)
self._buildInOpts['tests'].insert(index, testList[0] + " ".join(testArgs))
else:
elif self.argsOption:
testList.append(self.argsOption)
index = self._buildInOpts['tests'].index(test)
self._buildInOpts['tests'].pop(index)
Expand Down Expand Up @@ -101,7 +101,8 @@ def argsOption(self):

@property
def argsOptionList(self):
return self.argsOption.strip().split("-")
if self.argsOption:
return self.argsOption.strip().split("-")

@property
def testsOption(self):
Expand Down
18 changes: 10 additions & 8 deletions readCfgFile.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,22 +36,24 @@ def __init__(self, file):
super(readGroupCfgFile, self).__init__('readGroupCfgFile', file)
self._subSectionType = {'testgroup': groupCfg}
self.parse()
self.validBuild = []
self._validBuild = []
self._tests = {}

@property
def testGroup(self):
if 'testgroup' in self.subSection:
return self.subSection['testgroup']

@property
def validBuild(self):
return self._validBuild[0]

def getTests(self, groupName):
groupSection = self.testGroup.getGroup(groupName)
globalBuild = groupSection.buildOption
globalArgs = groupSection.argsOption
globalTests = groupSection.testsOption
if globalBuild:
self.validBuild.append(globalBuild)
self._validBuild.append(globalBuild)
if globalTests:
self._tests[groupName] = globalTests
if groupSection.include:
Expand All @@ -60,23 +62,23 @@ def getTests(self, groupName):
self._tests[incGroup.name] = incGroup.testsOption
self.setValidBuild(globalBuild, incGroup.buildOption)

self.checkBuild(self.validBuild, groupName)
self.checkBuild(self._validBuild, groupName)
print(self._tests)
return self._tests

def setValidBuild(self, globalBuild, subBuild):
if globalBuild and subBuild and globalBuild != subBuild:
self.validBuild.append(globalBuild)
self._validBuild.append(globalBuild)
elif subBuild and not globalBuild:
self.validBuild.append(subBuild)
self._validBuild.append(subBuild)
elif globalBuild and not subBuild:
self.validBuild.append(globalBuild)
self._validBuild.append(globalBuild)

def checkBuild(self, buildList, groupName):
buildSet = set(buildList)
if len(buildSet) != 1:
raise ValueError(('group %s has included subgroup is must be in same build' % groupName))


if __name__ == '__main__':
#config = readBuildCfgFile(defaultBuildFile())
#print(config.build.simOption)
Expand Down

0 comments on commit a331975

Please sign in to comment.