test/dtnsim.tcl
changeset 0 2b3e5ec03512
equal deleted inserted replaced
-1:000000000000 0:2b3e5ec03512
       
     1 #
       
     2 #    Copyright 2004-2006 Intel Corporation
       
     3 # 
       
     4 #    Licensed under the Apache License, Version 2.0 (the "License");
       
     5 #    you may not use this file except in compliance with the License.
       
     6 #    You may obtain a copy of the License at
       
     7 # 
       
     8 #        http://www.apache.org/licenses/LICENSE-2.0
       
     9 # 
       
    10 #    Unless required by applicable law or agreed to in writing, software
       
    11 #    distributed under the License is distributed on an "AS IS" BASIS,
       
    12 #    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
       
    13 #    See the License for the specific language governing permissions and
       
    14 #    limitations under the License.
       
    15 #
       
    16 
       
    17 test::name dtnsim-basic
       
    18 net::default_num_nodes 1
       
    19 
       
    20 set conf_path ""
       
    21 foreach {var val} $opt(opts) {
       
    22     if {$var == "-c"} {
       
    23 	set conf_path $val
       
    24     } else {
       
    25         error "unknown test option $var"
       
    26     }
       
    27 }
       
    28 
       
    29 if {$conf_path == ""} {
       
    30     error "must specify simulator config file"
       
    31 }
       
    32 
       
    33 if {[file exists $base_test_dir/sim/conf/$conf_path]} {
       
    34     set conf_path $base_test_dir/sim/conf/$conf_path
       
    35 }
       
    36 
       
    37 if {![file exists $conf_path]} {
       
    38     error "simulator conf file $conf_path does not exist"
       
    39 }
       
    40 
       
    41 test::script {
       
    42     testlog "Running simulator"
       
    43     exec sim/dtnsim -c $conf_path <@stdin >@stdout 2>@stderr
       
    44     
       
    45     testlog "Test success!"
       
    46 }