test_gorobot.sh.in 1.22 KB
Newer Older
Timothy Stack's avatar
 
Timothy Stack committed
1 2
#! /bin/sh

David Johnson's avatar
David Johnson committed
3 4 5 6 7 8
#
# EMULAB-COPYRIGHT
# Copyright (c) 2004-2006 University of Utah and the Flux Group.
# All rights reserved.
#

Timothy Stack's avatar
 
Timothy Stack committed
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
## Variables

# The full path of the test case
test_file=$1
# The base name of the test case
test_file_base="test_gorobot.sh"
# The current test number for shell based tests.
test_num=0

SRCDIR=@srcdir@
PORT=6161

## Helper functions

run_test() {
    echo "run_test: $*"
    $* > ${test_file_base}_${test_num}.tmp 2>&1
}

check_output() {
    diff -u - ${test_file_base}_${test_num}.tmp
    if test $? -ne 0; then
	echo $1
	exit 1
    fi
    test_num=`expr ${test_num} \+ 1`
}

##

gorobot -l `pwd`/test_gorobot.log \
    -i `pwd`/test_gorobot.pid \
    -p ${PORT}

trap 'kill `cat test_gorobot.pid`' EXIT

sleep 2

run_test ../mtp/mtp_send -n localhost -P ${PORT} \
    -w -r rmc -i 1 -C 1 -x 5 -y 7 -o 1.2 command-goto -- \
    -w -r rmc -i 1 -C 1 -x 1 -y 2 -o 0.0 command-goto

check_output "goto failed?" <<EOF
Packet: length 36; version 1; role 1
 opcode:	update-position
  id:		1
  x:		5.000000
  y:		7.000000
Timothy Stack's avatar
 
Timothy Stack committed
57
  theta:	1.200000
Timothy Stack's avatar
 
Timothy Stack committed
58 59 60 61 62 63 64 65 66 67 68
  status:	4
  timestamp:	0.000000
Packet: length 36; version 1; role 1
 opcode:	update-position
  id:		1
  x:		1.000000
  y:		2.000000
  theta:	0.000000
  status:	4
  timestamp:	0.000000
EOF