forked from start-jsk/rtmros_common
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis_test.sh
111 lines (96 loc) · 4.48 KB
/
.travis_test.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
#!/bin/bash
set -x
function error {
if [ -e ${HOME}/.ros/rosmake/ ]; then find ${HOME}/.ros/rosmake/ -type f -exec echo "=== {} ===" \; -exec cat {} \; ; fi
if [ -e ${HOME}/.ros/test_results ]; then find ${HOME}/.ros/test_results -type f -exec echo "=== {} ===" \; -exec cat {} \; ; fi
for file in ${HOME}/.ros/log/rostest-*; do echo "=== $file ==="; cat $file; done
exit 1
}
trap error ERR
# MongoDB hack
dpkg -s mongodb || echo "ok"; export HAVE_MONGO_DB=$?
if [ $HAVE_MONGO_DB == 0 ]; then sudo apt-get remove --purge -qq -y mongodb mongodb-10gen || echo "ok"; fi
if [ $HAVE_MONGO_DB == 0 ]; then sudo apt-get install -qq -y mongodb-clients mongodb-server -o Dpkg::Options::="--force-confdef" || echo "ok"; fi # default actions
### before_install: # Use this to prepare the system to install prerequisites or dependencies
# Define some config vars
export CI_SOURCE_PATH=$(pwd)
export REPOSITORY_NAME=${PWD##*/}
if [ ! "$ROS_PARALLEL_JOBS" ]; then export ROS_PARALLEL_JOBS="-j8 -l8"; fi
echo "Testing branch $TRAVIS_BRANCH of $REPOSITORY_NAME"
sudo sh -c 'echo "deb http://packages.ros.org/ros-shadow-fixed/ubuntu `lsb_release -cs` main" > /etc/apt/sources.list.d/ros-latest.list'
wget http://packages.ros.org/ros.key -O - | sudo apt-key add -
sudo apt-get update -qq
sudo apt-get install -qq -y python-catkin-pkg python-rosdep python-wstool ros-$ROS_DISTRO-catkin ros-$ROS_DISTRO-rosbash
if [ "$EXTRA_DEB" ]; then sudo apt-get install -qq -y $EXTRA_DEB; fi
###
pkg=$TEST_PACKAGE
sudo apt-get install -y ros-$ROS_DISTRO-$pkg
sudo apt-get install -y -qq ros-$ROS_DISTRO-rqt-robot-dashboard
#
source /opt/ros/$ROS_DISTRO/setup.bash
# set hrpsys (hrpsys wrapper for ROS, just for compile and test)
mkdir -p ~/catkin_ws/src
cd ~/catkin_ws
ln -sf ${CI_SOURCE_PATH} src/rtmros_common
if [ "$TEST_TYPE" == "work_with_downstream" ]; then
echo "
#
# check newer version of hrpsys works on current rtmros_common deb package
# [rtmros_common:new] <-> [rtmros_<robot>:old]
"
sudo dpkg -r --force-depends ros-$ROS_DISTRO-hrpsys-ros-bridge
sudo dpkg -r --force-depends ros-$ROS_DISTRO-hrpsys-tools
sudo dpkg -r --force-depends ros-$ROS_DISTRO-rtmbuild
# https://github.com/start-jsk/rtmros_hironx/issues/287
sudo sed -i s@test_tf_and_controller@_test_tf_and_controller@ /opt/ros/$ROS_DISTRO/share/hironx_ros_bridge/test/test_hironx_ros_bridge.py
catkin_make $ROS_PARALLEL_JOBS
catkin_make install $ROS_PARALLEL_JOBS
else
echo "
#
# check rtmros_<robot> compiled on newer version of rtmros_common works with deb version of rtmros_common
# [rtmros_common:old] <-> [rtmros_<robot>:new] + [rtmros_common:new]
"
# set up sorce code of downstream package
cd src
wstool init
wstool set rtmros_hironx http://github.com/start-jsk/rtmros_hironx --git -y
wstool set rtmros_nextage http://github.com/tork-a/rtmros_nextage --git -y
wstool update
cd ..
# do not install rtmros_common because we want to use them
find src
for _pkg in hrpsys_ros_bridge hrpsys_tools rtmbuild; do
if [ -e src/rtmros_common/${_pkg}/CMakeLists.txt ] ; then
sed -i "1imacro(dummy_install)\nmessage(\"install(\${ARGN})\")\nendmacro()" src/rtmros_common/${_pkg}/CMakeLists.txt
sed -i "s@install(@dummy_install(@g" src/rtmros_common/${_pkg}/CMakeLists.txt
fi
if [ -e src/rtmros_common/${_pkg}/catkin.cmake ] ; then
sed -i "s@install(@dummy_install(@g" src/rtmros_common/${_pkg}/catkin.cmake
fi
done
catkin_make $ROS_PARALLEL_JOBS --only-pkg-with-deps `echo $pkg | sed s/-/_/g`
catkin_make install $ROS_PARALLEL_JOBS
# make sure to kill test
for _pkg in hrpsys_ros_bridge hrpsys_tools rtmbuild; do
rm -fr install/lib/${_pkg}
rm -fr install/share/${_pkg}
rm -fr install/lib/python2.7/dist-packages/${_pkg}*
done
fi
rospack profile
source install/setup.bash
export EXIT_STATUS=0;
pkg_path=`rospack find \`echo $pkg | sed s/-/_/g\``
if [ "`find $pkg_path/test -iname '*.test'`" == "" ]; then
echo "[$pkg] No tests ware found!!!"
else
find $pkg_path/test -iname "*.test" -print0 | xargs -0 -n1 rostest || export EXIT_STATUS=$?;
fi
if [ -e build ]; then find build -name LastTest.log -exec echo "==== {} ====" \; -exec cat {} \; ; fi
if [ -e ${HOME}/.ros/test_results ]; then find ${HOME}/.ros/test_results -type f -exec echo "=== {} ===" \; -exec cat {} \; ; fi
if [ $EXIT_STATUS == 0 ] ; then
return 0
else
exit 1
fi