SquishTests: Fetch speedcrunch as needed

Change-Id: I4a2103bc58ae7ccdf4d728627f0346af40e6266e
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Robert Löhning
2022-11-04 17:50:19 +01:00
parent bb6a53240e
commit 0960156ada
5 changed files with 119 additions and 108 deletions

View File

@@ -36,10 +36,8 @@ Qt 6.2.4 (MSVC2019, 64bit)
Third - you'll have to provide some additional repositories.
These additional repositories are located inside ~/squish-data or C:\Users\<user>\squish-data (depending on the OS you're on).
You can also just provide them inside a different folder and specify the folder with the environment variable SYSTEST_SRCPATH.
This folder must contain the following:
* a QtCreator repository (or source copy) of tag v4.7.0 named 'creator' including the submodule src/shared/qbs
* a subfolder called 'creator-test-data'
* a speedcrunch 0.11 repository (or source copy) inside 'creator-test-data' named 'speedcrunch'
This folder must contain a QtCreator repository (or source copy) of tag v4.7.0 named 'creator'
including the submodule src/shared/qbs
Fourth - you'll have to make sure that some needed tools are available (no matter on which OS you're on).
* cmake 3.14 or newer

View File

@@ -606,3 +606,24 @@ def stringify(obj):
if isinstance(obj, bytes):
tmp = obj.decode('cp1252') if platform.system() in ('Microsoft','Windows') else obj.decode()
return tmp
class GitClone:
def __init__(self, url, revision):
self.localPath = os.path.join(tempDir(),
url.rsplit('/', 1)[1].rsplit('.')[0])
self.url = url
self.revision = revision
def __enter__(self):
try:
subprocess.check_call(["git", "clone", "-b", self.revision,
"--depth", "1", self.url, self.localPath])
return self.localPath
except subprocess.CalledProcessError as e:
test.warning("Could not clone git repository %s" % self.url, str(e))
return None
def __exit__(self, exc_type, exc_value, traceback):
deleteDirIfExists(self.localPath)

View File

@@ -3,7 +3,6 @@
source("../../shared/qtcreator.py")
SpeedCrunchPath = ""
def buildConfigFromFancyToolButton(fancyToolButton):
beginOfBuildConfig = "<b>Build:</b> "
@@ -14,44 +13,37 @@ def buildConfigFromFancyToolButton(fancyToolButton):
return toolTipText[beginIndex:endIndex]
def main():
if not neededFilePresent(SpeedCrunchPath):
return
startQC()
if not startedWithoutPluginError():
return
openQmakeProject(SpeedCrunchPath, [Targets.DESKTOP_5_14_1_DEFAULT])
waitForProjectParsing()
with GitClone("https://bitbucket.org/heldercorreia/speedcrunch.git",
"release-0.12.0") as SpeedCrunchPath:
if not SpeedCrunchPath:
test.fatal("Could not clone SpeedCrunch")
return
startQC()
if not startedWithoutPluginError():
return
openQmakeProject(os.path.join(SpeedCrunchPath, "src", "speedcrunch.pro"),
[Targets.DESKTOP_5_14_1_DEFAULT])
waitForProjectParsing()
fancyToolButton = waitForObject(":*Qt Creator_Core::Internal::FancyToolButton")
fancyToolButton = waitForObject(":*Qt Creator_Core::Internal::FancyToolButton")
availableConfigs = iterateBuildConfigs("Release")
if not availableConfigs:
test.fatal("Haven't found a suitable Qt version (need Release build) - leaving without building.")
for kit, config in availableConfigs:
selectBuildConfig(kit, config)
buildConfig = buildConfigFromFancyToolButton(fancyToolButton)
if buildConfig != config:
test.fatal("Build configuration %s is selected instead of %s" % (buildConfig, config))
continue
test.log("Testing build configuration: " + config)
invokeMenuItem("Build", "Run qmake")
waitForCompile()
selectFromLocator("t rebuild", "Rebuild All Projects")
waitForCompile(300000)
checkCompile()
checkLastBuild()
availableConfigs = iterateBuildConfigs("Release")
if not availableConfigs:
test.fatal("Haven't found a suitable Qt version (need Release build) - leaving without building.")
for kit, config in availableConfigs:
selectBuildConfig(kit, config)
buildConfig = buildConfigFromFancyToolButton(fancyToolButton)
if buildConfig != config:
test.fatal("Build configuration %s is selected instead of %s" % (buildConfig, config))
continue
test.log("Testing build configuration: " + config)
invokeMenuItem("Build", "Run qmake")
waitForCompile()
selectFromLocator("t rebuild", "Rebuild All Projects")
waitForCompile(300000)
checkCompile()
checkLastBuild()
# Add a new run configuration
# Add a new run configuration
invokeMenuItem("File", "Exit")
def init():
global SpeedCrunchPath
SpeedCrunchPath = os.path.join(srcPath, "creator-test-data", "speedcrunch", "src", "speedcrunch.pro")
cleanup()
def cleanup():
# Make sure the .user files are gone
cleanUpUserFiles(SpeedCrunchPath)
for dir in glob.glob(os.path.join(srcPath, "creator-test-data", "speedcrunch", "speedcrunch-build-*")):
deleteDirIfExists(dir)
invokeMenuItem("File", "Exit")

View File

@@ -3,7 +3,6 @@
source("../../shared/qtcreator.py")
SpeedCrunchPath = ""
BuildPath = tempDir()
def cmakeSupported():
@@ -27,39 +26,36 @@ def main():
if not cmakeSupported():
test.warning("CMake version is no more supported for QC")
return
if not neededFilePresent(SpeedCrunchPath):
return
startQC()
if not startedWithoutPluginError():
return
result = openCmakeProject(SpeedCrunchPath, BuildPath)
if not result:
test.fatal("Could not open/create cmake project - leaving test")
with GitClone("https://bitbucket.org/heldercorreia/speedcrunch.git",
"release-0.12.0") as SpeedCrunchPath:
if not SpeedCrunchPath:
test.fatal("Could not clone SpeedCrunch")
return
startQC()
if not startedWithoutPluginError():
return
result = openCmakeProject(os.path.join(SpeedCrunchPath, "src", "CMakeLists.txt"),
BuildPath)
if not result:
test.fatal("Could not open/create cmake project - leaving test")
invokeMenuItem("File", "Exit")
return
waitForProjectParsing()
naviTreeView = "{column='0' container=':Qt Creator_Utils::NavigationTreeView' text~='%s' type='QModelIndex'}"
treeFile = "projecttree_speedcrunch.tsv"
compareProjectTree(naviTreeView % "speedcrunch( \[\S+\])?", treeFile)
# Invoke a rebuild of the application
selectFromLocator("t rebuild", "Rebuild All Projects")
# Wait for, and test if the build succeeded
waitForCompile(300000)
checkCompile()
checkLastBuild()
invokeMenuItem("File", "Exit")
return
waitForProjectParsing()
naviTreeView = "{column='0' container=':Qt Creator_Utils::NavigationTreeView' text~='%s' type='QModelIndex'}"
treeFile = "projecttree_speedcrunch.tsv"
compareProjectTree(naviTreeView % "speedcrunch( \[\S+\])?", treeFile)
# Invoke a rebuild of the application
selectFromLocator("t rebuild", "Rebuild All Projects")
# Wait for, and test if the build succeeded
waitForCompile(300000)
checkCompile()
checkLastBuild()
invokeMenuItem("File", "Exit")
def init():
global SpeedCrunchPath
SpeedCrunchPath = srcPath + "/creator-test-data/speedcrunch/src/CMakeLists.txt"
cleanup()
def cleanup():
global BuildPath
# Make sure the .user files are gone
cleanUpUserFiles(SpeedCrunchPath)
deleteDirIfExists(BuildPath)

View File

