Boost logo

Boost-Commit :

From: troy_at_[hidden]
Date: 2007-06-15 14:58:40


Author: troy
Date: 2007-06-15 14:58:38 EDT (Fri, 15 Jun 2007)
New Revision: 7065
URL: http://svn.boost.org/trac/boost/changeset/7065

Log:

Fix scheduling algorithm, eliminate pysvn. Make inter-build sleep
configurable.

Removed:
   sandbox-branches/boost-cmake/dart-client/continuous.ctest
   sandbox-branches/boost-cmake/dart-client/initialize.sh
   sandbox-branches/boost-cmake/dart-client/nightly.ctest
   sandbox-branches/boost-cmake/dart-client/nightly.sh
   sandbox-branches/boost-cmake/dart-client/run.sh
Text files modified:
   sandbox-branches/boost-cmake/dart-client/client.py | 64 +++++++++++++++++++++++++---------------
   sandbox-branches/boost-cmake/dart-client/conf.py | 36 +++++++++++++++++++++
   2 files changed, 75 insertions(+), 25 deletions(-)

Modified: sandbox-branches/boost-cmake/dart-client/client.py
==============================================================================
--- sandbox-branches/boost-cmake/dart-client/client.py (original)
+++ sandbox-branches/boost-cmake/dart-client/client.py 2007-06-15 14:58:38 EDT (Fri, 15 Jun 2007)
@@ -1,10 +1,11 @@
 #!/usr/bin/env python
 
 import sys
-import pysvn
 import os.path
 import time
+import subprocess
 from datetime import datetime, timedelta
+from xml.dom.minidom import parseString
 
 class Build:
     def __init__(self, id_, build_variant_, ctest_variant_):
@@ -12,11 +13,36 @@
         self.build_variant = build_variant_
         self.ctest_variant = ctest_variant_
         self.revision = -1
- self.avg_time = datetime.min
         self.last_start = datetime.min
 
     def __str__(self):
- return "id:" + self.id + " bv:" + self.build_variant + " cv:" + self.ctest_variant + " rev:" + str(self.revision) + " avg_t:" + str(self.avg_time) + " last_t:" + str(self.last_start)
+ return self.id + "/" + self.build_variant + "/" + self.ctest_variant + " r" + str(self.revision) + " last_t:" + str(self.last_start)
+
+def svn_status_revision(srcdir):
+ output = subprocess.Popen([svn, "info", "--xml", srcdir], stdout=subprocess.PIPE).communicate()[0]
+ dom = parseString(output)
+ rev = dom.getElementsByTagName("commit")[0].getAttribute("revision")
+ return rev
+
+def svn_update(srcdir, revision):
+ try:
+ retcode = subprocess.call([svn, "update", "-r", revision, srcdir])
+ if retcode < 0:
+ print >>sys.stderr, "Child was terminated by signal ", -retcode
+ else:
+ print >>sys.stderr, "Child returned", retcode
+ except OSError, e:
+ print >> sys.stderr, "Execution failed:", e
+
+def svn_checkout(url, srcdir):
+ try:
+ retcode = subprocess.call([svn, "co", url, srcdir])
+ if retcode < 0:
+ print >>sys.stderr, "Child was terminated by signal ", -retcode
+ else:
+ print >>sys.stderr, "Child returned", retcode
+ except OSError, e:
+ print >> sys.stderr, "Execution failed:", e
 
 def nextbuild(builds):
     front = Build('none', 'none', 'none')
@@ -52,8 +78,6 @@
         exit(1)
 
 def checkout(argv):
- client = pysvn.Client()
- client.exception_style = 0
     builds = initbuilds()
     for id, url in urls.items():
         srcdir = os.path.join(topdir,prefix,id,"src")
@@ -62,11 +86,8 @@
         except:
             print "Directory %s exists, not creating." % id
             
- try:
- print "Checking out " + id
- client.checkout(url, srcdir)
- except pysvn.ClientError, e:
- print "Error:\n" + str(e)
+ print "Checking out " + id
+ svn_checkout(url, srcdir)
 
         print "Making build directories..."
         for build in builds:
@@ -82,28 +103,24 @@
             os.system(cmd)
     
 def run(args):
