forked from qt-creator/qt-creator
Squish: Perform additional Profiler test
Change-Id: I9ca615f89ac772fc87b9dc91ed2fbc42a3b763a3 Reviewed-by: Robert Loehning <robert.loehning@digia.com>
This commit is contained in:
@@ -38,7 +38,9 @@ def main():
|
|||||||
return
|
return
|
||||||
# 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)
|
# we need a Qt >= 4.8
|
||||||
|
analyzerTargets = Targets.desktopTargetClasses() ^ Targets.DESKTOP_474_GCC
|
||||||
|
checkedTargets, projectName = createNewQtQuickApplication(workingDir, targets=analyzerTargets)
|
||||||
editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget")
|
editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget")
|
||||||
if placeCursorToLine(editor, "MouseArea.*", True):
|
if placeCursorToLine(editor, "MouseArea.*", True):
|
||||||
type(editor, '<Up>')
|
type(editor, '<Up>')
|
||||||
@@ -57,68 +59,79 @@ def main():
|
|||||||
invokeMenuItem("File", "Save All")
|
invokeMenuItem("File", "Save All")
|
||||||
availableConfigs = iterateBuildConfigs(len(checkedTargets), "Debug")
|
availableConfigs = iterateBuildConfigs(len(checkedTargets), "Debug")
|
||||||
if not availableConfigs:
|
if not availableConfigs:
|
||||||
test.fatal("Haven't found a suitable Qt version (need Qt 4.7.4) - leaving without debugging.")
|
test.fatal("Haven't found a suitable Qt version (need Qt 4.8) - leaving without debugging.")
|
||||||
for kit, config in availableConfigs:
|
else:
|
||||||
qtVersion = selectBuildConfig(len(checkedTargets), kit, config)[0]
|
performTest(workingDir, projectName, len(checkedTargets), availableConfigs, False)
|
||||||
if qtVersion == "4.7.4":
|
performTest(workingDir, projectName, len(checkedTargets), availableConfigs, True)
|
||||||
test.xverify(False, "Skipping Qt 4.7.4 to avoid QTCREATORBUG-9185")
|
|
||||||
continue
|
|
||||||
test.log("Selected kit using Qt %s" % qtVersion)
|
|
||||||
progressBarWait() # progress bars move buttons
|
|
||||||
verifyBuildConfig(len(checkedTargets), kit, True, enableQmlDebug=True)
|
|
||||||
# explicitly build before start debugging for adding the executable as allowed program to WinFW
|
|
||||||
invokeMenuItem("Build", "Rebuild All")
|
|
||||||
waitForSignal("{type='ProjectExplorer::BuildManager' unnamed='1'}",
|
|
||||||
"buildQueueFinished(bool)")
|
|
||||||
if not checkCompile():
|
|
||||||
test.fatal("Compile had errors... Skipping current build config")
|
|
||||||
continue
|
|
||||||
allowAppThroughWinFW(workingDir, projectName, False)
|
|
||||||
switchViewTo(ViewConstants.ANALYZE)
|
|
||||||
selectFromCombo(":Analyzer Toolbar.AnalyzerManagerToolBox_QComboBox", "QML Profiler")
|
|
||||||
recordButton = waitForObject("{container=':Qt Creator.Analyzer Toolbar_QDockWidget' "
|
|
||||||
"type='QToolButton' unnamed='1' visible='1' "
|
|
||||||
"toolTip?='*able profiling'}")
|
|
||||||
if not test.verify(recordButton.checked, "Verifying recording is enabled."):
|
|
||||||
test.log("Enabling recording for the test run")
|
|
||||||
clickButton(recordButton)
|
|
||||||
clickButton(waitForObject(":Analyzer Toolbar.Start_QToolButton"))
|
|
||||||
stopButton = waitForObject(":Qt Creator.Stop_QToolButton")
|
|
||||||
elapsedLabel = waitForObject(":Analyzer Toolbar.Elapsed:_QLabel", 3000)
|
|
||||||
waitFor('"Elapsed: 5" in str(elapsedLabel.text)', 20000)
|
|
||||||
clickButton(stopButton)
|
|
||||||
if safeClickTab("JavaScript"):
|
|
||||||
model = findObject(":JavaScript.QmlProfilerEventsTable_QmlProfiler::"
|
|
||||||
"Internal::QV8ProfilerEventsMainView").model()
|
|
||||||
test.compare(model.rowCount(), 0)
|
|
||||||
if safeClickTab("Events"):
|
|
||||||
colPercent, colTotal, colCalls, colMean, colMedian, colLongest, colShortest = range(2, 9)
|
|
||||||
model = waitForObject(":Events.QmlProfilerEventsTable_QmlProfiler::"
|
|
||||||
"Internal::QmlProfilerEventsMainView").model()
|
|
||||||
if qtVersion.startswith("5."):
|
|
||||||
compareEventsTab(model, "events_qt50.tsv")
|
|
||||||
numberOfMsRows = 3
|
|
||||||
else:
|
|
||||||
if qtVersion.startswith("4.8"):
|
|
||||||
compareEventsTab(model, "events_qt48.tsv")
|
|
||||||
else:
|
|
||||||
compareEventsTab(model, "events_qt47.tsv")
|
|
||||||
numberOfMsRows = 2
|
|
||||||
test.compare(dumpItems(model, column=colPercent)[0], '100.00 %')
|
|
||||||
for i in [colTotal, colMean, colMedian, colLongest, colShortest]:
|
|
||||||
for item in dumpItems(model, column=i)[:numberOfMsRows]:
|
|
||||||
test.verify(item.endswith(' ms'), "Verify that '%s' ends with ' ms'" % item)
|
|
||||||
for row in range(model.rowCount()):
|
|
||||||
if str(model.index(row, colCalls).data()) == "1":
|
|
||||||
for col in [colMedian, colLongest, colShortest]:
|
|
||||||
test.compare(model.index(row, colMean).data(), model.index(row, col).data(),
|
|
||||||
"For just one call, no differences in execution time may be shown.")
|
|
||||||
elif str(model.index(row, colCalls).data()) == "2":
|
|
||||||
test.compare(model.index(row, colMedian).data(), model.index(row, colLongest).data(),
|
|
||||||
"For two calls, median and longest time must be the same.")
|
|
||||||
deleteAppFromWinFW(workingDir, projectName, False)
|
|
||||||
invokeMenuItem("File", "Exit")
|
invokeMenuItem("File", "Exit")
|
||||||
|
|
||||||
|
def performTest(workingDir, projectName, targetCount, availableConfigs, disableOptimizer):
|
||||||
|
for kit, config in availableConfigs:
|
||||||
|
qtVersion = selectBuildConfig(targetCount, kit, config)[0]
|
||||||
|
test.log("Selected kit using Qt %s" % qtVersion)
|
||||||
|
progressBarWait() # progress bars move buttons
|
||||||
|
verifyBuildConfig(targetCount, kit, True, enableQmlDebug=True)
|
||||||
|
if disableOptimizer:
|
||||||
|
batchEditRunEnvironment(targetCount, kit, ["QML_DISABLE_OPTIMIZER=1"])
|
||||||
|
switchViewTo(ViewConstants.EDIT)
|
||||||
|
# explicitly build before start debugging for adding the executable as allowed program to WinFW
|
||||||
|
invokeMenuItem("Build", "Rebuild All")
|
||||||
|
waitForSignal("{type='ProjectExplorer::BuildManager' unnamed='1'}",
|
||||||
|
"buildQueueFinished(bool)")
|
||||||
|
if not checkCompile():
|
||||||
|
test.fatal("Compile had errors... Skipping current build config")
|
||||||
|
continue
|
||||||
|
allowAppThroughWinFW(workingDir, projectName, False)
|
||||||
|
switchViewTo(ViewConstants.ANALYZE)
|
||||||
|
selectFromCombo(":Analyzer Toolbar.AnalyzerManagerToolBox_QComboBox", "QML Profiler")
|
||||||
|
recordButton = waitForObject("{container=':Qt Creator.Analyzer Toolbar_QDockWidget' "
|
||||||
|
"type='QToolButton' unnamed='1' visible='1' "
|
||||||
|
"toolTip?='*able profiling'}")
|
||||||
|
if not test.verify(recordButton.checked, "Verifying recording is enabled."):
|
||||||
|
test.log("Enabling recording for the test run")
|
||||||
|
clickButton(recordButton)
|
||||||
|
clickButton(waitForObject(":Analyzer Toolbar.Start_QToolButton"))
|
||||||
|
stopButton = waitForObject(":Qt Creator.Stop_QToolButton")
|
||||||
|
elapsedLabel = waitForObject(":Analyzer Toolbar.Elapsed:_QLabel", 3000)
|
||||||
|
waitFor('"Elapsed: 5" in str(elapsedLabel.text)', 20000)
|
||||||
|
clickButton(stopButton)
|
||||||
|
if safeClickTab("JavaScript"):
|
||||||
|
model = findObject(":JavaScript.QmlProfilerEventsTable_QmlProfiler::"
|
||||||
|
"Internal::QV8ProfilerEventsMainView").model()
|
||||||
|
test.compare(model.rowCount(), 0)
|
||||||
|
if safeClickTab("Events"):
|
||||||
|
colPercent, colTotal, colCalls, colMean, colMedian, colLongest, colShortest = range(2, 9)
|
||||||
|
model = waitForObject(":Events.QmlProfilerEventsTable_QmlProfiler::"
|
||||||
|
"Internal::QmlProfilerEventsMainView").model()
|
||||||
|
if qtVersion.startswith("5."):
|
||||||
|
if disableOptimizer:
|
||||||
|
compareEventsTab(model, "events_qt50_nonOptimized.tsv")
|
||||||
|
else:
|
||||||
|
compareEventsTab(model, "events_qt50.tsv")
|
||||||
|
numberOfMsRows = 3
|
||||||
|
else:
|
||||||
|
if disableOptimizer:
|
||||||
|
compareEventsTab(model, "events_qt48_nonOptimized.tsv")
|
||||||
|
else:
|
||||||
|
compareEventsTab(model, "events_qt48.tsv")
|
||||||
|
numberOfMsRows = 2
|
||||||
|
test.compare(dumpItems(model, column=colPercent)[0], '100.00 %')
|
||||||
|
for i in [colTotal, colMean, colMedian, colLongest, colShortest]:
|
||||||
|
for item in dumpItems(model, column=i)[:numberOfMsRows]:
|
||||||
|
test.verify(item.endswith(' ms'), "Verify that '%s' ends with ' ms'" % item)
|
||||||
|
for item in dumpItems(model, column=i):
|
||||||
|
test.verify(not item.startswith('0.000 '),
|
||||||
|
"Check for implausible durations (QTCREATORBUG-8996): %s" % item)
|
||||||
|
for row in range(model.rowCount()):
|
||||||
|
if str(model.index(row, colCalls).data()) == "1":
|
||||||
|
for col in [colMedian, colLongest, colShortest]:
|
||||||
|
test.compare(model.index(row, colMean).data(), model.index(row, col).data(),
|
||||||
|
"For just one call, no differences in execution time may be shown.")
|
||||||
|
elif str(model.index(row, colCalls).data()) == "2":
|
||||||
|
test.compare(model.index(row, colMedian).data(), model.index(row, colLongest).data(),
|
||||||
|
"For two calls, median and longest time must be the same.")
|
||||||
|
deleteAppFromWinFW(workingDir, projectName, False)
|
||||||
|
|
||||||
def compareEventsTab(model, file):
|
def compareEventsTab(model, file):
|
||||||
significantColumns = [0, 1, 4, 9]
|
significantColumns = [0, 1, 4, 9]
|
||||||
|
|
||||||
|
@@ -1,4 +0,0 @@
|
|||||||
"0" "1" "4" "9"
|
|
||||||
"<program>" "Binding" "1" "Main Program"
|
|
||||||
"main.qml:15" "Signal" "2" "triggered(): { runCount += 1; var i; for (i = 1; i < 2500; ++i) { var j = i * i; console.log(j); } }"
|
|
||||||
"main.qml:14" "Binding" "2" "running: runCount < 2"
|
|
|
9
tests/system/suite_debugger/tst_simple_analyze/testdata/events_qt48_nonOptimized.tsv
vendored
Normal file
9
tests/system/suite_debugger/tst_simple_analyze/testdata/events_qt48_nonOptimized.tsv
vendored
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
"0" "1" "4" "9"
|
||||||
|
"<program>" "Binding" "1" "Main Program"
|
||||||
|
"main.qml:15" "Signal" "2" "triggered(): { runCount += 1; var i; for (i = 1; i < 2500; ++i) { var j = i * i; console.log(j); } }"
|
||||||
|
"main.qml:1" "Create" "1" "main.qml"
|
||||||
|
"main.qml:1" "Compile" "1" "main.qml"
|
||||||
|
"main.qml:7" "Binding" "1" "text: qsTr(""Hello World"")"
|
||||||
|
"main.qml:14" "Binding" "3" "running: runCount < 2"
|
||||||
|
"main.qml:8" "Binding" "1" "centerIn: parent"
|
||||||
|
"main.qml:27" "Binding" "1" "fill: parent"
|
|
9
tests/system/suite_debugger/tst_simple_analyze/testdata/events_qt50_nonOptimized.tsv
vendored
Normal file
9
tests/system/suite_debugger/tst_simple_analyze/testdata/events_qt50_nonOptimized.tsv
vendored
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
"0" "1" "4" "9"
|
||||||
|
"<program>" "Binding" "1" "Main Program"
|
||||||
|
"main.qml:1" "Create" "1" "main.qml"
|
||||||
|
"main.qml:15" "Signal" "2" "triggered(): { runCount += 1; var i; for (i = 1; i < 2500; ++i) { var j = i * i; console.log(j); } }"
|
||||||
|
"main.qml:1" "Compile" "1" "main.qml"
|
||||||
|
"main.qml:7" "Binding" "1" "text: qsTr(""Hello World"")"
|
||||||
|
"main.qml:14" "Binding" "3" "running: runCount < 2"
|
||||||
|
"main.qml:8" "Binding" "1" "centerIn: parent"
|
||||||
|
"main.qml:27" "Binding" "1" "fill: parent"
|
|
Reference in New Issue
Block a user