def GetRevisionList( SvnUrl ): """Make an BuildStatus list of revisions, sorted latest-to-older""" Lines = GetSvnLog ( SvnUrl ) RevisionLine = re.compile( '^r\d+\s') Revisions = [] for Line in Lines: Match = RevisionLine.match( Line ) if Match: Status = BuildStatus() Pieces = Line.split('|') Status.committer = Pieces[1].strip() Status.revision = int (Pieces[0].rstrip()[1:]) Status.svnUrl = SvnUrl Revisions = Revisions + [ Status ] return Revisions
def GetRevisionList(SvnUrl): """Make an BuildStatus list of revisions, sorted latest-to-older""" Lines = GetSvnLog(SvnUrl) RevisionLine = re.compile('^r\d+\s') Revisions = [] for Line in Lines: Match = RevisionLine.match(Line) if Match: Status = BuildStatus() Pieces = Line.split('|') Status.committer = Pieces[1].strip() Status.revision = int(Pieces[0].rstrip()[1:]) Status.svnUrl = SvnUrl Revisions = Revisions + [Status] return Revisions
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
#!/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()
#!/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()
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
import buildinator_common from buildinator_build_status import BuildStatus # "main": # parse command line args to find the revision to test: print """Build and test a subversion revision of a module. (C) Mirko Boehm, 2006 This script is licensed as a part of the ThreadWeaver multithreading suite under the LGPL. Run this script in an empty directory. """ Module = '' ProFileName = '' Revision = 0 Status = BuildStatus() try: Status.revision = int (sys.argv[1]) Status.svnUrl = sys.argv[2] Status.projectFile = sys.argv[3] Status.numberOfTestRuns = 100 except: print "Usage: " + sys.argv[0] + " <SVN revision to test> <SvnURL> <ProFileName>" print "Example: " + sys.argv[0] \ + ' 452230 svn+ssh://svn.kde.org/home/kde/trunk/kdenonbeta/threadweaver ' \ + 'ThreadWeaver.pro' sys.exit (-1) else: Results = buildinator_common.ExecuteBuildAndTest ( Status, os.getcwd() ) for Result in Results: