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,12 +13,16 @@ def buildConfigFromFancyToolButton(fancyToolButton):
return toolTipText[beginIndex:endIndex]
def main():
if not neededFilePresent(SpeedCrunchPath):
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(SpeedCrunchPath, [Targets.DESKTOP_5_14_1_DEFAULT])
openQmakeProject(os.path.join(SpeedCrunchPath, "src", "speedcrunch.pro"),
[Targets.DESKTOP_5_14_1_DEFAULT])
waitForProjectParsing()
fancyToolButton = waitForObject(":*Qt Creator_Core::Internal::FancyToolButton")
@@ -44,14 +47,3 @@ def main():
# 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)

View File

@@ -3,7 +3,6 @@
source("../../shared/qtcreator.py")
SpeedCrunchPath = ""
BuildPath = tempDir()
def cmakeSupported():
@@ -27,13 +26,17 @@ def main():
if not cmakeSupported():
test.warning("CMake version is no more supported for QC")
return
if not neededFilePresent(SpeedCrunchPath):
return
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(SpeedCrunchPath, BuildPath)
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")
@@ -53,13 +56,6 @@ def main():
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,16 +5,21 @@ 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
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])
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)
@@ -50,6 +55,5 @@ def init():
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"])