generic: misc cleanups

This commit is contained in:
Ivailo Monev 2015-08-26 07:55:45 +03:00
parent 6ee471194f
commit b35f05a2dd
8 changed files with 0 additions and 594 deletions

View file

@ -1,10 +0,0 @@
2005-09-11 Mirko Boehm <mirko@kde.org>
* added a GUI WeaverObserver usage example (WeaverThreadGrid) to
show how non-GUI and GUI components can be composed
* fixed the WeaverImpl destructor to make it even more bullet proof
* removed dangling remainders of APR requests

View file

@ -1,208 +0,0 @@
------------------------------------------------------------------------
r33 | mirko | 2005-08-17 10:41:27 +0200 (Wed, 17 Aug 2005) | 2 lines
- added 2 missing files
------------------------------------------------------------------------
r32 | mirko | 2005-08-17 10:38:01 +0200 (Wed, 17 Aug 2005) | 4 lines
- documentation update
- signals are only defined in the interface
------------------------------------------------------------------------
r31 | mirko | 2005-08-16 18:21:10 +0200 (Tue, 16 Aug 2005) | 2 lines
- added Id property for $Id$ expansion
------------------------------------------------------------------------
r30 | mirko | 2005-08-16 18:16:04 +0200 (Tue, 16 Aug 2005) | 5 lines
- added or updated missing license headers
- made sure static instance uses Weaver class, not WeaverImpl
- correct button text after file selection in SMIV test
------------------------------------------------------------------------
r29 | mirko | 2005-08-14 21:04:30 +0200 (Sun, 14 Aug 2005) | 5 lines
- introduced a common interface class for Weaver and WeaverImpl
(this allows the use of decorators and ensures the similarity of both
classes)
------------------------------------------------------------------------
r28 | mirko | 2005-08-14 18:35:09 +0200 (Sun, 14 Aug 2005) | 3 lines
- use a factory method to allow creation of derived WeaverImpl objects
------------------------------------------------------------------------
r27 | mirko | 2005-08-14 18:20:14 +0200 (Sun, 14 Aug 2005) | 2 lines
- only emit state changes if new state != previous state
------------------------------------------------------------------------
r26 | mirko | 2005-08-14 14:51:11 +0200 (Sun, 14 Aug 2005) | 4 lines
- moved WeaverObserverTest into the Jobs test directory
- adapted Jobs test to dynamically create and delete the observer
--Mirko.
------------------------------------------------------------------------
r25 | mirko | 2005-08-14 14:41:38 +0200 (Sun, 14 Aug 2005) | 4 lines
- changed name of WeaverExtension to WeaverObserver
(because that is what they are)
------------------------------------------------------------------------
r24 | mirko | 2005-08-14 13:34:24 +0200 (Sun, 14 Aug 2005) | 6 lines
- (re-)introduced WeaverExtensions
- added a log extension class for testing
- added a log extension object to the Jobs test
--Mirko.
------------------------------------------------------------------------
r23 | mirko | 2005-08-08 23:36:45 +0200 (Mon, 08 Aug 2005) | 4 lines
- adjusted debug log message level
- re-enabled QImage::scaled (leads to segfaults)
------------------------------------------------------------------------
r22 | mirko | 2005-08-08 23:31:28 +0200 (Mon, 08 Aug 2005) | 3 lines
- added premade thumbnail image
------------------------------------------------------------------------
r21 | mirko | 2005-08-08 23:06:07 +0200 (Mon, 08 Aug 2005) | 3 lines
- implemented deferred thread creation
------------------------------------------------------------------------
r20 | mirko | 2005-08-08 23:02:51 +0200 (Mon, 08 Aug 2005) | 2 lines
- added Id property on files
------------------------------------------------------------------------
r19 | mirko | 2005-08-08 23:00:12 +0200 (Mon, 08 Aug 2005) | 2 lines
- ... and added $ID:... to the file, too
------------------------------------------------------------------------
r18 | mirko | 2005-08-08 22:59:17 +0200 (Mon, 08 Aug 2005) | 2 lines
- added Id property
------------------------------------------------------------------------
r17 | mirko | 2005-08-08 16:40:45 +0200 (Mon, 08 Aug 2005) | 6 lines
- implemented Weaver facade class
- renamed old Weaver class to WeaverImpl (already in file WeaverImpl.h)
- reinstated the Weaver::instance method
--Mirko.
------------------------------------------------------------------------
r16 | mirko | 2005-08-08 15:22:59 +0200 (Mon, 08 Aug 2005) | 4 lines
- implemented suspend, resume, cancel and quit in the SMIV test
- tried workaround for QImage::scaled segfault
------------------------------------------------------------------------
r15 | mirko | 2005-08-04 00:30:58 +0200 (Thu, 04 Aug 2005) | 3 lines
- code cleanup
------------------------------------------------------------------------
r14 | mirko | 2005-08-03 00:29:40 +0200 (Wed, 03 Aug 2005) | 2 lines
- debugging session
------------------------------------------------------------------------
r13 | mirko | 2005-08-02 15:13:04 +0200 (Tue, 02 Aug 2005) | 4 lines
- finished implementation of the SMIV example
- one segfault remaining, will bug hun tonight
------------------------------------------------------------------------
r12 | mirko | 2005-07-29 00:44:52 +0200 (Fri, 29 Jul 2005) | 2 lines
- more work on the image viewer example
------------------------------------------------------------------------
r11 | mirko | 2005-07-28 15:02:12 +0200 (Thu, 28 Jul 2005) | 4 lines
- started model/view based SMIV test
(SMIV: Simple Multi-Threaded Image Viewer)
------------------------------------------------------------------------
r10 | mirko | 2005-07-26 15:53:51 +0200 (Tue, 26 Jul 2005) | 3 lines
- better state handling
------------------------------------------------------------------------
r9 | mirko | 2005-07-26 15:31:46 +0200 (Tue, 26 Jul 2005) | 4 lines
- added the Jobs test
- this test involves a graphical multithreaded application
--Mirko.
------------------------------------------------------------------------
r8 | mirko | 2005-07-26 15:30:24 +0200 (Tue, 26 Jul 2005) | 3 lines
- added more tests
------------------------------------------------------------------------
r7 | mirko | 2005-07-22 20:45:18 +0200 (Fri, 22 Jul 2005) | 3 lines
- added qmake files
--Mirko.
------------------------------------------------------------------------
r6 | mirko | 2005-07-22 20:40:08 +0200 (Fri, 22 Jul 2005) | 2 lines
- naming
------------------------------------------------------------------------
r5 | mirko | 2005-07-22 20:39:27 +0200 (Fri, 22 Jul 2005) | 3 lines
- moved construction test into it's own subdirectory
------------------------------------------------------------------------
r4 | mirko | 2005-07-22 20:32:54 +0200 (Fri, 22 Jul 2005) | 5 lines
- added State classes
- modified WeaverImpl to use them
- added first test (Construction.cpp)
--Mirko.
------------------------------------------------------------------------
r3 | mirko | 2005-07-20 12:01:12 +0200 (Wed, 20 Jul 2005) | 4 lines
- more cleanup
- still does not work
--Mirko.
------------------------------------------------------------------------
r2 | mirko | 2005-07-19 23:18:28 +0200 (Tue, 19 Jul 2005) | 6 lines
- added ThreadWeaver core library
- compiles, but does not work yet
- signal handling has changed completely
--Mirko.
------------------------------------------------------------------------

View file

@ -1,63 +0,0 @@
#!/usr/bin/python
import os
import sys
import buildinator_common
from buildinator_build_status import BuildStatus
# main
print """Build and test all subversion revisions of a module. (C) Mirko Boehm, 2006
This script is licensed as a part of the ThreadWeaver multithreading suite
under the LGPL.
This is the massive build and unit test script. It will iteratively
retrieve all Subversion revisions of ThreadWeaver (starting from a certain
known one at which "make test" in the toplevel Makefile worked for the first
time), build it for debug and release targets and run the unit tests 100 times
each. It will then report a summary. All the build and source files will be
deleted. When the script completes, it will leave a folder for every
Subversion revision that contains the Logs of the executed processes.
"""
MinimumRevision = -1
# get Subversion Url from command line arg 1:
Module = ''
ProFileName = ''
# here we break (required arguments):
try:
Module = sys.argv[1]
ProFileName = sys.argv[2]
MinimumRevision = int (sys.argv[3])
except:
print 'Usage: ' + sys.argv[0] + ' <SvnUrl> <ProFileName> <minimum SVN revision to test>'
sys.exit( -1 )
print '--> Minimum revision: ' + str(MinimumRevision)
print '--> Module: ' + Module
print '--> Project: ' + ProFileName
Revisions = buildinator_common.GetRevisionList( Module )
Results = []
# weed out revision below MinimumRevision:
def newer_than_MinimumRevision(n):
return n.revision >= MinimumRevision
Revisions = filter ( newer_than_MinimumRevision, Revisions)
print '--> Autobuilding ' + str(len(Revisions)) + ' revisions'
# start building:
for Revision in Revisions:
print '--> Autobuilding #' + str (Revision.revision)
WorkFolder = str(Revision.revision)
os.system( 'mkdir -p ' + WorkFolder )
WorkDir = os.getcwd() + '/' + WorkFolder
Revision.projectFile = ProFileName
Revision.numberOfTestRuns = 100
Results = Results + buildinator_common.ExecuteBuildAndTest ( Revision, WorkDir )
for Result in Results:
Result.dumpBuildStatus()

View file

@ -1,38 +0,0 @@
#!/usr/bin/python
import os
import sys
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:
Result.dumpBuildStatus()

View file

@ -1,21 +0,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()

View file

@ -1,86 +0,0 @@
# a class that holds the build status (aka results of a build run), an object
# of this class represents a record in the build status database later:
class BuildStatus (dict):
"""BuildStatus collects information about a build+test run"""
def __init__ (self, Status= None):
""" Construct an objct, possibly copying it"""
if Status is not None:
self.svnUrl = Status.svnUrl
self.projectFile = Status.projectFile
self.revision = Status.revision
self.platform = Status.platform
self.options = Status.options
self.prefix = Status.prefix
self.checkoutStatus = Status.checkoutStatus
self.configureStatus = Status.configureStatus
self.compileStatus = Status.compileStatus
self.overallTestStatus = Status.overallTestStatus
self.committer = Status.committer
self.numberOfTestRuns = Status.numberOfTestRuns
self.testResults = Status.testResults
def dumpBuildStatus( self ):
CheckoutStatusText = ( 'not performed', 'success', 'failure' )
ConfigureStatusText = ( 'not performed', 'success', 'failure' )
CompileStatusText = ( 'not performed', 'success', 'success (warnings)', 'failure' )
InitialTestStatusText = ( 'not performed', 'success', 'tests failed', 'test crashed', 'tests timed out' )
TestsGood = 0
for Run in self.testResults:
if Run == 1: # success
TestsGood += 1
TestsTotal = len(self.testResults)
TestsBad = TestsTotal - TestsGood
TestResultsString = '[' + str(TestsGood) + '/' + str(TestsBad) + '/' + str(TestsTotal) + ']'
"""Print the build status to the console tersely"""
print 'build result for revision ' + str(self.revision) + ', committed by ' + self.committer + ':'
print '--> build platform: ' + self.platform
print '--> Subversion URL: ' + self.svnUrl
print '--> configuration: "' + self.prefix + '", configured with options "' + self.options + '"'
print '--> checkout status: ' + CheckoutStatusText[self.checkoutStatus]
print '--> configure status: ' + ConfigureStatusText[self.configureStatus]
print '--> compile status: ' + CompileStatusText[self.compileStatus]
print '--> overall test status: ' + InitialTestStatusText[self.overallTestStatus] + ' ' + TestResultsString
def hasErrors( self ):
"""Returns whether errors occured during the build process"""
if self.checkoutStatus == 2 or self.configureStatus == 2 or self.compileStatus == 3 \
or self.overallTestStatus != 1:
return True
else:
return False
# the svn URL this is working on:
svnUrl = ''
# the project file to use for creating makefiles
# FIXME: this may need to be subclassed for different makefile generators
projectFile = ''
# the revision that was build in this run:
revision = 0
# the platform that this was built on:
platform = ''
# the build options used:
options = ''
# the prefix (usually Debug or Release):
prefix = ''
# check-out status (0 = not performed, 1 = success, 2 = failed)
checkoutStatus = 0
# configure status (0 = not performed, 1 = success, 2 = failed)
configureStatus = 0
# compilestatus (0 = not performed, 1 = success, 2 = success with warnings, 3 = failed)
compileStatus = 0
# first test run status ( 0 = not performed, 1 = success, 2 = test failed, 3 = crash, 4 = timeout)
overallTestStatus = 0
# number of times the tests are supposed to be run:
numberOfTestRuns = 1
# list of test run results:
testResults = []
# committer of the revision
committer = ''

