Skip to content

Instantly share code, notes, and snippets.

@mjcarroll
Created March 20, 2012 14:46
Show Gist options
  • Save mjcarroll/2136378 to your computer and use it in GitHub Desktop.
Save mjcarroll/2136378 to your computer and use it in GitHub Desktop.
rosbash testing
#! /usr/bin/env bash
# This script is supposed to be a unit test for rosbash, also used for manual checks against other operating systems.
# TODO extend this script
. ../rosbash
echo Testing BASH
# roslaunch completion
export COMP_CWORD=1
_roscomplete_launch roslaunch
if [[ ! ${COMPREPLY[@]} =~ rosbash ]]; then
echo "rosbash package missing from" ${COMPREPLY[@]} ; exit 1
fi
echo success roslaunch pkg
export COMP_WORDS=("roslaunch" "--")
export COMP_CWORD=1
_roscomplete_launch roslaunch "--" roslaunch
if [[ ! ${COMPREPLY[@]} == "--files --args --nodes --find-node --child --local --screen --server_uri --run_id --wait --port --core --pid --dump-params" ]]; then
echo "roslaunch --options missing" from ${COMPREPLY[@]} ; exit 1
fi
echo success roslaunch --option
test_array=( example-gdb.launch example-include.launch example-min.launch example-params.launch example-ssh.launch example.launch )
export COMP_WORDS=("roslaunch" "roslaunch")
export COMP_CWORD=2
_roscomplete_launch roslaunch roslaunch
flag=0
for file in "${test_array[@]}"
do
if [[ ! ${COMPREPLY[@]} =~ ${file} ]]; then
echo ${test_array[index]} " missing from " ${COMPREPLY[@]}
flag=1
fi
((index++))
done
if [ "$flag" == 1 ]; then
echo "roslaunch launchfile test failed"
exit 1
fi
echo success roslaunch launchfiles
test_array=( clean_master.test hztest.test hztest0.test time-limit.test )
export COMP_WORDS=("roslaunch" "test_rostest")
export COMP_CWORD=2
_roscomplete_launch roslaunch test_rostest
flag=0
for file in "${test_array[@]}"
do
if [[ ! ${COMPREPLY[@]} =~ ${file} ]]; then
echo ${test_array[index]} " missing from " ${COMPREPLY[@]}
flag=1
fi
((index++))
done
if [ "$flag" == 1 ]; then
echo "roslaunch testfile test failed"
exit 1
fi
echo success roslaunch testfiles
test_array=( example-gdb.launch example-include.launch example-min.launch example-params.launch example-ssh.launch example.launch )
export COMP_WORDS=("roslaunch" "roslaunch")
export COMP_CWORD=2
_roscomplete_launch roslaunch roslaunch
flag=0
for file in "${test_array[@]}"
do
if [[ ! ${COMPREPLY[@]} =~ ${file} ]]; then
echo ${test_array[index]} " missing from " ${COMPREPLY[@]}
flag=1
fi
((index++))
done
if [ "$flag" == 1 ]; then
echo "rostest launchfile test failed"
exit 1
fi
echo success rostest launchfiles
test_array=( clean_master.test hztest.test hztest0.test time-limit.test )
export COMP_WORDS=("rostest" "test_rostest")
export COMP_CWORD=2
_roscomplete_test rostest test_rostest
flag=0
for file in "${test_array[@]}"
do
if [[ ! ${COMPREPLY[@]} =~ ${file} ]]; then
echo ${test_array[index]} " missing from " ${COMPREPLY[@]}
flag=1
fi
((index++))
done
if [ "$flag" == 1 ]; then
echo "rostest testfile test failed"
exit 1
fi
echo success rostest testfiles
# if [[ ! ${COMPREPLY[@]} =~ "example.launch" ]]; then
# echo "example.launch missing from " ${COMPREPLY[@]} ; exit 1
# fi
# echo success 4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment