test/bluez-rfcomm.tcl
changeset 0 2b3e5ec03512
equal deleted inserted replaced
-1:000000000000 0:2b3e5ec03512
       
     1 #
       
     2 #    Copyright 2007 Baylor University
       
     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 bluez_rfcomm
       
    18 net::default_num_nodes 2
       
    19 
       
    20 dtn::config 
       
    21 
       
    22 # client must have arg "remote=$bdaddr"
       
    23 set client "oasys/test/rfcomm-client-test"
       
    24 if [file exists $client] {
       
    25 manifest::file $client client
       
    26 } else {
       
    27     puts "Failed to stat $client"
       
    28     exit -1
       
    29 }
       
    30 # server needs no args
       
    31 set server "oasys/test/rfcomm-server-test"
       
    32 if [file exists $server] {
       
    33 manifest::file $server server
       
    34 } else {
       
    35     puts "Failed to stat $server"
       
    36     exit -1
       
    37 }
       
    38 
       
    39 test::script {
       
    40 
       
    41     testlog "Reading Bluetooth adapter addresses from each node"
       
    42     bluez::getbdaddr *
       
    43     
       
    44     testlog "Starting RFCOMM test server on node 0"
       
    45     set srvpid [dtn::run_app 0 server]
       
    46 
       
    47     testlog "Starting RFCOMM test client on node 1"
       
    48     dtn::run_app_and_wait 1 client "remote=$bluez::btaddr(0)"
       
    49 
       
    50     testlog "Waiting for RFCOMM server to complete"
       
    51     run::wait_for_pid_exit 0 $srvpid
       
    52 
       
    53     testlog "Test success!"
       
    54 }
       
    55 
       
    56 test::exit_script {
       
    57     testlog "Cleaning up"
       
    58 }