Skip to content
Snippets Groups Projects
Commit 3fd74568 authored by Robert Loehning's avatar Robert Loehning
Browse files

Squish: Updated checkLastBuild()


Change-Id: Iebe27d2d4d08fde62398cd711ad557f16a6f3974
Reviewed-by: default avatarChristian Stenger <christian.stenger@digia.com>
parent 11fa9797
No related branches found
No related tags found
No related merge requests found
...@@ -50,29 +50,20 @@ def checkLastBuild(expectedToFail=False): ...@@ -50,29 +50,20 @@ def checkLastBuild(expectedToFail=False):
except LookupError: except LookupError:
test.log("checkLastBuild called without a build") test.log("checkLastBuild called without a build")
return return
# get labels for errors and warnings ensureChecked(":Qt Creator_Issues_Core::Internal::OutputPaneToggleButton")
children = object.children(buildProg) model = waitForObject(":Qt Creator.Issues_QListView").model()
if len(children)<4: buildIssues = dumpBuildIssues(model)
test.fatal("Leaving checkLastBuild()", "Referred code seems to have changed - method has to get adjusted") errors = len(filter(lambda i: i[5] == "1", buildIssues))
return warnings = len(filter(lambda i: i[5] == "2", buildIssues))
errors = children[2].text gotErrors = errors != 0
if errors == "":
errors = "none"
warnings = children[4].text
if warnings == "":
warnings = "none"
gotErrors = errors != "none" and errors != "0"
if not (gotErrors ^ expectedToFail): if not (gotErrors ^ expectedToFail):
test.passes("Errors: %s | Warnings: %s" % (errors, warnings)) test.passes("Errors: %s | Warnings: %s" % (errors, warnings))
else: else:
test.fail("Errors: %s | Warnings: %s" % (errors, warnings)) test.fail("Errors: %s | Warnings: %s" % (errors, warnings))
# additional stuff - could be removed... or improved :) # additional stuff - could be removed... or improved :)
ensureChecked(":Qt Creator_Issues_Core::Internal::OutputPaneToggleButton")
list=waitForObject(":Qt Creator.Issues_QListView")
model = list.model()
test.log("Rows inside issues: %d" % model.rowCount()) test.log("Rows inside issues: %d" % model.rowCount())
if gotErrors and createTasksFileOnError: if gotErrors and createTasksFileOnError:
createTasksFile(list) createTasksFile(buildIssues)
return not gotErrors return not gotErrors
# helper function to check the compilation when build wasn't successful # helper function to check the compilation when build wasn't successful
...@@ -93,10 +84,17 @@ def compileSucceeded(compileOutput): ...@@ -93,10 +84,17 @@ def compileSucceeded(compileOutput):
return None != re.match(".*exited normally\.\n\d\d:\d\d:\d\d: Elapsed time: " return None != re.match(".*exited normally\.\n\d\d:\d\d:\d\d: Elapsed time: "
"(\d:)?\d{2}:\d\d\.$", str(compileOutput), re.S) "(\d:)?\d{2}:\d\d\.$", str(compileOutput), re.S)
# helper method that parses the Issues output and writes a tasks file def dumpBuildIssues(listModel):
def createTasksFile(list): issueDump = []
for row in range(listModel.rowCount()):
index = listModel.index(row, 0)
issueDump.extend([map(lambda role: index.data(role).toString(),
range(Qt.UserRole, Qt.UserRole + 6))])
return issueDump
# helper method that writes a tasks file
def createTasksFile(buildIssues):
global tasksFileDir, tasksFileCount global tasksFileDir, tasksFileCount
model = list.model()
if tasksFileDir == None: if tasksFileDir == None:
tasksFileDir = os.getcwd() + "/tasks" tasksFileDir = os.getcwd() + "/tasks"
tasksFileDir = os.path.abspath(tasksFileDir) tasksFileDir = os.path.abspath(tasksFileDir)
...@@ -111,18 +109,17 @@ def createTasksFile(list): ...@@ -111,18 +109,17 @@ def createTasksFile(list):
outfile = os.path.join(tasksFileDir, os.path.basename(squishinfo.testCase)+"_%d.tasks" % tasksFileCount) outfile = os.path.join(tasksFileDir, os.path.basename(squishinfo.testCase)+"_%d.tasks" % tasksFileCount)
file = codecs.open(outfile, "w", "utf-8") file = codecs.open(outfile, "w", "utf-8")
test.log("Writing tasks file - can take some time (according to number of issues)") test.log("Writing tasks file - can take some time (according to number of issues)")
rows = model.rowCount() rows = len(buildIssues)
if os.environ.get("SYSTEST_DEBUG") == "1": if os.environ.get("SYSTEST_DEBUG") == "1":
firstrow = 0 firstrow = 0
else: else:
firstrow = max(0, rows - 100) firstrow = max(0, rows - 100)
for row in range(firstrow, rows): for issue in buildIssues[firstrow:rows]:
index = model.index(row,0)
# the following is currently a bad work-around # the following is currently a bad work-around
fData = index.data(Qt.UserRole).toString() # file fData = issue[0] # file
lData = index.data(Qt.UserRole + 1).toString() # line -> linenumber or empty lData = issue[1] # line -> linenumber or empty
tData = index.data(Qt.UserRole + 5).toString() # type -> 1==error 2==warning tData = issue[5] # type -> 1==error 2==warning
dData = index.data(Qt.UserRole + 3).toString() # description dData = issue[3] # description
if lData == "": if lData == "":
lData = "-1" lData = "-1"
if tData == "1": if tData == "1":
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment