(home)

Learning about BuildBot

Introduction

I'm looking at using BuildBot for regression testing for Arduino. BuildBot is my current choice due to being Python-based. This page documents the process.

Project Log

( 11 April 2009 )

Buildbot version: 0.7.6
Twisted version: 2.5.0
PYTHONPATH=. trial buildbot.test
 mkdir -p ~buildmaster/masters/arduino
 buildbot create-master ~buildmaster/masters/arduino
cp masters/arduino/master.cfg.sample masters/arduino/master.cfg
# Modify:
c['projectName'] = "Arduino"
c['projectURL'] = "http://arduino.cc/"
svnpoller.SVNPoller (polling the SVN repository)
svn checkout http://arduino.googlecode.com/svn/trunk/ arduino
./make.sh

# then...

/run.sh

( 14 April 2009 )

c['schedulers'].append(Scheduler(name="all", branch=None,
                                 treeStableTimer=2*60,
                                 builderNames=["arduino-checkout"]))
# CVS, SVN, and others.                                                         


from buildbot.process import factory
from buildbot.steps.source import SVN
from buildbot.steps.shell import Compile
from buildbot.steps.python_twisted import Trial
f1 = factory.BuildFactory()
f1.addStep(SVN(svnurl='http://arduino.googlecode.com/svn/trunk/app/',
               mode="copy"))
#f1.addStep(Compile(command=["python", "./setup.py", "build"]))                 
#f1.addStep(Trial(testpath="."))                                                

b1 = {'name': "arduino-checkout",
      'slavename': "bot1name",
      'builddir': "full",
      'factory': f1,
      }
c['builders'] = [b1]
 buildbot start masters/arduino/
 buildbot stop masters/arduino/
 buildbot start masters/arduino/
 buildbot reconfig masters/arduino/
The buildmaster appears to have (re)started correctly.

( 5 May 2009 )

export DISPLAY=:1; Xvfb -ac :1 &
cd ~/Code/arduino/build/linux/work
./arduino
 xwd -display :1 -root | xwud
No protocol specified
xwd:  unable to open display ':1'
xte -x :1 'keydown Control_L' 'key r' 'keyup Control_L'
xwd -display :1 -root | xwud -scale
xte -x :1 'keydown Control_L' 'key q' 'keyup Control_L'
$ avr-size /tmp/build8282.tmp/Blink.hex
   text	   data	    bss	    dec	    hex	filename
      0	    982	      0	    982	    3d6	/tmp/build8282.tmp/Blink.hex

( 14 May 2009 )

mkdir -p altroot/var/lib/dpkg/
mkdir -p altroot/var/cache/apt/archives/partial
#apt-get  -o=Debug::NoLocking=true -o=RootDir=altroot -s install xvfb
##apt-get  -o=Debug::NoLocking=true  -o=Dir::Cache=/<homedir>/altroot/var/cache/apt/ install xvfb
## doesn't yet work due to different xvfb & libpng versions.

( 18 May 2009 )

mkdir -p ~/Buildslave/arduino
buildbot create-slave ~/Buildslave/arduino/ localhost:9989 bot1name <password>
# Buildslave/arduino/info/admin
# Buildslave/arduino/info/host
buildbot start Buildslave/arduino/
 #buildbot sendchange --master localhost:9989 --username change
c['debugPassword'] = "<password>"
buildbot debugclient --master localhost:9989 --passwd <password>
received error
Index: buildbot/clients/debug.py
===================================================================
--- a/buildbot/clients/debug.py
+++ b/buildbot/clients/debug.py
@@ -166,7 +166,5 @@
         d.addErrback(self.err)
     def err(self, failure):
-        print "received error"
-        failure.printTraceback()
-        
+        print "received error:", failure

     def run(self):

( 19 May 2009 )

from buildbot.process import factory
from buildbot.steps.source import SVN
from buildbot.steps.shell import Compile, ShellCommand
from buildbot.steps.python_twisted import Trial
f1 = factory.BuildFactory()
f1.addStep(SVN(svnurl='http://arduino.googlecode.com/svn/trunk/', mode="copy"))
f1.addStep(ShellCommand(command=["/bin/sh","-c","./make.sh"], workdir="build/build/linux/"))
f1.addStep(ShellCommand(command=["/bin/sh","-c","./make.sh"], workdir="build/build/linux/"))

( 23 May 2009 )

Namely, changing the file 'build/linux/dist/arduino' slightly to
enable a sketch file path to be supplied on the command line and
opened automatically. The functionality should be unchanged if no
sketch file path is supplied.

--- arduino~    2009-04-12 01:09:11.000000000 +1200
+++ arduino     2009-05-20 00:46:31.000000000 +1200
@@ -13,4 +13,4 @@
 LD_LIBRARY_PATH=`pwd`/lib:${LD_LIBRARY_PATH}
 export LD_LIBRARY_PATH

-java processing.app.Base
+java processing.app.Base $1

A patch to 'run.sh' would also be required if this functionality was
to be available to it--but that patch is a little more complex due to
the file path manipulation required (if a relative path is supplied)
by the change of the directory path.
#!/bin/sh
#
# screentest <path to arduino dir> <sketch path relative to arduino dir>
#


export DISPLAY=:1

# TODO fix -ac use
Xvfb -ac :1 &

XVFB_PID=$!

sleep 5

cd $1

./arduino $2 &

ARDUINO_PID=$!

sleep 5

xte -x :1 'keydown Control_L' 'key u' 'keyup Control_L'

sleep 15

avr-size `dirname $2`/applet/*.hex

xte -x :1 'keydown Control_L' 'key q' 'keyup Control_L'

sleep 5

kill $ARDUINO_PID

kill $XVFB_PID
code@rancidbacon.com