test.py 2.74 KB
Newer Older
1
source("../../shared/qtcreator.py")
2
import re
3
4

SpeedCrunchPath = ""
5

Robert Loehning's avatar
Robert Loehning committed
6
def buildConfigFromFancyToolButton(fancyToolButton):
7
8
9
10
11
12
13
    beginOfBuildConfig = "<b>Build:</b> "
    endOfBuildConfig = "<br/><b>Deploy:</b>"
    toolTipText = str(fancyToolButton.toolTip)
    beginIndex = toolTipText.find(beginOfBuildConfig) + len(beginOfBuildConfig)
    endIndex = toolTipText.find(endOfBuildConfig)
    return toolTipText[beginIndex:endIndex]

14
def main():
15
16
    if not neededFilePresent(SpeedCrunchPath):
        return
17
18
    startApplication("qtcreator" + SettingsPath)
    openQmakeProject(SpeedCrunchPath)
Robert Loehning's avatar
Robert Loehning committed
19
    waitForSignal("{type='CppTools::Internal::CppModelManager' unnamed='1'}", "sourceFilesRefreshed(QStringList)")
20

21
    fancyToolButton = waitForObject(":*Qt Creator_Core::Internal::FancyToolButton")
22

23
    qtVerPattern = re.compile("\d\.\d(\.\d+)?")
24
    availableConfigs = iterateBuildConfigs(1, 0, "Release")
25
26
27
    if not availableConfigs:
        test.fatal("Haven't found a suitable Qt version (need Release build) - leaving without building.")
    for config in availableConfigs:
28
29
30
31
32
33
34
35
36
        qtVersion = qtVerPattern.search(config)
        if qtVersion:
            qtVersion = qtVersion.group()
            if qtVersion >= "4.8":
                test.log("Skipping config %s - this project needs Qt <= 4.7.x (got %s)" % (config, qtVersion))
                continue
        else:
            test.warning("Could not determine Qt version for config '%s' - skipping..." % config)
            continue
37
        selectBuildConfig(1, 0, config)
Robert Loehning's avatar
Robert Loehning committed
38
        buildConfig = buildConfigFromFancyToolButton(fancyToolButton)
39
40
41
42
43
44
45
46
47
48
        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")
        waitForSignal("{type='ProjectExplorer::BuildManager' unnamed='1'}", "buildQueueFinished(bool)")
        invokeMenuItem("Build", "Rebuild All")
        waitForSignal("{type='ProjectExplorer::BuildManager' unnamed='1'}", "buildQueueFinished(bool)", 300000)
        checkCompile()
        checkLastBuild()
49
50
51
52

    # Add a new run configuration

    invokeMenuItem("File", "Exit")
53
    waitForCleanShutdown()
54
55
56

def init():
    global SpeedCrunchPath
57
    SpeedCrunchPath = srcPath + "/creator-test-data/speedcrunch/src/speedcrunch.pro"
58
59
60
61
    cleanup()

def cleanup():
    # Make sure the .user files are gone
62
    cleanUpUserFiles(SpeedCrunchPath)
63

64
65
    BuildPath = glob.glob(srcPath + "/creator-test-data/speedcrunch/speedcrunch-build-*")
    BuildPath += glob.glob(srcPath + "/creator-test-data/speedcrunch/qtcreator-build-*")
66

67
68
69
70
    if BuildPath:
        for dir in BuildPath:
            if os.access(dir, os.F_OK):
                shutil.rmtree(dir)