SquishTests: Fix path handling for pre-installed Qts

There is now a Qt6 and a new possible location.

Change-Id: I4feac6da2756bde77e98ce08f945ddefec7e2fb4
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Stenger
2023-02-22 14:40:41 +01:00
parent 3a7ab3ce8e
commit 0604027834

View File

@@ -21,6 +21,10 @@ class Targets:
"Desktop 5.14.1 default", "Desktop 5.14.1 default",
"Desktop 6.2.4"])) "Desktop 6.2.4"]))
@staticmethod
def isOnlineInstaller(target):
return target == Targets.DESKTOP_6_2_4
@staticmethod @staticmethod
def availableTargetClasses(ignoreValidity=False): def availableTargetClasses(ignoreValidity=False):
availableTargets = set(Targets.ALL_TARGETS) availableTargets = set(Targets.ALL_TARGETS)
@@ -81,13 +85,14 @@ class QtPath:
@staticmethod @staticmethod
def getPaths(pathSpec): def getPaths(pathSpec):
qt5targets = [Targets.DESKTOP_5_10_1_DEFAULT, Targets.DESKTOP_5_14_1_DEFAULT] qtTargets = [Targets.DESKTOP_5_10_1_DEFAULT, Targets.DESKTOP_5_14_1_DEFAULT,
Targets.DESKTOP_6_2_4]
if platform.system() != 'Darwin': if platform.system() != 'Darwin':
qt5targets.append(Targets.DESKTOP_5_4_1_GCC) qtTargets.append(Targets.DESKTOP_5_4_1_GCC)
if pathSpec == QtPath.DOCS: if pathSpec == QtPath.DOCS:
return map(lambda target: QtPath.docsPath(target), qt5targets) return map(lambda target: QtPath.docsPath(target), qtTargets)
elif pathSpec == QtPath.EXAMPLES: elif pathSpec == QtPath.EXAMPLES:
return map(lambda target: QtPath.examplesPath(target), qt5targets) return map(lambda target: QtPath.examplesPath(target), qtTargets)
else: else:
test.fatal("Unknown pathSpec given: %s" % str(pathSpec)) test.fatal("Unknown pathSpec given: %s" % str(pathSpec))
return [] return []
@@ -97,9 +102,9 @@ class QtPath:
if target not in Targets.ALL_TARGETS: if target not in Targets.ALL_TARGETS:
raise Exception("Unexpected target '%s'" % str(target)) raise Exception("Unexpected target '%s'" % str(target))
matcher = re.match("^Desktop (5\.\\d{1,2}\.\\d{1,2}).*$", Targets.getStringForTarget(target)) matcher = re.match("^Desktop ([56]\.\\d{1,2}\.\\d{1,2}).*$", Targets.getStringForTarget(target))
if matcher is None: if matcher is None:
raise Exception("Currently this is supported for Desktop Qt5 only, got target '%s'" raise Exception("Currently this is supported for Desktop Qt5/Qt6 only, got target '%s'"
% str(Targets.getStringForTarget(target))) % str(Targets.getStringForTarget(target)))
return matcher.group(1) return matcher.group(1)
@@ -110,34 +115,49 @@ class QtPath:
else: else:
return os.path.expanduser("~/Qt5.%d.1" % qt5Minor) return os.path.expanduser("~/Qt5.%d.1" % qt5Minor)
@staticmethod
def __createQtOnlineInstallerPath__():
qtBasePath = os.getenv('SYSTEST_QTOI_BASEPATH', None)
if qtBasePath is None:
qtBasePath = 'C:/Qt' if platform.system() in ('Microsoft', 'Windows') else '~/Qt'
qtBasePath = os.path.expanduser(qtBasePath)
if not os.path.exists(qtBasePath):
test.fatal("Unexpected Qt install path '%s'" % qtBasePath)
return ""
return qtBasePath
@staticmethod @staticmethod
def toVersionTuple(versionString): def toVersionTuple(versionString):
return tuple(map(__builtin__.int, versionString.split("."))) return tuple(map(__builtin__.int, versionString.split(".")))
@staticmethod @staticmethod
def getQtMinorAndPatchVersion(target): def getQtVersion(target):
qtVersionStr = QtPath.__preCheckAndExtractQtVersionStr__(target) qtVersionStr = QtPath.__preCheckAndExtractQtVersionStr__(target)
versionTuple = QtPath.toVersionTuple(qtVersionStr) versionTuple = QtPath.toVersionTuple(qtVersionStr)
return versionTuple[1], versionTuple[2] return versionTuple
@staticmethod @staticmethod
def examplesPath(target): def examplesPath(target):
qtMinorVersion, qtPatchVersion = QtPath.getQtMinorAndPatchVersion(target) qtMajorVersion, qtMinorVersion, qtPatchVersion = QtPath.getQtVersion(target)
if qtMinorVersion < 10: if qtMajorVersion == 5 and qtMinorVersion < 10:
path = "Examples/Qt-5.%d" % qtMinorVersion path = "Examples/Qt-%d.%d" % (qtMajorVersion, qtMinorVersion)
else: else:
path = "Examples/Qt-5.%d.%d" % (qtMinorVersion, qtPatchVersion) path = "Examples/Qt-%d.%d.%d" % (qtMajorVersion, qtMinorVersion, qtPatchVersion)
if Targets.isOnlineInstaller(target):
return os.path.join(QtPath.__createQtOnlineInstallerPath__(), path)
return os.path.join(QtPath.__createPlatformQtPath__(qtMinorVersion), path) return os.path.join(QtPath.__createPlatformQtPath__(qtMinorVersion), path)
@staticmethod @staticmethod
def docsPath(target): def docsPath(target):
qtMinorVersion, qtPatchVersion = QtPath.getQtMinorAndPatchVersion(target) qtMajorVersion, qtMinorVersion, qtPatchVersion = QtPath.getQtVersion(target)
if qtMinorVersion < 10: if qtMajorVersion == 5 and qtMinorVersion < 10:
path = "Docs/Qt-5.%d" % qtMinorVersion path = "Docs/Qt-%d.%d" % (qtMajorVersion, qtMinorVersion)
else: else:
path = "Docs/Qt-5.%d.%d" % (qtMinorVersion, qtPatchVersion) path = "Docs/Qt-%d.%d.%d" % (qtMajorVersion, qtMinorVersion, qtPatchVersion)
if Targets.isOnlineInstaller(target):
return os.path.join(QtPath.__createQtOnlineInstallerPath__(), path)
return os.path.join(QtPath.__createPlatformQtPath__(qtMinorVersion), path) return os.path.join(QtPath.__createPlatformQtPath__(qtMinorVersion), path)
class TestSection: class TestSection: