forked from robotology/yarp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheck-runtime.sh
executable file
·128 lines (95 loc) · 3.9 KB
/
check-runtime.sh
1
2
3
4
5
6
7
8
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#!/bin/bash
function header() {
echo "###############################################################"
echo "## $1"
}
function fail() {
echo "Failure: $1"
exit 1
}
set -e
echo "This script runs some tests that are hard to do in the regular harness"
if [ ! -e CMakeCache.txt ] ; then
echo "Please run from build directory"
exit 1
fi
src=`grep YARP_SOURCE_DIR CMakeCache.txt | sed "s/.*=//"`
base="$PWD/runtime_tests"
mkdir -p $base
cd $base
mkdir -p $base/fakebot
mkdir -p $base/fakebot_static
PLUGIN_FLAGS="-DCREATE_DEVICE_LIBRARY_MODULES=TRUE -DENABLE_yarpmod_fakebot=TRUE -DCREATE_OPTIONAL_CARRIERS=TRUE -DENABLE_yarpcar_human_carrier=TRUE -DCREATE_GUIS=OFF"
# Create fakebot device
cd $base/fakebot
echo "Working in $PWD"
cmake -DCMAKE_INSTALL_PREFIX=$base/root $PLUGIN_FLAGS -DCREATE_SHARED_LIBRARY=TRUE $src
make
make install
cd $base/fakebot_static
echo "Working in $PWD"
cmake -DCMAKE_INSTALL_PREFIX=$base/root_static $PLUGIN_FLAGS -DCREATE_SHARED_LIBRARY=FALSE $src
make
make install
cd $base
export YARP_CONFIG_DIR=$PWD
echo "0 0 local" > yarp.conf
export YARP_DATA_DIRS=$PWD/fakebot/share/yarp
######################################################################
## Shared version of plugins
yarp="./fakebot/bin/yarp"
header "Check shared fakebot is findable"
$yarp plugin --list | grep fakebot || fail "Could not find fakebot"
header "Check shared fakebot is startable"
${yarp}dev --device fakebot --lifetime 1 || fail "Could not start fakebot"
header "Check shared human carrier will run"
$yarp read /localhost:10111 &
echo "Hello" | $yarp write /localhost:10112 --wait-connect &
$yarp wait /localhost:10111
$yarp wait /localhost:10112
$yarp connect /localhost:10112 /localhost:10111 fakehuman && fail "fakehuman should not work" || echo ok
$yarp connect /localhost:10112 /localhost:10111 human
# human is a very very odd and old carrier
$yarp terminate /localhost:10111 || echo ok
$yarp terminate /localhost:10112 || echo ok
$yarp terminate /localhost:10111 || echo ok
$yarp terminate /localhost:10112 || echo ok
header "Check shared fakebot is unfindable without YARP_DATA_DIRS"
export YARP_DATA_DIRS=$PWD/share/notyarpatall
$yarp plugin --list | grep fakebot && fail "Should not have found fakebot" || echo "not found, good"
header "Check shared fakebot is startable in build without YARP_DATA_DIRS"
cd fakebot
./bin/yarpdev --device fakebot --lifetime 1 || fail "Could not start fakebot"
######################################################################
## Static version of plugins
cd $base
yarp="./fakebot_static/bin/yarp"
header "Check static fakebot is startable"
${yarp}dev --device fakebot --lifetime 1 || fail "Could not start fakebot"
header "Check static human carrier will run"
$yarp read /localhost:10111 &
echo "Hello" | $yarp write /localhost:10112 --wait-connect &
$yarp wait /localhost:10111
$yarp wait /localhost:10112
$yarp connect /localhost:10112 /localhost:10111 fakehuman && fail "fakehuman should not work" || echo ok
$yarp connect /localhost:10112 /localhost:10111 human
# human is a very very odd and old carrier
$yarp terminate /localhost:10111 || echo ok
$yarp terminate /localhost:10112 || echo ok
$yarp terminate /localhost:10111 || echo ok
$yarp terminate /localhost:10112 || echo ok
######################################################################
## Installed shared version of plugins
cd $base
export YARP_DATA_DIRS=$PWD/root/share/yarp
export LD_LIBRARY_PATH=$PWD/root/lib
header "Check installed shared fakebot is startable"
$base/root/bin/yarpdev --device fakebot --lifetime 1 || fail "Could not start fakebot"
######################################################################
## Installed static version of plugins
cd $base
export YARP_DATA_DIRS=nothing
export LD_LIBRARY_PATH=nothing
header "Check installed static fakebot is startable"
$base/root_static/bin/yarpdev --device fakebot --lifetime 1 || fail "Could not start fakebot"
header "Done, no problems found"