Created
July 1, 2014 11:36
-
-
Save jbohren/0e57551d1cf51d4e9a13 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env zsh | |
# | |
# Usage: | |
# Any arguments to this script are passed along to `catkin build` | |
# | |
# i.e.: | |
# ./race.zsh # Run with default number of jobs | |
# ./race.zsh -p 1 # Run with only one job | |
# | |
# Description: | |
# This script creates a simple catkin workspace with three catkin packages and | |
# one vanilla cmake package. It then attempts to build this workspace with | |
# catkin build. After building, it checks to see if all three of the catkin | |
# packages are listed in the ROS_PACKAGE_PATH. If they are not, this is | |
# considered a failure, and contributes to the fail rate. | |
# | |
# With the current beta version of catkin_tools, this operation fails about 1.5% | |
# of the time due to some race condition. | |
# | |
# ref: https://github.com/catkin/catkin_tools/issues/77 | |
FAILS=0.0 | |
FAIL_RATE=0.0 | |
mkdir -p cb_race_condition | |
pushd cb_race_condition | |
rm -rf src | |
mkdir -p src | |
pushd src | |
catkin_create_pkg aaa | |
catkin_create_pkg bbb | |
catkin_create_pkg ccc | |
mkdir -p vanilla | |
pushd vanilla | |
echo "cmake_minimum_required(VERSION 2.8.3) | |
project(vanilla) | |
install(FILES vanilla.txt DESTINATION share/vanilla)" >> CMakeLists.txt | |
echo "<?xml version=\"1.0\"?> | |
<package> | |
<name>vanilla</name> | |
<version>0.0.0</version> | |
<description>The vanilla package</description> | |
<maintainer email=\"[email protected]\">jbohren</maintainer> | |
<license>TODO</license> | |
<buildtool_depend>catkin</buildtool_depend> | |
<export> | |
<build_type>cmake</build_type> | |
</export> | |
</package>" >> package.xml | |
echo "vanilla" >> vanilla.txt | |
popd | |
popd | |
for COUNT in {1..200}; do | |
echo "=====================================" | |
echo "Attempt: $COUNT" | |
echo "Fail rate: $FAIL_RATE" | |
echo "=====================================" | |
rm -rf build devel | |
catkin build "$@" | |
source devel/setup.zsh | |
echo $ROS_PACKAGE_PATH | |
for pkg in {"aaa","bbb","ccc"}; do | |
if [ "${ROS_PACKAGE_PATH#*$pkg}" = "$ROS_PACKAGE_PATH" ]; then | |
(( FAILS += 1.0 )) | |
echo "FAIL" | |
fi | |
done | |
source /opt/ros/hydro/setup.zsh | |
(( FAIL_RATE=FAILS/COUNT )) | |
done | |
echo "=====================================" | |
echo "=====================================" | |
echo "=====================================" | |
echo "Fail rate: $FAIL_RATE" | |
echo "=====================================" | |
echo "=====================================" | |
echo "=====================================" | |
popd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment