Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add downstream test #446

Closed
wants to merge 10 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 4 additions & 54 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,64 +16,14 @@ env:
- ROS_DISTRO=groovy ROSWS=wstool BUILDER=catkin USE_DEB=false
- ROS_DISTRO=hydro ROSWS=wstool BUILDER=catkin USE_DEB=true
- ROS_DISTRO=hydro ROSWS=wstool BUILDER=catkin USE_DEB=false
- TEST_TYPE=work_with_downstream TEST_PACKAGE=hironx-ros-bridge ROS_DISTRO=hydro
- TEST_TYPE=work_with_315_1_10 TEST_PACKAGE=hironx-ros-bridge ROS_DISTRO=hydro
notifications:
email:
recipients:
- [email protected]
- [email protected]
on_success: always #[always|never|change] # default: change
on_failure: always #[always|never|change] # default: always
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##*/}
- echo "Testing branch $TRAVIS_BRANCH of $REPOSITORY_NAME"
- sudo sh -c 'echo "deb http://packages.ros.org/ros-shadow-fixed/ubuntu precise 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
- if [ $ROSWS == rosws ]; then sudo apt-get install -qq -y python-rosinstall ; fi
- if [ $BUILDER == rosbuild ]; then sudo apt-get install -qq -y ros-$ROS_DISTRO-rosmake ; fi
# Setup rosdep
- sudo rosdep init
- rosdep update; while [ $? != 0 ]; do sleep 1; rosdep update; done
install: # Use this to install any prerequisites or dependencies necessary to run your build
# Create workspace
- mkdir -p ~/ros/ws_$REPOSITORY_NAME/src
- cd ~/ros/ws_$REPOSITORY_NAME/src
- if [ $USE_DEB == false -o $BUILDER == rosbuild ]; then $ROSWS init . ; fi
- if [ $USE_DEB == false ]; then $ROSWS merge http://raw.github.com/$TRAVIS_REPO_SLUG/$TRAVIS_BRANCH/.rosinstall ; fi
- if [ $USE_DEB == false -o $BUILDER == rosbuild ]; then if [ $ROSWS == rosws ]; then $ROSWS merge /opt/ros/$ROS_DISTRO/.rosinstall; fi ; fi
- if [ $USE_DEB == false ]; then sed -i "s@^\(.*github.com/$TRAVIS_REPO_SLUG.*\)@#\1@" .rosinstall ; fi # comment out current repo
- if [ $USE_DEB == false ]; then $ROSWS update ; fi
- if [ $USE_DEB == false -o $BUILDER == rosbuild ]; then $ROSWS set $REPOSITORY_NAME http://github.com/$TRAVIS_REPO_SLUG --git -y ; fi
- ln -s $CI_SOURCE_PATH . # Link the repo we are testing to the new workspace
- cd ../
# Install dependencies for source repos
- find -L src -name package.xml -exec dirname {} \; | xargs -n 1 -i find {} -name manifest.xml | xargs -n 1 -i mv {} {}.deprecated # rename manifest.xml for rosdep install
- rosdep install -r -n --from-paths src --ignore-src --rosdistro $ROS_DISTRO -y
- find -L src -name manifest.xml.deprecated | xargs -n 1 -i dirname {} | xargs -n 1 -i ln -sf `pwd`/{}/manifest.xml.deprecated `pwd`/{}/manifest.xml # rename manifest.xml for rosdep install
- find . \! -path "*/.*" -type f | xargs egrep -i "(hoge|fuga)" ; if [ $? == 0 ]; then exit 1; fi
before_script: # Use this to prepare your build for testing e.g. copy database configurations, environment variables, etc.
- source /opt/ros/$ROS_DISTRO/setup.bash
- if [ $BUILDER == rosbuild ]; then source src/setup.bash ; fi
- if [ $BUILDER == rosbuild ]; then rospack profile ; fi
script: # All commands must exit with code 0 on success. Anything else is considered failure.
# for catkin
- if [ $BUILDER == catkin ]; then catkin_make -j8 -l8 ; fi
- if [ $BUILDER == catkin ]; then export TARGET_PKG=`find build/$REPOSITORY_NAME -name Makefile -print | sed s@.*/\\\\\([^\/]*\\\\\)/Makefile@\\\1@g` ; fi
- if [ $BUILDER == catkin ]; then catkin_make test --pkg $TARGET_PKG -j8 -l8 ; fi
- if [ $BUILDER == catkin ]; then find build -name LastTest.log -exec echo "==== {} ====" \; -exec cat {} \; ; fi
- if [ $BUILDER == catkin ]; then catkin_make -j8 -l8 install ; fi
- if [ $BUILDER == catkin ]; then rm -fr devel src build ; fi
- if [ $BUILDER == catkin ]; then source install/setup.bash ; fi
- if [ $BUILDER == catkin ]; then export EXIT_STATUS=0; for pkg in $TARGET_PKG; do [ "`find install/share/$pkg -iname '*.test'`" == "" ] && echo "[$pkg] No tests ware found!!!" || find install/share/$pkg -iname "*.test" -print0 | xargs -0 -n1 rostest || export EXIT_STATUS=$?; done; [ $EXIT_STATUS == 0 ] ; fi
# for rosbuild
- if [ $BUILDER == rosbuild ]; then rosmake -a --profile --pjobs=8 ; fi
- if [ $BUILDER == rosbuild ]; then export TARGET_PKG=`find -L src | grep $REPOSITORY_NAME | grep /build/Makefile$ | sed s@.*/\\\\\([^\/]*\\\\\)/build/Makefile@\\\1@g` ; fi
- if [ $BUILDER == rosbuild ]; then rosmake --test-only $TARGET_PKG --pjobs=8 ; fi
after_failure:
- if [ $BUILDER == rosbuild ]; then find ${HOME}/.ros/rosmake/ -type f -exec echo "=== {} ===" \; -exec cat {} \; ; fi
- find ${HOME}/.ros/test_results -type f -exec echo "=== {} ===" \; -exec cat {} \;
- for file in ${HOME}/.ros/log/rostest-*; do echo "=== $file ==="; cat $file; done

script:
- if [ "${TEST_TYPE}" == "" ] ; then source .travis/travis.sh; else source ./.travis_test.sh ; fi
75 changes: 75 additions & 0 deletions .travis/travis.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
#!/bin/bash

set -x

if [ $ROS_DISTRO == "indigo" -a "$TRAVIS_JOB_ID" ]; then
sudo apt-get install -qq -y python-jenkins
./.travis/travis_jenkins.py
exit $?
fi

function error {
if [ $BUILDER == rosbuild -a -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

### 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 [ $ROSWS == rosws ]; then sudo apt-get install -qq -y python-rosinstall ; fi
if [ $BUILDER == rosbuild ]; then sudo apt-get install -qq -y ros-$ROS_DISTRO-rosmake ; fi
# MongoDB hack - I don't fully understand this but its for moveit_warehouse
sudo apt-get remove -y -qq mongodb mongodb-10gen || echo "ok"
sudo apt-get install -y -qq mongodb-clients mongodb-server -o Dpkg::Options::="--force-confdef" || ecoh "ok" # default actions
# Setup rosdep
sudo rosdep init
rosdep update; while [ $? != 0 ]; do sleep 1; rosdep update; done

### install: # Use this to install any prerequisites or dependencies necessary to run your build
# Create workspace
mkdir -p ~/ros/ws_$REPOSITORY_NAME/src
cd ~/ros/ws_$REPOSITORY_NAME/src
if [ $USE_DEB == false -o $BUILDER == rosbuild ]; then $ROSWS init . ; fi
if [ $USE_DEB == false ]; then $ROSWS merge file://$CI_SOURCE_PATH/.rosinstall ; fi
if [ $USE_DEB == false -o $BUILDER == rosbuild ]; then if [ $ROSWS == rosws ]; then $ROSWS merge /opt/ros/$ROS_DISTRO/.rosinstall; fi ; fi
if [ $USE_DEB == false ]; then sed -i "s@^\(.*github.com/$TRAVIS_REPO_SLUG.*\)@#\1@" .rosinstall ; fi # comment out current repo
if [ $USE_DEB == false ]; then $ROSWS update ; fi
if [ $USE_DEB == false -o $BUILDER == rosbuild ]; then $ROSWS set $REPOSITORY_NAME http://github.com/$TRAVIS_REPO_SLUG --git -y ; fi
ln -s $CI_SOURCE_PATH . # Link the repo we are testing to the new workspace
cd ../
# Install dependencies for source repos
find -L src -name package.xml -exec dirname {} \; | xargs -n 1 -i find {} -name manifest.xml | xargs -n 1 -i mv {} {}.deprecated # rename manifest.xml for rosdep install
rosdep install -r -n --from-paths src --ignore-src --rosdistro $ROS_DISTRO -y
find -L src -name manifest.xml.deprecated | xargs -n 1 -i dirname {} | xargs -n 1 -i ln -sf `pwd`/{}/manifest.xml.deprecated `pwd`/{}/manifest.xml # rename manifest.xml for rosdep install

### before_script: # Use this to prepare your build for testing e.g. copy database configurations, environment variables, etc.
source /opt/ros/$ROS_DISTRO/setup.bash
if [ $BUILDER == rosbuild ]; then source src/setup.bash ; fi
if [ $BUILDER == rosbuild ]; then rospack profile ; fi

### script: # All commands must exit with code 0 on success. Anything else is considered failure.
# for catkin
if [ $BUILDER == catkin ]; then catkin_make $ROS_PARALLEL_JOBS ; fi
if [ $BUILDER == catkin ]; then export TARGET_PKG=`find build/$REPOSITORY_NAME -name Makefile -print | sed s@.*/\\\\\([^\/]*\\\\\)/Makefile@\\\1@g` ; fi
if [ $BUILDER == catkin ]; then catkin_make test --pkg $TARGET_PKG $ROS_PARALLEL_JOBS ; fi
if [ $BUILDER == catkin ]; then find build -name LastTest.log -exec echo "==== {} ====" \; -exec cat {} \; ; fi
if [ $BUILDER == catkin ]; then catkin_make $ROS_PARALLEL_JOBS install ; fi
if [ $BUILDER == catkin ]; then rm -fr devel src build ; fi
if [ $BUILDER == catkin ]; then source install/setup.bash ; fi
if [ $BUILDER == catkin ]; then export EXIT_STATUS=0; for pkg in $TARGET_PKG; do [ "`find install/share/$pkg -iname '*.test'`" == "" ] && echo "[$pkg] No tests ware found!!!" || find install/share/$pkg -iname "*.test" -print0 | xargs -0 -n1 rostest || export EXIT_STATUS=$?; done; [ $EXIT_STATUS == 0 ] ; fi
# for rosbuild
if [ $BUILDER == rosbuild ]; then rosmake -a --profile ; fi
if [ $BUILDER == rosbuild ]; then export TARGET_PKG=`find -L src | grep $REPOSITORY_NAME | grep /build/Makefile$ | sed s@.*/\\\\\([^\/]*\\\\\)/build/Makefile@\\\1@g` ; fi
if [ $BUILDER == rosbuild ]; then rosmake --test-only $TARGET_PKG ; fi

100 changes: 100 additions & 0 deletions .travis_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
#!/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

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

###
pkg=$TEST_PACKAGE
sudo apt-get install -y ros-hydro-$pkg

# this is hotfix
sudo wget https://raw.githubusercontent.com/start-jsk/rtmros_common/master/hrpsys_tools/test/test-pa10.test -O /opt/ros/hydro/share/hrpsys_tools/test/test-pa10.test

sudo apt-get install -y -qq ros-hydro-rqt-robot-dashboard

#
source /opt/ros/hydro/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-hydro-hrpsys-ros-bridge
sudo dpkg -r --force-depends ros-hydro-hrpsys-tools
sudo dpkg -r --force-depends ros-hydro-rtmbuild
catkin_make -j8 -l8
catkin_make install -j8 -l8
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 -j8 -l8 --only-pkg-with-deps `echo $pkg | sed s/-/_/g`
catkin_make install -j8 -l8

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
exit 0
else
exit 1
fi