Esempio n. 1
0
def ExecuteBuildAndTest ( Status, WorkDir ):
    """This function runs the sequence of checking out, building and testing a revision"""
    SrcDir = WorkDir+ "/Src"
    BuildDir = WorkDir + "/Build"
    LogDir = WorkDir + "/Logs"
    MinimumTestRevision = -1
    Errors = False
    # common object, will be copied for the different runs
    Status.platform = platform.platform()
    BuildResults = [] # will hold a list of BuildStatus objects,one for every configuration
    # print "SrcDir:   " + SrcDir
    # print "BuildDir: " + BuildDir
    # print "LogDir:   " + LogDir
    # print
    
    try:
        for Directory in [ SrcDir, BuildDir, LogDir]: 
            os.system ("mkdir -p " + Directory)
        # print "Clearing existing logs in " + LogDir
        os.system("rm -f " + LogDir + "/*")
    except:
        print "--> error: cannot make src or build directory, check permissions!"
        sys.exit (-2)
        
    Status = CheckoutSubversionRevision ( Status, SrcDir, LogDir)
    if Status.checkoutStatus != 1:  # success
        return Status # return just this one object, since we cannot run the build without sources
    
    # a dictionary with the configuration name and qmake options:
    Options = { 'Debug' : 'CONFIG+=debug',
                'Release' : 'CONFIG+=release' }

    for Prefix, Option in Options.items():
        # copy status over from status of common steps:
        CurrentStatus = BuildStatus( Status )
        CurrentStatus.options = Option
        CurrentStatus.prefix = Prefix
        # print 'Building with options "' + Option + '" in ' + Prefix
        CurrentStatus = Build (CurrentStatus, SrcDir, BuildDir, LogDir)
        if  CurrentStatus.compileStatus == 1 or CurrentStatus.compileStatus == 2:
            # print "Build successful"
            if Status.revision < MinimumTestRevision:
                print "--> warning: not testing, no unit test in revisions below " + MinimumTestRevision
            else:
                # print "Executing initial unit test run"
                CurrentStatus = Test (CurrentStatus, BuildDir, Prefix, LogDir) 
                if CurrentStatus.overallTestStatus == 1:
                    # print "Tests successful"
                    pass
                else:
                    print "--> notice: tests failed!"
        else:
            print "--> error: build failed, no testing"
        if CurrentStatus.hasErrors(): Errors = True
        BuildResults = BuildResults + [ CurrentStatus ]
    # print "Cleaning up (deleting all in SrcDir and BuildDir, leave Logs) ..."
    if Errors:
        print '--> notice: not cleaning up because of previous errors'
    else:
        CleanUp (Status, SrcDir, BuildDir)
    return BuildResults
Esempio n. 2
0
#!/usr/bin/python

from buildinator_build_status import BuildStatus

# main:
status = BuildStatus()
status.revision = 123456
status.platform = 'Linux boombox 2.6.13-15.7-default #1 Tue Nov 29 14:32:29 UTC 2005 x86_64 x86_64 x86_64 GNU/Linux'
status.options = 'CONFIG+=debug'
status.prefix = 'Debug'
status.checkoutStatus = 1
status.configureStatus = 1
status.compileStatus = 2
status.initialTestStatus = 4
status.committer = 'mirko'

status.dumpBuildStatus()

    


Esempio n. 3
0
#!/usr/bin/python

from buildinator_build_status import BuildStatus

# main:
status = BuildStatus()
status.revision = 123456
status.platform = "Linux boombox 2.6.13-15.7-default #1 Tue Nov 29 14:32:29 UTC 2005 x86_64 x86_64 x86_64 GNU/Linux"
status.options = "CONFIG+=debug"
status.prefix = "Debug"
status.checkoutStatus = 1
status.configureStatus = 1
status.compileStatus = 2
status.initialTestStatus = 4
status.committer = "mirko"

status.dumpBuildStatus()
Esempio n. 4
0
def ExecuteBuildAndTest(Status, WorkDir):
    """This function runs the sequence of checking out, building and testing a revision"""
    SrcDir = WorkDir + "/Src"
    BuildDir = WorkDir + "/Build"
    LogDir = WorkDir + "/Logs"
    MinimumTestRevision = -1
    Errors = False
    # common object, will be copied for the different runs
    Status.platform = platform.platform()
    BuildResults = [
    ]  # will hold a list of BuildStatus objects,one for every configuration
    # print "SrcDir:   " + SrcDir
    # print "BuildDir: " + BuildDir
    # print "LogDir:   " + LogDir
    # print

    try:
        for Directory in [SrcDir, BuildDir, LogDir]:
            os.system("mkdir -p " + Directory)
        # print "Clearing existing logs in " + LogDir
        os.system("rm -f " + LogDir + "/*")
    except:
        print "--> error: cannot make src or build directory, check permissions!"
        sys.exit(-2)

    Status = CheckoutSubversionRevision(Status, SrcDir, LogDir)
    if Status.checkoutStatus != 1:  # success
        return Status  # return just this one object, since we cannot run the build without sources

    # a dictionary with the configuration name and qmake options:
    Options = {'Debug': 'CONFIG+=debug', 'Release': 'CONFIG+=release'}

    for Prefix, Option in Options.items():
        # copy status over from status of common steps:
        CurrentStatus = BuildStatus(Status)
        CurrentStatus.options = Option
        CurrentStatus.prefix = Prefix
        # print 'Building with options "' + Option + '" in ' + Prefix
        CurrentStatus = Build(CurrentStatus, SrcDir, BuildDir, LogDir)
        if CurrentStatus.compileStatus == 1 or CurrentStatus.compileStatus == 2:
            # print "Build successful"
            if Status.revision < MinimumTestRevision:
                print "--> warning: not testing, no unit test in revisions below " + MinimumTestRevision
            else:
                # print "Executing initial unit test run"
                CurrentStatus = Test(CurrentStatus, BuildDir, Prefix, LogDir)
                if CurrentStatus.overallTestStatus == 1:
                    # print "Tests successful"
                    pass
                else:
                    print "--> notice: tests failed!"
        else:
            print "--> error: build failed, no testing"
        if CurrentStatus.hasErrors(): Errors = True
        BuildResults = BuildResults + [CurrentStatus]
    # print "Cleaning up (deleting all in SrcDir and BuildDir, leave Logs) ..."
    if Errors:
        print '--> notice: not cleaning up because of previous errors'
    else:
        CleanUp(Status, SrcDir, BuildDir)
    return BuildResults