2016-01-15 14:55:33 +01:00
|
|
|
# Copyright (C) 2016 The Qt Company Ltd.
|
2022-12-21 10:12:09 +01:00
|
|
|
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
2013-05-15 13:17:33 +02:00
|
|
|
|
2013-01-31 15:51:09 +01:00
|
|
|
source("../../shared/qtcreator.py")
|
|
|
|
|
|
|
|
|
|
currentSelectedTreeItem = None
|
|
|
|
|
warningOrError = re.compile('<p><b>((Error|Warning).*?)</p>')
|
|
|
|
|
|
|
|
|
|
def main():
|
2018-10-01 11:22:45 +02:00
|
|
|
global appContext
|
2013-01-31 15:51:09 +01:00
|
|
|
emptySettings = tempDir()
|
|
|
|
|
__createMinimumIni__(emptySettings)
|
2018-10-01 11:22:45 +02:00
|
|
|
appContext = startQC(['-settingspath', '"%s"' % emptySettings], False)
|
2013-02-22 14:31:39 +01:00
|
|
|
if not startedWithoutPluginError():
|
|
|
|
|
return
|
2022-06-22 15:59:18 +02:00
|
|
|
invokeMenuItem("Edit", "Preferences...")
|
2018-05-31 17:28:49 +02:00
|
|
|
__checkKits__()
|
2013-01-31 15:51:09 +01:00
|
|
|
clickButton(waitForObject(":Options.Cancel_QPushButton"))
|
|
|
|
|
invokeMenuItem("File", "Exit")
|
|
|
|
|
__checkCreatedSettings__(emptySettings)
|
|
|
|
|
|
|
|
|
|
def __createMinimumIni__(emptyParent):
|
|
|
|
|
qtProjDir = os.path.join(emptyParent, "QtProject")
|
|
|
|
|
os.mkdir(qtProjDir)
|
|
|
|
|
iniFile = open(os.path.join(qtProjDir, "QtCreator.ini"), "w")
|
|
|
|
|
iniFile.write("[%General]\n")
|
|
|
|
|
iniFile.write("OverrideLanguage=C\n")
|
|
|
|
|
iniFile.close()
|
|
|
|
|
|
2018-05-31 17:28:49 +02:00
|
|
|
def __checkKits__():
|
2019-07-24 15:12:16 +02:00
|
|
|
mouseClick(waitForObjectItem(":Options_QListView", "Kits"))
|
2013-01-31 15:51:09 +01:00
|
|
|
# check compilers
|
|
|
|
|
expectedCompilers = __getExpectedCompilers__()
|
2023-02-01 14:42:24 +01:00
|
|
|
llvmForBuild = os.getenv("SYSTEST_LLVM_FROM_BUILD", None)
|
|
|
|
|
if llvmForBuild is not None:
|
|
|
|
|
internalClangExe = os.path.join(llvmForBuild, "bin", "clang")
|
|
|
|
|
if platform.system() in ("Microsoft", "Windows"):
|
|
|
|
|
internalClangExe.append(".exe")
|
|
|
|
|
if os.path.exists(internalClangExe):
|
|
|
|
|
expectedCompilers.append(internalClangExe)
|
2013-01-31 15:51:09 +01:00
|
|
|
foundCompilers = []
|
|
|
|
|
foundCompilerNames = []
|
2013-05-22 09:41:37 +02:00
|
|
|
clickOnTab(":Options.qt_tabwidget_tabbar_QTabBar", "Compilers")
|
2014-03-20 11:09:41 +01:00
|
|
|
__iterateTree__(":BuildAndRun_QTreeView", __compFunc__, foundCompilers, foundCompilerNames)
|
2013-01-31 15:51:09 +01:00
|
|
|
test.verify(__compareCompilers__(foundCompilers, expectedCompilers),
|
|
|
|
|
"Verifying found and expected compilers are equal.")
|
2013-12-17 13:52:28 +01:00
|
|
|
# check debugger
|
|
|
|
|
expectedDebuggers = __getExpectedDebuggers__()
|
|
|
|
|
clickOnTab(":Options.qt_tabwidget_tabbar_QTabBar", "Debuggers")
|
|
|
|
|
foundDebugger = []
|
2014-03-20 11:09:41 +01:00
|
|
|
__iterateTree__(":BuildAndRun_QTreeView", __dbgFunc__, foundDebugger)
|
2013-12-17 13:52:28 +01:00
|
|
|
test.verify(__compareDebuggers__(foundDebugger, expectedDebuggers),
|
|
|
|
|
"Verifying found and expected debuggers are equal.")
|
2013-01-31 15:51:09 +01:00
|
|
|
# check Qt versions
|
|
|
|
|
qmakePath = which("qmake")
|
|
|
|
|
foundQt = []
|
2013-05-22 09:41:37 +02:00
|
|
|
clickOnTab(":Options.qt_tabwidget_tabbar_QTabBar", "Qt Versions")
|
2015-10-29 14:30:58 +01:00
|
|
|
__iterateTree__(":qtdirList_QTreeView", __qtFunc__, foundQt, qmakePath)
|
2015-08-10 11:49:03 +02:00
|
|
|
test.verify(not qmakePath or len(foundQt) == 1,
|
|
|
|
|
"Was qmake from %s autodetected? Found %s" % (qmakePath, foundQt))
|
2013-01-31 15:51:09 +01:00
|
|
|
if foundQt:
|
2015-08-10 11:49:03 +02:00
|
|
|
foundQt = foundQt[0] # qmake from "which" should be used in kits
|
2013-01-31 15:51:09 +01:00
|
|
|
# check kits
|
2013-05-22 09:41:37 +02:00
|
|
|
clickOnTab(":Options.qt_tabwidget_tabbar_QTabBar", "Kits")
|
2014-03-20 11:09:41 +01:00
|
|
|
__iterateTree__(":BuildAndRun_QTreeView", __kitFunc__, foundQt, foundCompilerNames)
|
2013-01-31 15:51:09 +01:00
|
|
|
|
2016-10-17 12:57:43 +02:00
|
|
|
def __processSubItems__(treeObjStr, section, parModelIndexStr, doneItems,
|
|
|
|
|
additionalFunc, *additionalParameters):
|
|
|
|
|
global currentSelectedTreeItem
|
2017-02-10 12:59:01 +01:00
|
|
|
tree = waitForObject(treeObjStr)
|
|
|
|
|
model = tree.model()
|
2016-10-17 12:57:43 +02:00
|
|
|
items = dumpIndices(model, section)
|
|
|
|
|
for it in items:
|
|
|
|
|
indexName = str(it.data().toString())
|
|
|
|
|
itObj = "%s container=%s}" % (objectMap.realName(it)[:-1], parModelIndexStr)
|
|
|
|
|
alreadyDone = doneItems.count(itObj)
|
|
|
|
|
doneItems.append(itObj)
|
|
|
|
|
if alreadyDone:
|
|
|
|
|
itObj = "%s occurrence='%d'}" % (itObj[:-1], alreadyDone + 1)
|
|
|
|
|
currentSelectedTreeItem = waitForObject(itObj, 3000)
|
2017-02-10 12:59:01 +01:00
|
|
|
tree.scrollTo(it)
|
2019-07-30 13:04:28 +02:00
|
|
|
mouseClick(currentSelectedTreeItem, 5, 5, 0, Qt.LeftButton)
|
2016-10-17 12:57:43 +02:00
|
|
|
additionalFunc(indexName, *additionalParameters)
|
|
|
|
|
currentSelectedTreeItem = None
|
|
|
|
|
if model.rowCount(it) > 0:
|
|
|
|
|
__processSubItems__(treeObjStr, it, itObj, doneItems,
|
|
|
|
|
additionalFunc, *additionalParameters)
|
|
|
|
|
|
2014-03-20 11:09:41 +01:00
|
|
|
def __iterateTree__(treeObjStr, additionalFunc, *additionalParameters):
|
2013-01-31 15:51:09 +01:00
|
|
|
global currentSelectedTreeItem
|
2014-03-20 11:09:41 +01:00
|
|
|
model = waitForObject(treeObjStr).model()
|
2013-01-31 15:51:09 +01:00
|
|
|
# 1st row: Auto-detected, 2nd row: Manual
|
|
|
|
|
for sect in dumpIndices(model):
|
|
|
|
|
doneItems = []
|
2016-10-17 12:57:43 +02:00
|
|
|
parentModelIndex = "%s container='%s'}" % (objectMap.realName(sect)[:-1], treeObjStr)
|
|
|
|
|
__processSubItems__(treeObjStr, sect, parentModelIndex, doneItems,
|
|
|
|
|
additionalFunc, *additionalParameters)
|
2013-01-31 15:51:09 +01:00
|
|
|
|
|
|
|
|
def __compFunc__(it, foundComp, foundCompNames):
|
2016-10-17 12:57:43 +02:00
|
|
|
# skip sub section items (will continue on its children)
|
|
|
|
|
if str(it) == "C" or str(it) == "C++":
|
|
|
|
|
return
|
2013-01-31 15:51:09 +01:00
|
|
|
try:
|
2013-12-17 13:52:28 +01:00
|
|
|
waitFor("object.exists(':Path.Utils_BaseValidatingLineEdit')", 1000)
|
|
|
|
|
pathLineEdit = findObject(":Path.Utils_BaseValidatingLineEdit")
|
2013-01-31 15:51:09 +01:00
|
|
|
foundComp.append(str(pathLineEdit.text))
|
|
|
|
|
except:
|
2021-02-24 10:26:45 +01:00
|
|
|
varsBatComboStr = "{name='varsBatCombo' type='QComboBox' visible='1'}"
|
|
|
|
|
varsBatCombo = waitForObjectExists(varsBatComboStr)
|
|
|
|
|
parameterComboStr = "{type='QComboBox' visible='1' unnamed='1' leftWidget=%s}" % varsBatComboStr
|
|
|
|
|
try:
|
|
|
|
|
parameterCombo = findObject(parameterComboStr)
|
|
|
|
|
parameter = ' ' + str(parameterCombo.currentText)
|
|
|
|
|
except:
|
|
|
|
|
parameter = ''
|
|
|
|
|
foundComp.append({it:str(varsBatCombo.currentText) + parameter})
|
2019-06-14 13:52:34 +02:00
|
|
|
|
2013-01-31 15:51:09 +01:00
|
|
|
foundCompNames.append(it)
|
|
|
|
|
|
2013-12-17 13:52:28 +01:00
|
|
|
def __dbgFunc__(it, foundDbg):
|
2016-05-24 12:49:32 +02:00
|
|
|
waitFor("object.exists(':Path.Utils_BaseValidatingLineEdit')", 2000)
|
2013-12-17 13:52:28 +01:00
|
|
|
pathLineEdit = findObject(":Path.Utils_BaseValidatingLineEdit")
|
|
|
|
|
foundDbg.append(str(pathLineEdit.text))
|
|
|
|
|
|
2013-01-31 15:51:09 +01:00
|
|
|
def __qtFunc__(it, foundQt, qmakePath):
|
|
|
|
|
qtPath = str(waitForObject(":QtSupport__Internal__QtVersionManager.qmake_QLabel").text)
|
|
|
|
|
if platform.system() in ('Microsoft', 'Windows'):
|
|
|
|
|
qtPath = qtPath.lower()
|
|
|
|
|
qmakePath = qmakePath.lower()
|
2015-08-10 11:49:03 +02:00
|
|
|
test.verify(os.path.isfile(qtPath) and os.access(qtPath, os.X_OK),
|
|
|
|
|
"Verifying found Qt (%s) is executable." % qtPath)
|
|
|
|
|
# Two Qt versions will be found when using qtchooser: QTCREATORBUG-14697
|
|
|
|
|
# Only add qmake from "which" to list
|
|
|
|
|
if qtPath == qmakePath:
|
|
|
|
|
foundQt.append(it)
|
2013-01-31 15:51:09 +01:00
|
|
|
try:
|
|
|
|
|
errorLabel = findObject(":QtSupport__Internal__QtVersionManager.errorLabel.QLabel")
|
|
|
|
|
test.warning("Detected error or warning: '%s'" % errorLabel.text)
|
|
|
|
|
except:
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
def __kitFunc__(it, foundQt, foundCompNames):
|
|
|
|
|
global currentSelectedTreeItem, warningOrError
|
2021-03-12 13:44:52 +01:00
|
|
|
qtVersionStr = str(waitForObjectExists(":Kits_QtVersion_QComboBox").currentText)
|
2023-03-31 16:47:22 +02:00
|
|
|
# The following may fail if Creator doesn't find a Qt version in PATH. It will then create one
|
|
|
|
|
# Qt-less kit for each available toolchain instead of just one default Desktop kit.
|
|
|
|
|
# Since Qt usually is in PATH on the test machines anyway, we consider this too much of a
|
|
|
|
|
# corner case to add error handling code or make Qt in PATH a hard requirement for the tests.
|
2013-01-31 15:51:09 +01:00
|
|
|
test.compare(it, "Desktop (default)", "Verifying whether default Desktop kit has been created.")
|
|
|
|
|
if foundQt:
|
|
|
|
|
test.compare(qtVersionStr, foundQt, "Verifying if Qt versions match.")
|
2016-10-17 12:57:43 +02:00
|
|
|
cCompilerCombo = findObject(":CCompiler:_QComboBox")
|
|
|
|
|
test.compare(cCompilerCombo.enabled, cCompilerCombo.count > 1,
|
|
|
|
|
"Verifying whether C compiler combo is enabled/disabled correctly.")
|
|
|
|
|
cppCompilerCombo = findObject(":CppCompiler:_QComboBox")
|
|
|
|
|
test.compare(cppCompilerCombo.enabled, cppCompilerCombo.count > 1,
|
|
|
|
|
"Verifying whether C++ compiler combo is enabled/disabled correctly.")
|
2015-03-16 13:27:35 +01:00
|
|
|
|
2016-10-17 12:57:43 +02:00
|
|
|
test.verify(str(cCompilerCombo.currentText) in foundCompNames,
|
|
|
|
|
"Verifying if one of the found C compilers had been set.")
|
|
|
|
|
test.verify(str(cppCompilerCombo.currentText) in foundCompNames,
|
|
|
|
|
"Verifying if one of the found C++ compilers had been set.")
|
2013-01-31 15:51:09 +01:00
|
|
|
if currentSelectedTreeItem:
|
|
|
|
|
foundWarningOrError = warningOrError.search(str(currentSelectedTreeItem.toolTip))
|
|
|
|
|
if foundWarningOrError:
|
|
|
|
|
details = str(foundWarningOrError.group(1)).replace("<br>", "\n")
|
|
|
|
|
details = details.replace("<b>", "").replace("</b>", "")
|
|
|
|
|
test.warning("Detected error and/or warning: %s" % details)
|
|
|
|
|
|
2021-02-24 10:26:45 +01:00
|
|
|
def __LLVMInRegistry__():
|
|
|
|
|
# following only works on Win64 (Win32 has different registry keys)
|
|
|
|
|
try:
|
|
|
|
|
output = subprocess.check_output(['reg', 'query',
|
|
|
|
|
r'HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\LLVM\LLVM'],
|
|
|
|
|
shell=True)
|
|
|
|
|
for line in output.splitlines():
|
|
|
|
|
if '(Default)' in line:
|
|
|
|
|
path = line.split(' REG_SZ ')[1].strip()
|
|
|
|
|
if os.path.exists(os.path.join(path, 'bin', 'clang-cl.exe')):
|
|
|
|
|
return True
|
|
|
|
|
except subprocess.CalledProcessError:
|
|
|
|
|
pass
|
|
|
|
|
return False
|
|
|
|
|
|
2013-01-31 15:51:09 +01:00
|
|
|
def __getExpectedCompilers__():
|
2016-10-17 12:57:43 +02:00
|
|
|
# TODO: enhance this to distinguish between C and C++ compilers
|
2013-01-31 15:51:09 +01:00
|
|
|
expected = []
|
|
|
|
|
if platform.system() in ('Microsoft', 'Windows'):
|
|
|
|
|
expected.extend(__getWinCompilers__())
|
2016-10-17 12:57:43 +02:00
|
|
|
compilers = ["g++", "gcc"]
|
2013-01-31 15:51:09 +01:00
|
|
|
if platform.system() in ('Linux', 'Darwin'):
|
2021-03-04 22:08:03 +01:00
|
|
|
for c in ('clang++', 'clang', 'afl-clang',
|
|
|
|
|
'clang-[0-9]', 'clang-[0-9].[0-9]', 'clang-1[0-9]', 'clang-1[0-9].[0-9]',
|
2019-12-03 07:34:54 +01:00
|
|
|
'*g++*', '*gcc*'):
|
|
|
|
|
compilers.extend(findAllFilesInPATH(c))
|
2014-03-10 15:19:29 +01:00
|
|
|
if platform.system() == 'Darwin':
|
2018-04-16 15:49:31 +02:00
|
|
|
for compilerExe in ('clang++', 'clang'):
|
|
|
|
|
xcodeClang = getOutputFromCmdline(["xcrun", "--find", compilerExe]).strip("\n")
|
|
|
|
|
if xcodeClang and os.path.exists(xcodeClang) and xcodeClang not in expected:
|
|
|
|
|
expected.append(xcodeClang)
|
2018-10-01 11:22:45 +02:00
|
|
|
|
2021-02-24 10:26:45 +01:00
|
|
|
if platform.system() in ('Microsoft', 'Windows'):
|
|
|
|
|
clangClInPath = len(findAllFilesInPATH('clang-cl.exe'))
|
|
|
|
|
if clangClInPath > 0 or __LLVMInRegistry__():
|
|
|
|
|
expected.append({'^LLVM \d{2} bit based on MSVC\d{4}$' : ''})
|
|
|
|
|
|
2013-01-31 15:51:09 +01:00
|
|
|
for compiler in compilers:
|
|
|
|
|
compilerPath = which(compiler)
|
|
|
|
|
if compilerPath:
|
2016-10-17 12:57:43 +02:00
|
|
|
if compiler.endswith('clang++') or compiler.endswith('clang'):
|
2014-03-10 15:19:29 +01:00
|
|
|
if subprocess.call([compiler, '-dumpmachine']) != 0:
|
2013-01-31 15:51:09 +01:00
|
|
|
test.warning("clang found in PATH, but version is not supported.")
|
|
|
|
|
continue
|
|
|
|
|
expected.append(compilerPath)
|
|
|
|
|
return expected
|
|
|
|
|
|
|
|
|
|
def __getWinCompilers__():
|
|
|
|
|
result = []
|
|
|
|
|
for record in testData.dataset("win_compiler_paths.tsv"):
|
2015-09-18 17:18:31 +02:00
|
|
|
envvar = os.getenv(testData.field(record, "envvar"))
|
|
|
|
|
if not envvar:
|
|
|
|
|
continue
|
2013-01-31 15:51:09 +01:00
|
|
|
compiler = os.path.abspath(os.path.join(envvar, testData.field(record, "path"),
|
|
|
|
|
testData.field(record, "file")))
|
|
|
|
|
if os.path.exists(compiler):
|
|
|
|
|
parameters = testData.field(record, "displayedParameters").split(",")
|
|
|
|
|
usedParameters = testData.field(record, "usedParameters").split(",")
|
2016-04-06 09:00:19 +02:00
|
|
|
idePath = testData.field(record, "IDEPath")
|
2021-02-24 10:26:45 +01:00
|
|
|
displayName = testData.field(record, 'displayName')
|
2016-04-06 09:00:19 +02:00
|
|
|
if len(idePath):
|
|
|
|
|
if not os.path.exists(os.path.abspath(os.path.join(envvar, idePath))):
|
|
|
|
|
continue
|
2013-01-31 15:51:09 +01:00
|
|
|
if testData.field(record, "isSDK") == "true":
|
|
|
|
|
for para, used in zip(parameters, usedParameters):
|
|
|
|
|
result.append(
|
2021-02-24 10:26:45 +01:00
|
|
|
{"%s \(.*?\) \(%s\)" % (displayName, para)
|
|
|
|
|
: "%s %s" % (compiler, used)})
|
2013-01-31 15:51:09 +01:00
|
|
|
else:
|
|
|
|
|
for para, used in zip(parameters, usedParameters):
|
2021-02-24 10:26:45 +01:00
|
|
|
if "[.0-9]+" in displayName:
|
|
|
|
|
result.append({"%s \(%s\)" % (displayName, para)
|
|
|
|
|
: "%s %s" % (compiler, used)})
|
|
|
|
|
else:
|
|
|
|
|
result.append({"%s (%s)" % (displayName, para)
|
|
|
|
|
: "%s %s" % (compiler, used)})
|
2013-01-31 15:51:09 +01:00
|
|
|
return result
|
|
|
|
|
|
2013-12-17 13:52:28 +01:00
|
|
|
def __getExpectedDebuggers__():
|
2015-09-18 17:18:31 +02:00
|
|
|
exeSuffix = ""
|
2013-12-17 13:52:28 +01:00
|
|
|
result = []
|
|
|
|
|
if platform.system() in ('Microsoft', 'Windows'):
|
|
|
|
|
result.extend(__getCDB__())
|
2015-09-18 17:18:31 +02:00
|
|
|
exeSuffix = ".exe"
|
2014-07-02 13:22:33 +02:00
|
|
|
for debugger in ["gdb", "lldb"]:
|
2015-09-18 17:18:31 +02:00
|
|
|
result.extend(findAllFilesInPATH(debugger + exeSuffix))
|
2014-02-04 16:27:28 +01:00
|
|
|
if platform.system() == 'Linux':
|
2015-08-10 11:49:03 +02:00
|
|
|
result.extend(filter(lambda s: not ("lldb-platform" in s or "lldb-gdbserver" in s),
|
|
|
|
|
findAllFilesInPATH("lldb-*")))
|
2014-01-16 14:05:20 +01:00
|
|
|
if platform.system() == 'Darwin':
|
2016-05-26 18:51:15 +02:00
|
|
|
xcodeLLDB = getOutputFromCmdline(["xcrun", "--find", "lldb"]).strip("\n")
|
2014-02-04 09:26:29 +01:00
|
|
|
if xcodeLLDB and os.path.exists(xcodeLLDB) and xcodeLLDB not in result:
|
2014-01-16 14:05:20 +01:00
|
|
|
result.append(xcodeLLDB)
|
2013-12-17 13:52:28 +01:00
|
|
|
return result
|
|
|
|
|
|
|
|
|
|
def __getCDB__():
|
|
|
|
|
result = []
|
|
|
|
|
possibleLocations = ["C:\\Program Files\\Debugging Tools for Windows (x64)",
|
2014-02-20 13:50:52 +01:00
|
|
|
"C:\\Program Files (x86)\\Debugging Tools for Windows (x86)",
|
2013-12-17 13:52:28 +01:00
|
|
|
"C:\\Program Files (x86)\\Windows Kits\\8.0\\Debuggers\\x86",
|
2014-06-30 08:24:13 +02:00
|
|
|
"C:\\Program Files (x86)\\Windows Kits\\8.0\\Debuggers\\x64",
|
2013-12-17 13:52:28 +01:00
|
|
|
"C:\\Program Files\\Windows Kits\\8.0\\Debuggers\\x86",
|
2014-06-30 08:24:13 +02:00
|
|
|
"C:\\Program Files\\Windows Kits\\8.0\\Debuggers\\x64",
|
2013-12-17 13:52:28 +01:00
|
|
|
"C:\\Program Files (x86)\\Windows Kits\\8.1\\Debuggers\\x86",
|
2014-06-30 08:24:13 +02:00
|
|
|
"C:\\Program Files (x86)\\Windows Kits\\8.1\\Debuggers\\x64",
|
|
|
|
|
"C:\\Program Files\\Windows Kits\\8.1\\Debuggers\\x86",
|
2017-02-03 17:34:03 +01:00
|
|
|
"C:\\Program Files\\Windows Kits\\8.1\\Debuggers\\x64",
|
|
|
|
|
"C:\\Program Files (x86)\\Windows Kits\\10\\Debuggers\\x86",
|
|
|
|
|
"C:\\Program Files (x86)\\Windows Kits\\10\\Debuggers\\x64"]
|
2013-12-17 13:52:28 +01:00
|
|
|
for cdbPath in possibleLocations:
|
|
|
|
|
cdb = os.path.join(cdbPath, "cdb.exe")
|
|
|
|
|
if os.path.exists(cdb):
|
|
|
|
|
result.append(cdb)
|
|
|
|
|
return result
|
2013-01-31 15:51:09 +01:00
|
|
|
|
|
|
|
|
def __compareCompilers__(foundCompilers, expectedCompilers):
|
2015-09-18 17:18:31 +02:00
|
|
|
# TODO: Check if all expected compilers were found
|
2013-01-31 15:51:09 +01:00
|
|
|
equal = True
|
|
|
|
|
flags = 0
|
|
|
|
|
isWin = platform.system() in ('Microsoft', 'Windows')
|
|
|
|
|
if isWin:
|
|
|
|
|
flags = re.IGNORECASE
|
|
|
|
|
for currentFound in foundCompilers:
|
|
|
|
|
if isinstance(currentFound, dict):
|
|
|
|
|
foundExp = False
|
|
|
|
|
for currentExp in expectedCompilers:
|
2021-10-29 14:38:35 +02:00
|
|
|
if isString(currentExp):
|
2013-01-31 15:51:09 +01:00
|
|
|
continue
|
2023-03-21 10:10:03 +01:00
|
|
|
key = list(currentExp.keys())[0]
|
2013-01-31 15:51:09 +01:00
|
|
|
# the regex .*? is used for the different possible version strings of the WinSDK
|
|
|
|
|
# if it's present a regex will be validated otherwise simple string comparison
|
2021-02-24 10:26:45 +01:00
|
|
|
# same applies for [.0-9]+ which is used for minor/patch versions
|
|
|
|
|
isRegex = ".*?" in key or "[.0-9]+" in key
|
|
|
|
|
if (((isRegex and re.match(key, list(currentFound.keys())[0], flags)))
|
|
|
|
|
or currentFound.keys() == currentExp.keys()):
|
2013-01-31 15:51:09 +01:00
|
|
|
if ((isWin and os.path.abspath(currentFound.values()[0].lower())
|
|
|
|
|
== os.path.abspath(currentExp.values()[0].lower()))
|
|
|
|
|
or currentFound.values() == currentExp.values()):
|
|
|
|
|
foundExp = True
|
|
|
|
|
break
|
2015-09-18 17:18:31 +02:00
|
|
|
equal = foundExp
|
2013-01-31 15:51:09 +01:00
|
|
|
else:
|
|
|
|
|
if isWin:
|
|
|
|
|
equal = currentFound.lower() in __lowerStrs__(expectedCompilers)
|
|
|
|
|
else:
|
|
|
|
|
equal = currentFound in expectedCompilers
|
|
|
|
|
if not equal:
|
|
|
|
|
test.fail("Found '%s' but was not expected." % str(currentFound),
|
|
|
|
|
str(expectedCompilers))
|
|
|
|
|
break
|
|
|
|
|
return equal
|
|
|
|
|
|
2013-12-17 13:52:28 +01:00
|
|
|
def __compareDebuggers__(foundDebuggers, expectedDebuggers):
|
|
|
|
|
if not len(foundDebuggers) == len(expectedDebuggers):
|
|
|
|
|
test.log("Number of found and expected debuggers do not match.",
|
|
|
|
|
"Found: %s\nExpected: %s" % (str(foundDebuggers), str(expectedDebuggers)))
|
|
|
|
|
return False
|
|
|
|
|
if platform.system() in ('Microsoft', 'Windows'):
|
|
|
|
|
foundSet = set(__lowerStrs__(foundDebuggers))
|
|
|
|
|
expectedSet = set(__lowerStrs__(expectedDebuggers))
|
|
|
|
|
else:
|
|
|
|
|
foundSet = set(foundDebuggers)
|
|
|
|
|
expectedSet = set(expectedDebuggers)
|
2015-08-07 11:43:43 +02:00
|
|
|
return test.compare(foundSet, expectedSet,
|
|
|
|
|
"Verifying expected and found debuggers match.")
|
2013-12-17 13:52:28 +01:00
|
|
|
|
2013-01-31 15:51:09 +01:00
|
|
|
def __lowerStrs__(iterable):
|
|
|
|
|
for it in iterable:
|
2021-10-29 14:38:35 +02:00
|
|
|
if isString(it):
|
2013-01-31 15:51:09 +01:00
|
|
|
yield it.lower()
|
|
|
|
|
else:
|
|
|
|
|
yield it
|
|
|
|
|
|
|
|
|
|
def __checkCreatedSettings__(settingsFolder):
|
2013-03-08 09:31:49 +01:00
|
|
|
waitForCleanShutdown()
|
2013-01-31 15:51:09 +01:00
|
|
|
qtProj = os.path.join(settingsFolder, "QtProject")
|
|
|
|
|
folders = []
|
|
|
|
|
files = [{os.path.join(qtProj, "QtCreator.db"):0},
|
|
|
|
|
{os.path.join(qtProj, "QtCreator.ini"):30}]
|
|
|
|
|
folders.append(os.path.join(qtProj, "qtcreator"))
|
2013-12-17 13:52:28 +01:00
|
|
|
files.extend([{os.path.join(folders[0], "debuggers.xml"):0},
|
|
|
|
|
{os.path.join(folders[0], "devices.xml"):0},
|
2013-01-31 15:51:09 +01:00
|
|
|
{os.path.join(folders[0], "helpcollection.qhc"):0},
|
|
|
|
|
{os.path.join(folders[0], "profiles.xml"):0},
|
|
|
|
|
{os.path.join(folders[0], "qtversion.xml"):0},
|
|
|
|
|
{os.path.join(folders[0], "toolchains.xml"):0}])
|
|
|
|
|
folders.extend([os.path.join(folders[0], "generic-highlighter"),
|
|
|
|
|
os.path.join(folders[0], "macros")])
|
|
|
|
|
for f in folders:
|
|
|
|
|
test.verify(os.path.isdir(f),
|
|
|
|
|
"Verifying whether folder '%s' has been created." % os.path.basename(f))
|
|
|
|
|
for f in files:
|
2023-03-21 10:10:03 +01:00
|
|
|
fName = list(f.keys())[0]
|
|
|
|
|
fMinSize = list(f.values())[0]
|
2013-01-31 15:51:09 +01:00
|
|
|
text = "created non-empty"
|
|
|
|
|
if fMinSize > 0:
|
|
|
|
|
text = "modified"
|
|
|
|
|
test.verify(os.path.isfile(fName) and os.path.getsize(fName) > fMinSize,
|
|
|
|
|
"Verifying whether file '%s' has been %s." % (os.path.basename(fName), text))
|
2014-02-04 16:27:28 +01:00
|
|
|
|
|
|
|
|
def findAllFilesInPATH(programGlob):
|
|
|
|
|
result = []
|
|
|
|
|
for path in os.environ["PATH"].split(os.pathsep):
|
2014-02-11 13:48:44 +01:00
|
|
|
for curr in glob.glob(os.path.join(path, programGlob)):
|
2014-02-14 12:30:00 +01:00
|
|
|
if os.path.isfile(curr) and os.access(curr, os.X_OK):
|
2014-02-11 13:48:44 +01:00
|
|
|
result.append(curr)
|
2014-02-04 16:27:28 +01:00
|
|
|
return result
|