@@ -5,51 +5,55 @@ source("../../shared/qtcreator.py")
def main():
pathCreator = srcPath + "/creator/qtcreator.pro"
pathSpeedcrunch = srcPath + "/creator-test-data/speedcrunch/src/speedcrunch.pro"
if not neededFilePresent(pathCreator) or not neededFilePresent(pathSpeedcrunch):
if not neededFilePresent(pathCreator):
return
startQC()
if not startedWithoutPluginError():
return
with GitClone("https://bitbucket.org/heldercorreia/speedcrunch.git",
"0.11") as pathSpeedcrunch:
if not pathSpeedcrunch:
test.fatal("Could not clone SpeedCrunch")
return
startQC()
if not startedWithoutPluginError():
return
runButton = findObject(':*Qt Creator.Run_Core::Internal::FancyToolButton')
openQmakeProject(pathSpeedcrunch, [Targets.DESKTOP_5_14_1_DEFAULT])
# Wait for parsing to complete
waitFor("runButton.enabled", 30000)
# Starting before opening, because this is where Creator froze (QTCREATORBUG-10733)
startopening = datetime.utcnow()
openQmakeProject(pathCreator, [Targets.DESKTOP_5_10_1_DEFAULT])
# Wait for parsing to complete
startreading = datetime.utcnow()
waitFor("runButton.enabled", 300000)
secondsOpening = (datetime.utcnow() - startopening).seconds
secondsReading = (datetime.utcnow() - startreading).seconds
timeoutOpen = 45
timeoutRead = 22
test.verify(secondsOpening <= timeoutOpen, "Opening and reading qtcreator.pro took %d seconds. "
"It should not take longer than %d seconds" % (secondsOpening, timeoutOpen))
test.verify(secondsReading <= timeoutRead, "Just reading qtcreator.pro took %d seconds. "
"It should not take longer than %d seconds" % (secondsReading, timeoutRead))
runButton = findObject(':*Qt Creator.Run_Core::Internal::FancyToolButton')
openQmakeProject(os.path.join(pathSpeedcrunch, "src", "speedcrunch.pro"),
[Targets.DESKTOP_5_14_1_DEFAULT])
# Wait for parsing to complete
waitFor("runButton.enabled", 30000)
# Starting before opening, because this is where Creator froze (QTCREATORBUG-10733)
startopening = datetime.utcnow()
openQmakeProject(pathCreator, [Targets.DESKTOP_5_10_1_DEFAULT])
# Wait for parsing to complete
startreading = datetime.utcnow()
waitFor("runButton.enabled", 300000)
secondsOpening = (datetime.utcnow() - startopening).seconds
secondsReading = (datetime.utcnow() - startreading).seconds
timeoutOpen = 45
timeoutRead = 22
test.verify(secondsOpening <= timeoutOpen, "Opening and reading qtcreator.pro took %d seconds. "
"It should not take longer than %d seconds" % (secondsOpening, timeoutOpen))
test.verify(secondsReading <= timeoutRead, "Just reading qtcreator.pro took %d seconds. "
"It should not take longer than %d seconds" % (secondsReading, timeoutRead))
naviTreeView = "{column='0' container=':Qt Creator_Utils::NavigationTreeView' text~='%s' type='QModelIndex'}"
compareProjectTree(naviTreeView % "speedcrunch( \[\S+\])?", "projecttree_speedcrunch.tsv")
compareProjectTree(naviTreeView % "qtcreator( \[\S+\])?", "projecttree_creator.tsv")
naviTreeView = "{column='0' container=':Qt Creator_Utils::NavigationTreeView' text~='%s' type='QModelIndex'}"
compareProjectTree(naviTreeView % "speedcrunch( \[\S+\])?", "projecttree_speedcrunch.tsv")
compareProjectTree(naviTreeView % "qtcreator( \[\S+\])?", "projecttree_creator.tsv")
openGeneralMessages()
# Verify that qmljs.g is in the project even when we don't know where (QTCREATORBUG-17609)
selectFromLocator("p qmljs.g", "qmljs.g")
# Now check some basic lookups in the search box
selectFromLocator(": qlist::qlist", "QList::QList")
test.compare(wordUnderCursor(waitForObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget")), "QList")
openGeneralMessages()
# Verify that qmljs.g is in the project even when we don't know where (QTCREATORBUG-17609)
selectFromLocator("p qmljs.g", "qmljs.g")
# Now check some basic lookups in the search box
selectFromLocator(": qlist::qlist", "QList::QList")
test.compare(wordUnderCursor(waitForObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget")), "QList")
invokeMenuItem("File", "Exit")
invokeMenuItem("File", "Exit")
def init():
cleanup()
def cleanup():
# Make sure the .user files are gone
cleanUpUserFiles([srcPath + "/creator-test-data/speedcrunch/src/speedcrunch.pro",
srcPath + "/creator/qtcreator.pro"])
cleanUpUserFiles([srcPath + "/creator/qtcreator.pro"])