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_vmc-client.sh.in 1.54 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 40
## Variables

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

SRCDIR=@srcdir@
PORT=7070

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

##

vmc-client -l `pwd`/test_vmc-client.log \
    -i `pwd`/test_vmc-client.pid \
Timothy Stack's avatar
 
Timothy Stack committed
41
    -f ${SRCDIR}/test_vmc-client.pos \
Timothy Stack's avatar
 
Timothy Stack committed
42 43 44 45 46 47 48
    -p ${PORT} \
    foobar

trap 'kill `cat test_vmc-client.pid`' EXIT

sleep 1

Timothy Stack's avatar
 
Timothy Stack committed
49 50
(sleep 1; kill -s USR1 `cat test_vmc-client.pid`; 
sleep 1; kill -s USR1 `cat test_vmc-client.pid`;) &
Timothy Stack's avatar
 
Timothy Stack committed
51

Timothy Stack's avatar
 
Timothy Stack committed
52
run_test ../mtp/mtp_dump localhost ${PORT} 4
Timothy Stack's avatar
 
Timothy Stack committed
53 54

check_output "bad update?" <<EOF
Timothy Stack's avatar
 
Timothy Stack committed
55
Packet: version 2; role vmc
Timothy Stack's avatar
 
Timothy Stack committed
56 57
 opcode:	update-position
  id:		-1
Timothy Stack's avatar
 
Timothy Stack committed
58 59
  x:		5.500000
  y:		2.500000
Timothy Stack's avatar
 
Timothy Stack committed
60
  theta:	-1.090796
Timothy Stack's avatar
 
Timothy Stack committed
61
  status:	-1
Timothy Stack's avatar
 
Timothy Stack committed
62
  timestamp:	0.000000
Timothy Stack's avatar
 
Timothy Stack committed
63
Packet: version 2; role vmc
Timothy Stack's avatar
 
Timothy Stack committed
64 65
 opcode:	update-position
  id:		-1
Timothy Stack's avatar
 
Timothy Stack committed
66 67
  x:		6.500000
  y:		4.500000
Timothy Stack's avatar
 
Timothy Stack committed
68
  theta:	-1.030796
Timothy Stack's avatar
Timothy Stack committed
69
  status:	32
Timothy Stack's avatar
 
Timothy Stack committed
70
  timestamp:	0.000000
Timothy Stack's avatar
 
Timothy Stack committed
71
Packet: version 2; role vmc
Timothy Stack's avatar
 
Timothy Stack committed
72 73
 opcode:	update-position
  id:		-1
Timothy Stack's avatar
 
Timothy Stack committed
74 75
  x:		5.500000
  y:		3.000000
Timothy Stack's avatar
 
Timothy Stack committed
76
  theta:	-1.090796
Timothy Stack's avatar
 
Timothy Stack committed
77
  status:	-1
Timothy Stack's avatar
 
Timothy Stack committed
78
  timestamp:	1.000000
Timothy Stack's avatar
 
Timothy Stack committed
79
Packet: version 2; role vmc
Timothy Stack's avatar
 
Timothy Stack committed
80 81
 opcode:	update-position
  id:		-1
Timothy Stack's avatar
 
Timothy Stack committed
82 83
  x:		7.500000
  y:		4.500000
Timothy Stack's avatar
 
Timothy Stack committed
84
  theta:	-1.030796
Timothy Stack's avatar
 
Timothy Stack committed
85
  status:	32
Timothy Stack's avatar
 
Timothy Stack committed
86
  timestamp:	1.000000
Timothy Stack's avatar
 
Timothy Stack committed
87
EOF