Allow only a selection of tests to be run
authorRichard Whitehouse <github@richardwhiuk.com>
Tue, 10 May 2011 22:00:49 +0000 (23:00 +0100)
committerRichard Whitehouse <github@richardwhiuk.com>
Tue, 10 May 2011 22:00:49 +0000 (23:00 +0100)
run

diff --git a/run b/run
index 1564bd4bab88a4a706e487ea8c3f786ad0ae3f2c..f07ec1222badd26da57b80ccd86c475cb155b566 100755 (executable)
--- a/run
+++ b/run
@@ -1,31 +1,58 @@
 #!/bin/bash
 
-function runtests {
-       pushd .
+
+function runtest {
+       pushd . > /dev/null
        cd "`dirname "$0"`"
        for testno in *
        do
                if [ -d $testno ]; then
-                       runtest $testno
+                       _runtest $testno
                fi
        done;
-       popd
+       popd > /dev/null
 }
 
-function runtest {
-       pushd .
-       cd ../code/
-       _runtest $1 ethernet
-       _runtest $1 moose
-       popd
+function _runtest {
+       __runtest $1 ethernet
+       __runtest $1 moose
 }
 
-function _runtest {
-       mkdir -p ../simulations/$1/$2
-       ./waf --run "simulation --network=../simulations/$1/topology --data=../simulations/$1/data --csma=../simulations/$1/$2/csma --ip=../simulations/$1/$2/ip --pcap=../simulations/$1/$2/pcap --link=$2 --state=../simulations/$1/$2/state"
+function __runtest {
+       ___runtest $1 $2 static
+       ___runtest $1 $2 dynamic
+}
+
+function ___runtest {
+       pushd . > /dev/null
+       cd "`dirname "$0"`/../code/"
+       mkdir -p ../simulations/$1/$2/$3
+       ./waf --run "simulation --network=../simulations/$1/topology --data=../simulations/$1/data --csma=../simulations/$1/$2/$3/csma --ip=../simulations/$1/$2/$3/ip --pcap=../simulations/$1/$2/$3/pcap --link=$2 --state=../simulations/$1/$2/$3/state --routing=$3"
+       popd > /dev/null
 }
 
 # Tests
 
-runtests
+if [ $# == 3 ]; then
+       ___runtest $1 $2 $3
+       exit
+fi
+
+if [ $# == 2 ]; then
+       __runtest $1 $2
+       exit
+fi
+
+if [ $# == 1 ]; then
+       _runtest $1
+       exit
+fi
+
+if [ $# == 0 ]; then
+       runtest
+       exit
+fi
+
+echo "Usage: $0 [ test [ linklayer [ routing ] ] ]"
+exit