- client = pysvn.Client()
- client.exception_style = 0
     builds = initbuilds()
     while True:
         build = nextbuild(builds)
- print "*******\n******* " + str(build) + " *******\n*******"
+ print ">>> Doing " + str(build)
+ if build.revision != -1:
+ print ">>> Updating " + srcdir + " to " + str(build.revision)
+ svn_update(srcdir, build.revision)
         build.last_start = datetime.now()
         os.chdir(os.path.join(topdir, prefix, build.id, build.build_variant, build.ctest_variant))
         cmd = ctest + " " + " ".join(ctest_variants[build.ctest_variant][0])
- srcdir = os.path.join(topdir, prefix, build.id, "src")
- if build.revision != -1:
- print ">>> Updating " + srcdir + " to " + str(build.revision)
- client.update(srcdir, recurse=True,
- revision=pysvn.Revision(pysvn.opt_revision_kind.number, build.revision))
- time.sleep(0)
         print ">>> " + cmd
         os.system(cmd)
- status_list = client.status(os.path.join(topdir, prefix, build.id, "src"), recurse=False)
- rev = status_list[0].entry.revision.number
+ srcdir = os.path.join(topdir, prefix, build.id, "src")
+ rev = svn_status_revision(srcdir)
         build.revision = rev
-# print "status: " + str(status_list)
- time.sleep(0)
+ print ">>> New last-built revision of " + srcdir + " is " + str(rev)
+ print ">>>\n>>> Finshed build " + str(build) + "\n>>>"
+ time.sleep(interbuild_sleep)
                 
 def help(argv):
     print __name__
@@ -127,7 +144,6 @@
     'checkout' : checkout,
     'run' : run,
     'help' : help,
- 'initbuilds' : dropenv(initbuilds),
     }
 
 if __name__ == "__main__":

Modified: sandbox-branches/boost-cmake/dart-client/conf.py
==============================================================================
--- sandbox-branches/boost-cmake/dart-client/conf.py (original)
+++ sandbox-branches/boost-cmake/dart-client/conf.py 2007-06-15 14:58:38 EDT (Fri, 15 Jun 2007)
@@ -1,14 +1,32 @@
+#
+# Name of local directory that will contain build output
+#
 prefix = 'prefix'
 
+#
+# Wait 3 minutes between builds
+#
+interbuild_sleep = 180
+
+#
+# Association tag => url of things to build/test
+#
 boost_svn = 'http://svn.boost.org/svn/boost/sandbox-branches/boost-cmake/boost_1_34_0'
 test_svn = 'http://svn.resophonic.com/pub/ctest-tiny'
-urls = { 'boost_1_34_0' : boost_svn }
+urls = { 'boost_1_34_0' : test_svn }
 
+#
+# Variants to build/test: map of tag => [cmake_arguments]
+#
 build_variants = {
     'debug' : ['-DBUILD_TESTING:BOOL=ON', '-DBUILD_RELEASE:BOOL=OFF', '-DBUILD_DEBUG:BOOL=ON'],
     'release': ['-DBUILD_TESTING:BOOL=ON', '-DBUILD_RELEASE:BOOL=ON', '-DBUILD_DEBUG:BOOL=OFF']
 }
 
+#
+# calculates delta-time for nightly builds. if last build happened
+# today, return a negative delta
+#
 def nightly_dt(t):
     current_time = datetime.now()
     if current_time.date() > t.date():
@@ -16,6 +34,9 @@
     else:
         return timedelta(-1) # delta of negative one day, won't get run
 
+#
+# For testing, return dt if t didn't happen this minute.
+#
 def minutely_dt(t):
     current_time = datetime.now()
     if current_time.replace(microsecond=0, second=0) > t:
@@ -23,10 +44,22 @@
     else:
         return timedelta(-1) # delta of negative one day, won't get run
 
+#
+# Straight delta-time for continuous builds
+#
 def continuous_dt(t):
     current_time = datetime.now()
     return current_time - t
 
+#
+# Association of ctest variants to build: tag => ([ctest_args], delta_fn)
+#
+# Where delta_fn returns the amount of time between now and its
+# argument. The build with the longest delta_t will be built next.
+# This allows Nightly or weekly builds to return a negative delta
+# (and therefore will not be built) when the actual dt is less than some
+# threshold.
+#
 ctest_variants = {
     'continuous' : (['-D', 'Continuous'], continuous_dt),
     'nightly' : (['-D', 'Nightly'], nightly_dt)
@@ -39,6 +72,7 @@
 #
 ctest = "ctest"
 cmake = "cmake"
+svn = "svn"
 
 # Typical settings on windows:
 #

Deleted: sandbox-branches/boost-cmake/dart-client/continuous.ctest
==============================================================================
--- sandbox-branches/boost-cmake/dart-client/continuous.ctest 2007-06-15 14:58:38 EDT (Fri, 15 Jun 2007)
+++ (empty file)
@@ -1,64 +0,0 @@
-#
-# continuous.ctest - run an incremental build of boost
-#
-# Does an svn update and builds/tests if something has changed.
-#
-# Synopsis:
-#
-# ctest -S continuous.ctest,Release
-# ctest -S continuous.ctest,Debug
-#
-# The argument after the comma, above, must be present.
-# The failure modes for this "script" are too many to enumerate.
-#
-
-#
-# Customize these to match your machine.
-#
-SET (CTEST_CMAKE_COMMAND "cmake")
-SET (CTEST_CVS_COMMAND "svn")
-SET (CTEST_SOURCE_URL "http://svn.boost.org/svn/boost/sandbox-branches/boost-cmake/boost_1_34_0")
-
-# run for this many minutes.
-SET (CTEST_CONTINUOUS_DURATION 600)
-# wait this long between builds
-SET (CTEST_CONTINUOUS_MINIMUM_INTERVAL 1)
-# clean directory out before first build
-SET (CTEST_START_WITH_EMPTY_BINARY_DIRECTORY_ONCE 1)
-
-# These next two must be absolute paths. The parent, $ENV{PWD}/nightly should exist and be empty.
-# If $ENV{PWD}/nightly/src exists but doesn't contain a CMakeLists.txt, you will get an
-# unhelpful error message.
-SET (CTEST_SOURCE_DIRECTORY "$ENV{PWD}/continuous/${CTEST_SCRIPT_ARG}-src")
-SET (CTEST_BINARY_DIRECTORY "$ENV{PWD}/continuous/${CTEST_SCRIPT_ARG}-build")
-FILE(MAKE_DIRECTORY "$ENV{PWD}/continuous")
-
-SET (CTEST_COMMAND "ctest -D Continuous -VV")
-
-if(${CTEST_SCRIPT_ARG} MATCHES Debug)
- set(RELEASE_VARIANT_SETTING "OFF")
- set(DEBUG_VARIANT_SETTING "ON")
- set(SOURCE_DIRECTORY_PREFIX "debug")
- elseif(${CTEST_SCRIPT_ARG} MATCHES Release)
- set(RELEASE_VARIANT_SETTING "ON")
- set(DEBUG_VARIANT_SETTING "OFF")
- set(SOURCE_DIRECTORY_PREFIX "release")
- else(${CTEST_SCRIPT_ARG} MATCHES Debug)
- MESSAGE(FATAL_ERROR "Argument is \"${CTEST_SCRIPT_ARG}\" and must be one of \"Debug\" or \"Release\"")
-endif(${CTEST_SCRIPT_ARG} MATCHES Debug)
-
-
-#
-# These must be abolute paths. You may want to customize these as well.
-#
-
-SET (CTEST_CVS_CHECKOUT "${CTEST_CVS_COMMAND} co ${CTEST_SOURCE_URL} ${CTEST_SOURCE_DIRECTORY}")
-
-SET (CTEST_INITIAL_CACHE "
-CMAKE_BUILD_TYPE:STRING=
-CMAKE_VERBOSE_MAKEFILE:BOOL=ON
-BUILD_RELEASE:BOOL=${RELEASE_VARIANT_SETTING}
-BUILD_DEBUG:BOOL=${DEBUG_VARIANT_SETTING}
-BUILD_TESTING:BOOL=ON
-")
-

Deleted: sandbox-branches/boost-cmake/dart-client/initialize.sh
==============================================================================
--- sandbox-branches/boost-cmake/dart-client/initialize.sh 2007-06-15 14:58:38 EDT (Fri, 15 Jun 2007)
+++ (empty file)
@@ -1,88 +0,0 @@
-#!/bin/sh -x
-
-#
-# initialize.sh
-#
-
-# This script initializes a dart-client testing hierarchy on local
-# disk to support running the run.sh script found in this directory.
-
-# The directory structure constructed by this script is as follows:
-#
-# debug/
-# nightly/
-# src/
-# build/
-# continuous/
-# src/
-# build/
-# release/
-# nightly/
-# src/
-# build/
-# continuous/
-# src/
-# build/
-
-#
-# Customizations:
-#
-# srcurl: The source to build and test
-#
-srcurl="http://svn.boost.org/svn/boost/sandbox-branches/boost-cmake/boost_1_34_0"
-
-#
-# path to cmake
-#
-cmake_bin="cmake"
-
-#
-# path to svn
-#
-svn_bin="svn"
-
-#
-# CXX: if you'd like to specify a particular compiler, set it here
-#
-export CXX=
-
-#
-# Set topdir to directory where the builds should go. Default is the directory
-# where this script is found.
-#
-scriptdir=`dirname $0`
-cd $scriptdir
-topdir=`pwd`
-
-#
-# recheckout to local copy
-#
-rm -rf src.tmp
-$svn_bin co $srcurl src.tmp
-
-for variant in debug release
-do
- for rate in nightly continuous
- do
- builddir=$topdir/$variant/$rate
- rm -rf $builddir
- mkdir -p $builddir/build
- # instead of doing multiple checkouts and abusing the svn box, just rsync your temporary
- rsync -a $topdir/src.tmp/ $builddir/src/
- cd $builddir/build
- rm -f CMakeCache.txt
- if [ "$variant" = "debug" ] ; then
- VARIANT_ARGS="-DBUILD_DEBUG:BOOL=ON -DBUILD_RELEASE:BOOL=OFF"
- else
- VARIANT_ARGS="-DBUILD_DEBUG:BOOL=OFF -DBUILD_RELEASE:BOOL=ON"
- fi
- CXX="$COMPILER" $cmake_bin \
- -DBUILD_TESTING:BOOL=ON \
- -DCMAKE_BUILD_TYPE:STRING= \
- -DCMAKE_VERBOSE_MAKEFILE:STRING=ON \
- $VARIANT_ARGS $builddir/src
- done
-done
-
-echo "Done initializing dart-client build directories."
-

Deleted: sandbox-branches/boost-cmake/dart-client/nightly.ctest
==============================================================================
--- sandbox-branches/boost-cmake/dart-client/nightly.ctest 2007-06-15 14:58:38 EDT (Fri, 15 Jun 2007)
+++ (empty file)
@@ -1,58 +0,0 @@
-#
-# nightly.ctest - run a nightly build of boost
-#
-# Runs a checkout and build of boost and submits build results to a dartbard
-#
-# Synopsis:
-#
-# ctest -S nightly.ctest,Release
-# ctest -S nightly.ctest,Debug
-#
-# The argument after the comma, above, must be present.
-# The failure modes for this "script" are too many to enumerate.
-#
-
-#
-# Customize these to match your machine.
-#
-
-SET (CTEST_CMAKE_COMMAND "cmake")
-SET (CTEST_CVS_COMMAND "svn")
-SET (CTEST_SOURCE_URL "http://svn.boost.org/svn/boost/sandbox-branches/boost-cmake/boost_1_34_0")
-#
-# These next two must be absolute paths. The parent, $ENV{PWD}/nightly should exist and be empty.
-# If $ENV{PWD}/nightly/src exists but doesn't contain a CMakeLists.txt, you will get an
-# unhelpful error message.
-#
-SET (CTEST_SOURCE_DIRECTORY "$ENV{PWD}/nightly/${CTEST_SCRIPT_ARG}-src")
-SET (CTEST_BINARY_DIRECTORY "$ENV{PWD}/nightly/${CTEST_SCRIPT_ARG}-build")
-FILE(MAKE_DIRECTORY "$ENV{PWD}/nightly")
-
-SET (CTEST_COMMAND "ctest -D Nightly -VV")
-
-if(${CTEST_SCRIPT_ARG} MATCHES Debug)
- set(RELEASE_VARIANT_SETTING "OFF")
- set(DEBUG_VARIANT_SETTING "ON")
- elseif(${CTEST_SCRIPT_ARG} MATCHES Release)
- set(RELEASE_VARIANT_SETTING "ON")
- set(DEBUG_VARIANT_SETTING "OFF")
- else(${CTEST_SCRIPT_ARG} MATCHES Debug)
- MESSAGE(FATAL_ERROR "Argument is \"${CTEST_SCRIPT_ARG}\" and must be one of \"Debug\" or \"Release\"")
-endif(${CTEST_SCRIPT_ARG} MATCHES Debug)
-
-
-#
-# These must be abolute paths. You may want to customize these as well.
-#
-SET (CTEST_CVS_CHECKOUT "${CTEST_CVS_COMMAND} co ${CTEST_SOURCE_URL} ${CTEST_SOURCE_DIRECTORY}")
-
-SET (CTEST_START_WITH_EMPTY_BINARY_DIRECTORY TRUE)
-
-SET (CTEST_INITIAL_CACHE "
-CMAKE_BUILD_TYPE:STRING=
-CMAKE_VERBOSE_MAKEFILE:BOOL=ON
-BUILD_RELEASE:BOOL=${RELEASE_VARIANT_SETTING}
-BUILD_DEBUG:BOOL=${DEBUG_VARIANT_SETTING}
-BUILD_TESTING:BOOL=ON
-")
-

Deleted: sandbox-branches/boost-cmake/dart-client/nightly.sh
==============================================================================
--- sandbox-branches/boost-cmake/dart-client/nightly.sh 2007-06-15 14:58:38 EDT (Fri, 15 Jun 2007)
+++ (empty file)
@@ -1,27 +0,0 @@
-#!/bin/sh -x
-
-if [[ -z "$UPDATE_DONE" ]]
-then
- svn update $0
- UPDATE_DONE=YES $0 $*
- exit
-fi
-
-COMPILER=$1
-if [[ -z "$COMPILER" ]]
-then
- echo "Setting compiler to default of g++"
- COMPILER=g++
-fi
-
-topdir=`dirname $0`
-cd $topdir
-topdir=`pwd`
-
-cd $topdir/debug
-CXX="$COMPILER" ctest -S nightly.cmake -V
-cd $topdir/release
-CXX="$COMPILER" ctest -S nightly.cmake -V
-
-
-

Deleted: sandbox-branches/boost-cmake/dart-client/run.sh
==============================================================================
--- sandbox-branches/boost-cmake/dart-client/run.sh 2007-06-15 14:58:38 EDT (Fri, 15 Jun 2007)
+++ (empty file)
@@ -1,50 +0,0 @@
-#!/bin/sh -x
-
-#
-# run.sh: run nightly and continuous builds.
-#
-
-#
-# This script runs as a daemon. Once per day a 'nightly' build will
-# be run and the continuous build directories will be cleaned out.
-# After this 'continuous' builds will be continuously run.
-#
-
-#
-# Set topdir to directory where the builds should go. Default is the directory
-# where this script is found.
-#
-scriptdir=`dirname $0`
-cd $scriptdir
-topdir=`pwd`
-
-#
-# Start script
-#
-
-# date of last nightly build: YYYYMMDD
-lastnightly=00000000
-sleepduration=180
-ctest_bin=ctest
-# alternately build debug and release
-while true
-do
- rightnow=`date +%Y%m%m`
- if [ $rightnow -gt $lastnightly ] ; then
- lastnightly=$rightnow
-
- # do nightly builds
- cd $topdir/debug/nightly/build
- $ctest_bin -D Nightly
- cd $topdir/release/nightly/build
- $ctest_bin -D Nightly
- fi
-
- cd $topdir/debug/continuous/build
- $ctest_bin -D Continuous
- cd $topdir/release/continuous/build
- $ctest_bin -D Continuous
-
- sleep $sleepduration
-done
-


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk