Setting up TUnit

From TinyOS Wiki
Revision as of 10:56, 10 January 2008 by Dmoss (talk | contribs)
Jump to: navigation, search

Minimum Requirements

The minimum requirements are:


Your projects and directories may differ. On the automated unit testing server, the tinyos-2.x and tinyos-2.x-contrib directories are located in a simplistic structure:

 opt
 |-- tinyos-2.x
 |-- tinyos-2.x-contrib


In my own private projects, I prefer a more complex structure:

 opt
 |-- myProject
 |   |-- tinyos-2.x    <-- A snapshot of TinyOS my project is compatible with
 |   |-- tests
 |   |   |-- ... bunch of sub-test directories...
 |   |-- tinyos-2.x-myProject    <-- Project's files that override the TinyOS baseline
 |   
 |-- tinyos-2.x-contrib

For the remainder of this setup guide, I will assume your TinyOS is setup in the simplistic structure, with directories located at /opt/tinyos-2.x and /opt/tinyos-2.x-contrib.

Environment Variables

TOSCONTRIB

TUnit needs to know where the tinyos-2.x-contrib is located so it may find the tinyos-2.x-contrib/tunit directory. Because TUnit is driven by a Java application, the TOSCONTRIB path must be absolute so Java can locate the directory.

 Linux
   export TOSCONTRIB=/opt/tinyos-2.x-contrib
 Windows/Cygwin
   export TOSCONTRIB="`cygpath -w /opt/tinyos-2.x-contrib`"


CLASSPATH

Your classpath must be updated to include tunit.jar and all of its dependencies.

 Linux
   export LOG4J=$TOSCONTRIB/tunit/support/sdk/tunit/depends/log4j.jar
   export TUNIT=$TOSCONTRIB/tunit/support/sdk/tunit/tunit.jar
   export XERCES=$TOSCONTRIB/tunit/support/sdk/tunit/depends/xerces.jar
   export JFREECHART=$TOSCONTRIB/tunit/support/sdk/tunit/depends/jfreechart-1.0.5.jar
   export JCOMMON=$TOSCONTRIB/tunit/support/sdk/tunit/depends/jcommon-1.0.9.jar
 
   export CLASSPATH="${CLASSPATH}:${LOG4J}:${TUNIT}:${XERCES}:${JFREECHART}:${JCOMMON}:."


 Windows/Cygwin
   export LOG4J="`cygpath -w $TOSCONTRIB/tunit/support/sdk/tunit/depends/log4j.jar`"
   export TUNIT="`cygpath -w $TOSCONTRIB/tunit/support/sdk/tunit/tunit.jar`"
   export XERCES="`cygpath -w $TOSCONTRIB/tunit/support/sdk/tunit/depends/xerces.jar`"
   export JFREECHART="`cygpath -w $TOSCONTRIB/tunit/support/sdk/tunit/depends/jfreechart-1.0.5.jar`"
   export JCOMMON="`cygpath -w $TOSCONTRIB/tunit/support/sdk/tunit/depends/jcommon-1.0.9.jar`"
 
   export CLASSPATH="${CLASSPATH};${LOG4J};${TUNIT};${XERCES};${JFREECHART};${JCOMMON};."

XML Setup Files