View file

@ -1,152 +0,0 @@
import re
import os
import sys
import time
import platform
from buildinator_build_status import BuildStatus
def CheckoutSubversionRevision (Status, SrcDir, LogDir):
"""Checks a certain revision of threadweaver out of KDESVN into SrcDir"""
Cmd="svn co -r" + str(Status.revision) + ' ' + Status.svnUrl + ' ' \
+ SrcDir + ' ' \
+ "> " + LogDir + "/SubversionCheckout.log 2>&1"
# print Cmd
# print "Checking out revision " + str(Status.revision)
ReturnCode = 0
try:
ReturnCode = os.system (Cmd)
Status.checkoutStatus = 1 # success
except:
Status.checkoutStatus = 2 # failed
return Status
def CleanUp (Status, SrcDir, BuildDir):
"""Delete temporary src and build directories"""
# build status is ignored here, but we may want to skip cleanup if some step of the build failed
os.system ("rm -Rf " + SrcDir)
os.system ("rm -Rf " + BuildDir)
return Status
def Build (Status, SrcDir, BuildDir, LogDir):
"""Build the sources in SrcDir in BuildDir/Prefix using Options for qmake"""
BuildPath = BuildDir + "/" + Status.prefix
# if exceptions occur, stop the script (no catching):
os.system("mkdir -p " + BuildPath)
rc = os.system("(cd " + BuildPath + " && qmake " \
+ Status.options + " " + SrcDir + '/' + Status.projectFile + ')' \
+ " > " + LogDir + "/qmake-" + Status.prefix + ".log 2>&1")
if rc == 0:
Status.configureStatus = 1 # success
else:
Status.configureStatus = 2 # failure
rc = os.system("(cd " + BuildPath + " && make all " \
+ " > " + LogDir + "/make-all-" + Status.prefix + ".log 2>&1 )")
# FIXME: find out about "success with warnings"
if rc == 0:
Status.compileStatus = 1 # success
else:
Status.compileStatus = 3 # failure
return Status
def Test (Status, BuildDir, Prefix, LogDir):
"""Run the unit tests in BuildDir/Prefix"""
BuildPath = BuildDir + "/" + Prefix
Cmd = "(cd " + BuildPath + " && make test " \
+ " > " + LogDir + "/make-test-" + Prefix + ".log 2>&1 )"
Status.overallTestStatus = 1 # success
for Step in range( Status.numberOfTestRuns ):
rc =os.system(Cmd)
if rc == 0:
Status.testResults = Status.testResults + [ 1 ]
else:
Status.testResults = Status.testResults + [ 2 ]
Status.overallTestStatus = 2 # failed
return Status
# the entry point for the whole build test process:
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
# FIXME: return something useful
def GetSvnLog ( SvnUrl ):
"""Retrieve the subversion log for a subversion URL and return it in a list."""
Cmd = "svn log " + SvnUrl
File = os.popen (Cmd, 'r')
return File.readlines()
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

View file

@ -1,16 +0,0 @@
#!/usr/bin/python
import buildinator_common
from buildinator_build_status import BuildStatus
# get Subversion Url from command line arg 1:
Url = '.'
try:
Url = sys.argv[1]
except:
pass
Revisions = buildinator_common.GetRevisionList( Url )
for Revision in Revisions:
print 'Revision ' + str(Revision.revision) + ' by ' + Revision.committer