Commit d799bf31 authored by Christian Stenger's avatar Christian Stenger

Squish: Changed handling of workarounds

If a bug is closed for master but still valid for the current working
branch the workaround won't be executed if started with
performWorkaroundIfStillOpen(). This leads to wrong results.
The new approach is less automatic but more error-proof.

Change-Id: If33c920be08e33c0fb2ccc4faec4ae8ff0d0f95d
Reviewed-by: default avatarRobert Loehning <robert.loehning@digia.com>
parent 893020ae
......@@ -64,7 +64,7 @@ def widgetContainsPoint(widget, point):
def openContextMenuOnTextCursorPosition(editor):
rect = editor.cursorRect(editor.textCursor())
if platform.system() == 'Darwin':
JIRA.performWorkaroundIfStillOpen(8735, JIRA.Bug.CREATOR, editor)
JIRA.performWorkaroundForBug(8735, JIRA.Bug.CREATOR, editor)
openContextMenu(editor, rect.x+rect.width/2, rect.y+rect.height/2, 0)
menuInList = [None]
waitFor("menuVisibleAtEditor(editor, menuInList)", 5000)
......
......@@ -48,22 +48,14 @@ class JIRA:
tmpJIRA = JIRA(number, bugType)
return tmpJIRA.isOpen()
# function similar to performWorkaroundForBug - but it will execute the
# workaround (function) only if the bug is still open
# returns True if the workaround function has been executed, False otherwise
@staticmethod
def performWorkaroundIfStillOpen(number, bugType=Bug.CREATOR, *args):
if JIRA.isBugStillOpen(number, bugType):
return JIRA.performWorkaroundForBug(number, bugType, *args)
else:
test.warning("Bug %s-%d is closed... skipping workaround!" % (bugType, number),
"You should remove potential code inside performWorkaroundForBug()")
return False
# function that performs the workaround (function) for the given bug
# if the function needs additional arguments pass them as 3rd parameter
@staticmethod
def performWorkaroundForBug(number, bugType=Bug.CREATOR, *args):
if not JIRA.isBugStillOpen(number, bugType):
test.warning("Bug %s-%d is closed for version %s." %
(bugType, number, JIRA(number, bugType)._fix),
"You should probably remove potential code inside workarounds.py")
functionToCall = JIRA.getInstance().__bugs__.get("%s-%d" % (bugType, number), None)
if functionToCall:
test.warning("Using workaround for %s-%d" % (bugType, number))
......@@ -104,7 +96,8 @@ class JIRA:
bug = "%s-%d" % (self._bugType, self._number)
if bug in self._fetchResults_:
result = self._fetchResults_[bug]
self._resolution = result
self._resolution = result[0]
self._fix = result[1]
return
data = None
proxy = os.getenv("SYSTEST_PROXY", None)
......@@ -136,6 +129,15 @@ class JIRA:
data = data.replace("\r", "").replace("\n", "")
resPattern = re.compile('<span\s+id="resolution-val".*?>(?P<resolution>.*?)</span>')
resolution = resPattern.search(data)
fixVersion = 'None'
fixPattern = re.compile('<span.*?id="fixfor-val".*?>(?P<fix>.*?)</span>')
fix = fixPattern.search(data)
titlePattern = re.compile('title="(?P<title>.*?)"')
if fix:
fix = titlePattern.search(fix.group('fix').strip())
if fix:
fixVersion = fix.group('title').strip()
self._fix = fixVersion
if resolution:
self._resolution = resolution.group("resolution").strip()
else:
......@@ -144,7 +146,7 @@ class JIRA:
self._resolution = None
if self._resolution == None:
self.__cropAndLog__(data)
self._fetchResults_.update({bug:self._resolution})
self._fetchResults_.update({bug:[self._resolution, self._fix]})
# simple helper function - used as fallback if python has no ssl support
# tries to find curl or wget in PATH and fetches data with it instead of
......
......@@ -65,7 +65,7 @@ def main():
isMsvc = isMsvcConfig(len(checkedTargets), kit)
runControlFinished = False
invokeMenuItem("Debug", "Start Debugging", "Start Debugging")
JIRA.performWorkaroundIfStillOpen(6853, JIRA.Bug.CREATOR, config)
JIRA.performWorkaroundForBug(6853, JIRA.Bug.CREATOR, config)
handleDebuggerWarnings(config, isMsvc)
waitFor("runControlFinished==True", 20000)
if not runControlFinished:
......
......@@ -39,7 +39,7 @@ def main():
# Creator will show you the declaration of the variable.
if platform.system() == "Darwin":
JIRA.performWorkaroundIfStillOpen(8735, JIRA.Bug.CREATOR, cppwindow)
JIRA.performWorkaroundForBug(8735, JIRA.Bug.CREATOR, cppwindow)
type(cppwindow, "<Ctrl+F>")
type(waitForObject(":*Qt Creator.findEdit_Utils::FilterLineEdit"), " xi")
......
......@@ -39,7 +39,7 @@ def main():
continue
if platform.system() == 'Darwin':
JIRA.performWorkaroundIfStillOpen(8735, JIRA.Bug.CREATOR, editor)
JIRA.performWorkaroundForBug(8735, JIRA.Bug.CREATOR, editor)
contentBefore = readFile(currentFile)
popupText = "The file %s was removed. Do you want to save it under a different name, or close the editor?"
os.remove(currentFile)
......
......@@ -63,7 +63,7 @@ def __modifyProFile__():
def __modifyHeader__():
global cppEditorStr, homeShortCut, endShortCut
if platform.system() == "Darwin":
JIRA.performWorkaroundIfStillOpen(8735, JIRA.Bug.CREATOR, waitForObject(cppEditorStr, 1000))
JIRA.performWorkaroundForBug(8735, JIRA.Bug.CREATOR, waitForObject(cppEditorStr, 1000))
if placeCursorToLine(cppEditorStr, "class.+", True):
type(cppEditorStr, homeShortCut)
markText(cppEditorStr, "Down", 5)
......
......@@ -30,7 +30,7 @@ def main():
"Skipping this file for now.")
continue
if platform.system() == 'Darwin':
JIRA.performWorkaroundIfStillOpen(8735, JIRA.Bug.CREATOR, editor)
JIRA.performWorkaroundForBug(8735, JIRA.Bug.CREATOR, editor)
for key in ["<Up>", "<Down>", "<Left>", "<Right>"]:
test.log("Selecting everything")
invokeMenuItem("Edit", "Select All")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment