All new accounts created on Gitlab now require administrator approval. If you invite any collaborators, please let Flux staff know so they can approve the accounts.

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

Timothy Stack's avatar
Timothy Stack committed
3 4 5 6 7 8
#
# EMULAB-COPYRIGHT
# Copyright (c) 2005 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
## Variables

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

SRCDIR=@srcdir@

## 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`
}

##

emcd -l `pwd`/test_emcd.log \
    -i `pwd`/test_emcd.pid \
Timothy Stack's avatar
 
Timothy Stack committed
40
    -U /tmp/$USER.emcd \
Timothy Stack's avatar
 
Timothy Stack committed
41 42 43 44 45 46 47
    -s ops \
    -c `realpath ${SRCDIR}/test_emcd.config`

trap 'kill `cat test_emcd.pid`' EXIT

sleep 2

Timothy Stack's avatar
 
Timothy Stack committed
48
run_test ../mtp/mtp_send -U /tmp/$USER.emcd \
Timothy Stack's avatar
 
Timothy Stack committed
49 50 51 52
    -w -r rmc -i 0 -c 0 -m "empty" init -- \
    -w -r rmc -i 1 request-position

check_output "init -> request-position failed?" <<EOF
Timothy Stack's avatar
 
Timothy Stack committed
53
Packet: version 2; role emc
Timothy Stack's avatar
 
Timothy Stack committed
54 55 56 57
 opcode:	config-rmc
  num:		2
  robot[0]:	1, garcia1.flux.utah.edu
  robot[1]:	2, garcia2.flux.utah.edu
Timothy Stack's avatar
 
Timothy Stack committed
58 59
  bound[0]:	x=0.00, y=0.00, width=5.00, height=6.00
  obstacle[0]:	1 0.35/0.40 x 0.45/0.50
Timothy Stack's avatar
 
Timothy Stack committed
60
Packet: version 2; role emc
Timothy Stack's avatar
 
Timothy Stack committed
61 62 63 64 65 66 67
 opcode:	command-goto
  commid:	1
  id:		1
  x:		0.000000
  y:		0.000000
  theta:	0.000000
  timestamp:	0.000000
Timothy Stack's avatar
 
Timothy Stack committed
68 69
EOF

Timothy Stack's avatar
 
Timothy Stack committed
70 71 72 73 74 75 76 77 78 79 80 81 82
run_test ../mtp/mtp_send -U /tmp/$USER.emcd \
    -w -r vmc -i 0 -c 0 -m "empty" init

check_output "init -> request-position failed?" <<EOF
Packet: version 2; role emc
 opcode:	config-vmc
  num:		2
  robot[0]:	1, garcia1.flux.utah.edu
  robot[1]:	2, garcia2.flux.utah.edu
  camera[0]:	junk.flux.utah.edu:6100
EOF

run_test ../mtp/mtp_send -U /tmp/$USER.emcd  \
Timothy Stack's avatar
 
Timothy Stack committed
83
    -w -r rmc -i 0 -c 0 -m "empty" init -- \
Timothy Stack's avatar
 
Timothy Stack committed
84
    -r rmc -i 1 -x 6 -y 7 -o 0.44 -s complete -t 1.0 update-position -- \
Timothy Stack's avatar
 
Timothy Stack committed
85 86 87
    -w -r rmc -i 1 request-position

check_output "init -> update-position -> request-position failed?" <<EOF
Timothy Stack's avatar
 
Timothy Stack committed
88
Packet: version 2; role emc
Timothy Stack's avatar
 
Timothy Stack committed
89 90 91 92
 opcode:	config-rmc
  num:		2
  robot[0]:	1, garcia1.flux.utah.edu
  robot[1]:	2, garcia2.flux.utah.edu
Timothy Stack's avatar
 
Timothy Stack committed
93 94
  bound[0]:	x=0.00, y=0.00, width=5.00, height=6.00
  obstacle[0]:	1 0.35/0.40 x 0.45/0.50
Timothy Stack's avatar
 
Timothy Stack committed
95
Packet: version 2; role emc
Timothy Stack's avatar
 
Timothy Stack committed
96 97
 opcode:	command-goto
  commid:	1
Timothy Stack's avatar
 
Timothy Stack committed
98
  id:		1
Timothy Stack's avatar
 
Timothy Stack committed
99 100 101 102
  x:		0.000000
  y:		0.000000
  theta:	0.000000
  timestamp:	0.000000
Timothy Stack's avatar
 
Timothy Stack committed
103
EOF