Commit f78327a5 authored by Robert Loehning's avatar Robert Loehning

Squish: Use list instead of bitfield for kits

Change-Id: Ia2e1f3aa9ea723deb9f2a2c88e2f97be8ae0e833
Reviewed-by: Christian Stenger's avatarChristian Stenger <christian.stenger@qt.io>
parent 350db248
...@@ -39,9 +39,10 @@ class Targets: ...@@ -39,9 +39,10 @@ class Targets:
@staticmethod @staticmethod
def desktopTargetClasses(): def desktopTargetClasses():
desktopTargets = (sum(Targets.ALL_TARGETS) & ~Targets.EMBEDDED_LINUX) desktopTargets = list(Targets.ALL_TARGETS)
desktopTargets.remove(Targets.EMBEDDED_LINUX)
if platform.system() == 'Darwin': if platform.system() == 'Darwin':
desktopTargets &= ~Targets.DESKTOP_541_GCC desktopTargets.remove(Targets.DESKTOP_541_GCC)
return desktopTargets return desktopTargets
@staticmethod @staticmethod
...@@ -79,14 +80,6 @@ class Targets: ...@@ -79,14 +80,6 @@ class Targets:
test.fatal("You've passed at least one unknown target!") test.fatal("You've passed at least one unknown target!")
return result return result
@staticmethod
def intToArray(targets):
return filter(lambda x: x & targets, Targets.ALL_TARGETS)
@staticmethod
def arrayToInt(targetArr):
return reduce(operator.or_, targetArr, 0)
@staticmethod @staticmethod
def getDefaultKit(): def getDefaultKit():
return Targets.DESKTOP_531_DEFAULT return Targets.DESKTOP_531_DEFAULT
......
...@@ -71,8 +71,8 @@ def openCmakeProject(projectPath, buildDir): ...@@ -71,8 +71,8 @@ def openCmakeProject(projectPath, buildDir):
invokeMenuItem("File", "Open File or Project...") invokeMenuItem("File", "Open File or Project...")
selectFromFileDialog(projectPath) selectFromFileDialog(projectPath)
__chooseTargets__(0) # uncheck all __chooseTargets__([]) # uncheck all
__chooseTargets__(Targets.DESKTOP_480_DEFAULT, additionalFunc=additionalFunction) __chooseTargets__([Targets.DESKTOP_480_DEFAULT], additionalFunc=additionalFunction)
clickButton(waitForObject(":Qt Creator.Configure Project_QPushButton")) clickButton(waitForObject(":Qt Creator.Configure Project_QPushButton"))
return True return True
...@@ -326,7 +326,7 @@ def createEmptyQtProject(workingDir=None, projectName=None, targets=Targets.desk ...@@ -326,7 +326,7 @@ def createEmptyQtProject(workingDir=None, projectName=None, targets=Targets.desk
__createProjectHandleLastPage__() __createProjectHandleLastPage__()
return projectName, checkedTargets return projectName, checkedTargets
def createNewNonQtProject(workingDir=None, projectName=None, target=Targets.DESKTOP_474_GCC, def createNewNonQtProject(workingDir=None, projectName=None, target=[Targets.DESKTOP_474_GCC],
plainC=False, cmake=False, qbs=False): plainC=False, cmake=False, qbs=False):
if plainC: if plainC:
template = "Plain C Application" template = "Plain C Application"
...@@ -355,7 +355,7 @@ def createNewNonQtProject(workingDir=None, projectName=None, target=Targets.DESK ...@@ -355,7 +355,7 @@ def createNewNonQtProject(workingDir=None, projectName=None, target=Targets.DESK
return projectName return projectName
def createNewCPPLib(projectDir = None, projectName = None, className = None, fromWelcome = False, def createNewCPPLib(projectDir = None, projectName = None, className = None, fromWelcome = False,
target = Targets.DESKTOP_474_GCC, isStatic = False, modules = ["QtCore"]): target = [Targets.DESKTOP_474_GCC], isStatic = False, modules = ["QtCore"]):
available = __createProjectOrFileSelectType__(" Library", "C++ Library", fromWelcome, True) available = __createProjectOrFileSelectType__(" Library", "C++ Library", fromWelcome, True)
if isStatic: if isStatic:
libType = LibType.STATIC libType = LibType.STATIC
...@@ -373,7 +373,7 @@ def createNewCPPLib(projectDir = None, projectName = None, className = None, fro ...@@ -373,7 +373,7 @@ def createNewCPPLib(projectDir = None, projectName = None, className = None, fro
return checkedTargets, projectName, className return checkedTargets, projectName, className
def createNewQtPlugin(projectDir=None, projectName=None, className=None, fromWelcome=False, def createNewQtPlugin(projectDir=None, projectName=None, className=None, fromWelcome=False,
target=Targets.DESKTOP_474_GCC, baseClass="QGenericPlugin"): target=[Targets.DESKTOP_474_GCC], baseClass="QGenericPlugin"):
available = __createProjectOrFileSelectType__(" Library", "C++ Library", fromWelcome, True) available = __createProjectOrFileSelectType__(" Library", "C++ Library", fromWelcome, True)
if projectDir == None: if projectDir == None:
projectDir = tempDir() projectDir = tempDir()
...@@ -385,13 +385,13 @@ def createNewQtPlugin(projectDir=None, projectName=None, className=None, fromWel ...@@ -385,13 +385,13 @@ def createNewQtPlugin(projectDir=None, projectName=None, className=None, fromWel
__createProjectHandleLastPage__() __createProjectHandleLastPage__()
return checkedTargets, projectName, className return checkedTargets, projectName, className
# parameter target can be an OR'd value of Targets # parameter target can be a list of Targets
# parameter availableTargets should be the result of __createProjectOrFileSelectType__() # parameter availableTargets should be the result of __createProjectOrFileSelectType__()
# or use None as a fallback # or use None as a fallback
# parameter additionalFunc function to be executed inside the detailed view of each chosen kit # parameter additionalFunc function to be executed inside the detailed view of each chosen kit
# if present, 'Details' button will be clicked, function will be executed, # if present, 'Details' button will be clicked, function will be executed,
# 'Details' button will be clicked again # 'Details' button will be clicked again
def __chooseTargets__(targets=Targets.DESKTOP_474_GCC, availableTargets=None, additionalFunc=None): def __chooseTargets__(targets=[Targets.DESKTOP_474_GCC], availableTargets=None, additionalFunc=None):
if availableTargets != None: if availableTargets != None:
available = availableTargets available = availableTargets
else: else:
...@@ -403,7 +403,7 @@ def __chooseTargets__(targets=Targets.DESKTOP_474_GCC, availableTargets=None, ad ...@@ -403,7 +403,7 @@ def __chooseTargets__(targets=Targets.DESKTOP_474_GCC, availableTargets=None, ad
available.remove(Targets.DESKTOP_541_GCC) available.remove(Targets.DESKTOP_541_GCC)
checkedTargets = [] checkedTargets = []
for current in available: for current in available:
mustCheck = targets & current == current mustCheck = current in targets
try: try:
ensureChecked("{type='QCheckBox' text='%s' visible='1'}" % Targets.getStringForTarget(current), ensureChecked("{type='QCheckBox' text='%s' visible='1'}" % Targets.getStringForTarget(current),
mustCheck, 3000) mustCheck, 3000)
......
...@@ -80,7 +80,8 @@ def main(): ...@@ -80,7 +80,8 @@ def main():
checkSimpleCppLib("SampleApp2", True) checkSimpleCppLib("SampleApp2", True)
# Qt Plugin needs Qt4.8 for QGenericPlugin which is tested by default # Qt Plugin needs Qt4.8 for QGenericPlugin which is tested by default
targets = Targets.desktopTargetClasses() & ~Targets.DESKTOP_474_GCC targets = Targets.desktopTargetClasses()
targets.remove(Targets.DESKTOP_474_GCC)
checkedTargets, projectName, className = createNewQtPlugin(tempDir(), "SampleApp3", "MyPlugin", checkedTargets, projectName, className = createNewQtPlugin(tempDir(), "SampleApp3", "MyPlugin",
target=targets) target=targets)
virtualFunctionsAdded = False virtualFunctionsAdded = False
......
...@@ -40,7 +40,9 @@ def main(): ...@@ -40,7 +40,9 @@ def main():
if not startedWithoutPluginError(): if not startedWithoutPluginError():
return return
# open example project, supports only Qt 5 # open example project, supports only Qt 5
targets = Targets.desktopTargetClasses() & ~Targets.DESKTOP_474_GCC & ~Targets.DESKTOP_480_DEFAULT targets = Targets.desktopTargetClasses()
targets.remove(Targets.DESKTOP_474_GCC)
targets.remove(Targets.DESKTOP_480_DEFAULT)
checkedTargets = openQmakeProject(examplePath, targets) checkedTargets = openQmakeProject(examplePath, targets)
# build and wait until finished - on all build configurations # build and wait until finished - on all build configurations
availableConfigs = iterateBuildConfigs(len(checkedTargets)) availableConfigs = iterateBuildConfigs(len(checkedTargets))
......
...@@ -174,7 +174,7 @@ def main(): ...@@ -174,7 +174,7 @@ def main():
for useClang in [False, True]: for useClang in [False, True]:
if not startCreator(useClang): if not startCreator(useClang):
continue continue
openQmakeProject(examplePath, Targets.DESKTOP_531_DEFAULT) openQmakeProject(examplePath, [Targets.DESKTOP_531_DEFAULT])
checkCodeModelSettings(useClang) checkCodeModelSettings(useClang)
if not openDocument("cplusplus-tools.Sources.main\\.cpp"): if not openDocument("cplusplus-tools.Sources.main\\.cpp"):
earlyExit("Failed to open main.cpp.") earlyExit("Failed to open main.cpp.")
......
...@@ -80,7 +80,7 @@ def main(): ...@@ -80,7 +80,7 @@ def main():
if not startedWithoutPluginError(): if not startedWithoutPluginError():
return return
# open example project # open example project
openQmakeProject(examplePath, Targets.DESKTOP_531_DEFAULT) openQmakeProject(examplePath, [Targets.DESKTOP_531_DEFAULT])
# open qml file # open qml file
openDocument("animation.Resources.animation\\.qrc./animation.basics.color-animation\\.qml") openDocument("animation.Resources.animation\\.qrc./animation.basics.color-animation\\.qml")
# get editor # get editor
......
...@@ -58,13 +58,12 @@ def main(): ...@@ -58,13 +58,12 @@ def main():
performDebugging(projectName, checkedTargets) performDebugging(projectName, checkedTargets)
invokeMenuItem("File", "Close All Projects and Editors") invokeMenuItem("File", "Close All Projects and Editors")
# C/C++ # C/C++
targets = Targets.intToArray(Targets.desktopTargetClasses())
for name,isC in {"C":True, "CPP":False}.items(): for name,isC in {"C":True, "CPP":False}.items():
for singleTarget in targets: for singleTarget in targets:
workingDir = tempDir() workingDir = tempDir()
qtVersion = re.search("\d{3}", Targets.getStringForTarget(singleTarget)).group() qtVersion = re.search("\d{3}", Targets.getStringForTarget(singleTarget)).group()
projectName = createNewNonQtProject(workingDir, "Sample%s%s" % (name, qtVersion), projectName = createNewNonQtProject(workingDir, "Sample%s%s" % (name, qtVersion),
singleTarget, isC) [singleTarget], isC)
if projectName == None: if projectName == None:
test.fail("Failed to create Sample%s%s" % (name, qtVersion), test.fail("Failed to create Sample%s%s" % (name, qtVersion),
"Target: %s, plainC: %s" % (Targets.getStringForTargt(singleTarget), isC)) "Target: %s, plainC: %s" % (Targets.getStringForTargt(singleTarget), isC))
......
...@@ -30,7 +30,8 @@ def main(): ...@@ -30,7 +30,8 @@ def main():
if not startedWithoutPluginError(): if not startedWithoutPluginError():
return return
# Requires Qt 4.8 # Requires Qt 4.8
targets = Targets.desktopTargetClasses() & ~Targets.DESKTOP_474_GCC targets = Targets.desktopTargetClasses()
targets.remove(Targets.DESKTOP_474_GCC)
# using a temporary directory won't mess up a potentially existing # using a temporary directory won't mess up a potentially existing
workingDir = tempDir() workingDir = tempDir()
checkedTargets, projectName = createNewQtQuickApplication(workingDir, targets=targets) checkedTargets, projectName = createNewQtQuickApplication(workingDir, targets=targets)
......
...@@ -42,7 +42,7 @@ def main(): ...@@ -42,7 +42,7 @@ def main():
startApplication("qtcreator" + SettingsPath) startApplication("qtcreator" + SettingsPath)
if not startedWithoutPluginError(): if not startedWithoutPluginError():
return return
checkedTargets = openQmakeProject(SpeedCrunchPath, Targets.DESKTOP_480_DEFAULT) checkedTargets = openQmakeProject(SpeedCrunchPath, [Targets.DESKTOP_480_DEFAULT])
progressBarWait(30000) progressBarWait(30000)
fancyToolButton = waitForObject(":*Qt Creator_Core::Internal::FancyToolButton") fancyToolButton = waitForObject(":*Qt Creator_Core::Internal::FancyToolButton")
......
...@@ -36,12 +36,12 @@ def main(): ...@@ -36,12 +36,12 @@ def main():
return return
runButton = findObject(':*Qt Creator.Run_Core::Internal::FancyToolButton') runButton = findObject(':*Qt Creator.Run_Core::Internal::FancyToolButton')
openQmakeProject(pathSpeedcrunch, Targets.DESKTOP_480_DEFAULT) openQmakeProject(pathSpeedcrunch, [Targets.DESKTOP_480_DEFAULT])
# Wait for parsing to complete # Wait for parsing to complete
waitFor("runButton.enabled", 30000) waitFor("runButton.enabled", 30000)
# Starting before opening, because this is where Creator froze (QTCREATORBUG-10733) # Starting before opening, because this is where Creator froze (QTCREATORBUG-10733)
startopening = datetime.utcnow() startopening = datetime.utcnow()
openQmakeProject(pathCreator, Targets.DESKTOP_561_DEFAULT) openQmakeProject(pathCreator, [Targets.DESKTOP_561_DEFAULT])
# Wait for parsing to complete # Wait for parsing to complete
startreading = datetime.utcnow() startreading = datetime.utcnow()
waitFor("runButton.enabled", 300000) waitFor("runButton.enabled", 300000)
......
...@@ -39,7 +39,7 @@ def main(): ...@@ -39,7 +39,7 @@ def main():
"Verifying window title contains created session name.") "Verifying window title contains created session name.")
checkWelcomePage(sessionName, True) checkWelcomePage(sessionName, True)
for project in projects: for project in projects:
openQmakeProject(project, Targets.DESKTOP_531_DEFAULT) openQmakeProject(project, [Targets.DESKTOP_531_DEFAULT])
progressBarWait(20000) progressBarWait(20000)
checkNavigator(53, "Verifying whether all projects have been opened.") checkNavigator(53, "Verifying whether all projects have been opened.")
openDocument("animation.Resources.animation\\.qrc./animation.basics.animators\\.qml") openDocument("animation.Resources.animation\\.qrc./animation.basics.animators\\.qml")
......
...@@ -39,7 +39,7 @@ def main(): ...@@ -39,7 +39,7 @@ def main():
startApplication("qtcreator" + SettingsPath) startApplication("qtcreator" + SettingsPath)
if not startedWithoutPluginError(): if not startedWithoutPluginError():
return return
openQmakeProject(os.path.join(templateDir, proFile), Targets.DESKTOP_531_DEFAULT) openQmakeProject(os.path.join(templateDir, proFile), [Targets.DESKTOP_531_DEFAULT])
qmlFiles = [treebase + "focus\\.qml", treebase + "Core.ListMenu\\.qml"] qmlFiles = [treebase + "focus\\.qml", treebase + "Core.ListMenu\\.qml"]
checkOutlineFor(qmlFiles) checkOutlineFor(qmlFiles)
testModify() testModify()
......
...@@ -36,10 +36,10 @@ def main(): ...@@ -36,10 +36,10 @@ def main():
for qtVersion, controls in available: for qtVersion, controls in available:
if qtVersion == "5.3": if qtVersion == "5.3":
targ = Targets.DESKTOP_531_DEFAULT targ = [Targets.DESKTOP_531_DEFAULT]
quick = "2.3" quick = "2.3"
else: else:
targ = Targets.DESKTOP_541_GCC targ = [Targets.DESKTOP_541_GCC]
quick = "2.4" quick = "2.4"
# using a temporary directory won't mess up a potentially existing # using a temporary directory won't mess up a potentially existing
workingDir = tempDir() workingDir = tempDir()
......
...@@ -29,8 +29,8 @@ def main(): ...@@ -29,8 +29,8 @@ def main():
startApplication("qtcreator" + SettingsPath) startApplication("qtcreator" + SettingsPath)
if not startedWithoutPluginError(): if not startedWithoutPluginError():
return return
for targ, quickVer in [[Targets.DESKTOP_480_DEFAULT, 1], [Targets.DESKTOP_561_DEFAULT, 2], for targ, quickVer in [[[Targets.DESKTOP_480_DEFAULT], 1], [[Targets.DESKTOP_561_DEFAULT], 2],
[Targets.DESKTOP_531_DEFAULT, 2]]: [[Targets.DESKTOP_531_DEFAULT], 2]]:
# using a temporary directory won't mess up a potentially existing # using a temporary directory won't mess up a potentially existing
createNewQmlExtension(tempDir(), targ, quickVer) createNewQmlExtension(tempDir(), targ, quickVer)
# wait for parsing to complete # wait for parsing to complete
......
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