-
Notifications
You must be signed in to change notification settings - Fork 4
/
Test
executable file
·64 lines (48 loc) · 1.73 KB
/
Test
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
#!/usr/bin/env bash
set -e
repo_dir="$(cd "$(dirname "$0")"; pwd)"
progress() { echo ==== "$@" ; }
trap 'cleanup; echo >&2 "FAILED!"' 0
cleanup() { progress "Cleaning up"; kill $(jobs -p) >/dev/null 2>&1 || true ; sleep 1 ; }
clean_exit() {
cleanup
trap '' 0
error_code=$1; shift
echo >&2 "$@"
exit $error_code
}
type pytest > /dev/null \
|| clean_exit 1 -e \
'Please install pytest for python2 via pip.' \
'\nOn ubuntu xenial run:: `pip2 install pip && pip2 install --user pytest`'
source /opt/ros/kinetic/setup.bash # TODO: This path is Ubuntu specific
export PATH="$(pwd)/src/rosmop/bin:$PATH"
progress "Building rosmop"
(cd src/rosmop ; mvn -q package -DskipTests)
progress "Building src"
catkin build --cmake-args -DBUILD_TESTS=ON -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTING=ON --
test_against_rvmaster() {
export ROS_MASTER_URI="http://localhost:11311/"
export REAL_MASTER_URI="http://localhost:20022/"
export ACCESS_POLICY_PATH="$repo_dir/config/access-policy.cfg"
progress "Running roscore"
ROS_MASTER_URI="$REAL_MASTER_URI" roscore -p 20022 >/dev/null &
sleep 1
progress "Running Simple Tests With RVMaster"
pytest --with-rvmaster "$PYTEST_FLAGS" t/test_monitors.py
cleanup
}
test_without_rvmaster() {
export ROS_MASTER_URI="http://localhost:20022/"
export ACCESS_POLICY_PATH="$repo_dir/config/access-policy.cfg"
progress "Running roscore"
roscore -p 20022 >/dev/null &
sleep 1
progress "Running Simple Tests Without RVMaster"
pytest "$PYTEST_FLAGS" t/test_monitors.py
cleanup
}
source devel/setup.bash
( progress test_without_rvmaster ; test_without_rvmaster )
( progress test_against_rvmaster ; test_against_rvmaster )
clean_exit 0