Automated test setup

From Rsewiki

An automated test system is setup on tustin.iau.dtu.dk. The test consists of a number of scripts testing various features of the Mobotware software. The test is run hourly by a cron job and output is directed to a homepage. The cron job is setup on a Linux system by running crontab -e and adding the following line:

00 * * * * /path/to/scripts/byg-check


Compile test

To test that all programs in the standard Mobotware package compiles as intended the script byg-check is used.

#!/bin/bash

WEB_PATH=/path/to/output/page.html
RUN_TIME=`date`

cd /path/to/scripts
svn up > /dev/null

make clean > /dev/null

rm -f err.log
cat text.html > out.html
echo $RUN_TIME >> out.html
make > /dev/null 2> err.log
if [ $? -eq 0 ]; then
  echo "<hr><h2>Compile status: SUCCESS</h2>" >> out.html
else
  echo "<hr><h2>Compile status: FAILED</h2><hr><b>Error-log:</b><br>" >> out.html
  cat err.log >> out.html
fi

echo "</body></html>" >> out.html
cp out.html $WEB_PATH

exit 0

Simulator test

A test run is done in the simulator to check odometry and laser based localisation. To run the simulator without a display a virtual frame buffer is created using Xvfb.

The script is:

#!/bin/bash
rm -f log
Xvfb :100 &
FRAMEPID=$!
export DISPLAY=:100
build/bin/rhd rhdconfig.maze.xml >simlog 2>simerr &
RHDPID=$!
sleep 5
build/bin/ulmsserver -a > /dev/null 2> /dev/null &
ULMPID=$!
sleep 5
build/bin/mrc -s0  test >mrclog 2>mrcerrlog
grep "1.0" log
if [ $? -eq 0 ]; then
   RETVAL=1
else
   grep "2.0" log
   if [ $? -eq 0 ]; then
     RETVAL=2
   else
     RETVAL=0
   fi
fi

kill $FRAMEPID $RHDPID $ULMPID

exit $RETVAL

The mrc program test is a smrcl script that drives the robot around a predefined pattern:

laser "setinitpose x=-0.2 y=0.5 th=0.0"
laser "setinitcov Cx=0.004 Cy=0.004 Cth=0.01"
laser "push t='1.0' cmd='localize'"
fwd 1.7 
turn 75
fwd 1.8
turn 15
fwd 1.15
turn 90
fwd 1.75
turn 60
fwd 0.15
turn 15
fwd 0.12
turn 15
fwd 0.3 
turn 45
fwd 0.5
turn -45 
fwd 1.45
turn -90
fwd 0.7
eval $odox;$odoy;$odoth
eval $l0;$l1;$l2
result=0
resultt=1
if (abs($odox+0.033)>0.01|abs($odoy-0.542)>0.01|abs(normalizeanglerad($odoth-3.14))>0.01) "failed"
resultt=2
if (abs($l0-0.1)>0.03|abs($l1+0.4)>0.03|abs(normalizeanglerad($l2))>0.05) "failed"
resultt=0
label "failed"
log "result"
result = resultt