From: Richard Whitehouse Date: Tue, 10 May 2011 22:00:49 +0000 (+0100) Subject: Allow only a selection of tests to be run X-Git-Url: https://git.richardwhiuk.com/?a=commitdiff_plain;h=a9336df1b63364cdbf1de6d3ffe5368a5ad33350;p=ii-simulations.git Allow only a selection of tests to be run --- diff --git a/run b/run index 1564bd4..f07ec12 100755 --- 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