test/dtnsendrecv.tcl
changeset 0 2b3e5ec03512
equal deleted inserted replaced
-1:000000000000 0:2b3e5ec03512
       
     1 #
       
     2 #    Copyright 2008 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 dtnsendrecv
       
    18 net::default_num_nodes 2
       
    19 
       
    20 manifest::file apps/dtnsend/dtnsend dtnsend
       
    21 manifest::file apps/dtnrecv/dtnrecv dtnrecv
       
    22 
       
    23 set testopt(cl)       tcp
       
    24 run::parse_test_opts
       
    25 
       
    26 dtn::config
       
    27 
       
    28 testlog "Configuring $testopt(cl) interfaces / links"
       
    29 dtn::config_interface $testopt(cl)
       
    30 dtn::config_linear_topology ALWAYSON $testopt(cl) true
       
    31 
       
    32 test::script {
       
    33     testlog "Running dtnds"
       
    34     dtn::run_dtnd *
       
    35 
       
    36     testlog "Waiting for dtnds to start up"
       
    37     dtn::wait_for_dtnd *
       
    38     
       
    39     set last   [expr [net::num_nodes] - 1]
       
    40 
       
    41     set source dtn://host-0/test
       
    42     set dest   dtn://host-$last/test
       
    43     
       
    44     testlog "Sending a small memory bundle"
       
    45     dtn::run_app_and_wait 0     dtnsend "-s $source -d $dest -t m -p test_payload"
       
    46     dtn::run_app_and_wait $last dtnrecv "-n 1 $dest"
       
    47 
       
    48     testlog "Sending dtnsend executable in a bundle"
       
    49     set file [file join [dist::get_rundir $net::host(0) 0] dtnsend]
       
    50     dtn::run_app_and_wait 0     dtnsend "-s $source -d $dest -t f -p $file"
       
    51     dtn::run_app_and_wait $last dtnrecv "-q -n 1 $dest"
       
    52 
       
    53     testlog "Sending dtnd executable in a bundle"
       
    54     set file [file join [dist::get_rundir $net::host(0) 0] dtnd]
       
    55     dtn::run_app_and_wait 0     dtnsend "-s $source -d $dest -t f -p $file"
       
    56     dtn::run_app_and_wait $last dtnrecv "-q -n 1 $dest"
       
    57 
       
    58     testlog "Checking to see if any bundle payloads were leaked"
       
    59     set payload_files [tell_dtnd $last glob -nocomplain /tmp/bundlePayload*]
       
    60     if {$payload_files != ""} {
       
    61         puts "WARNING: payload files still exist on destination host: $payload_files"
       
    62     }
       
    63 
       
    64     testlog "Test success!"
       
    65 }
       
    66 
       
    67 test::exit_script {
       
    68     testlog "Stopping all dtnds"
       
    69     dtn::stop_dtnd *
       
    70 }