kinetic-devel/core/roscpp/scripts/genmsgtest

30 lines
876 B
Bash
Executable File

#!/bin/bash
#set -x
for i in `ls $1/*.cpp` ; do
echo "Generating test for $i"
g++ -g -c `rospack --lang=cpp --attrib=cflags export roscpp` `rospack --lang=cpp --attrib=cflags export roslib` `rospack --lang=cpp --attrib=cflags export std_msgs` -I./msg/cpp $i -o $1/`basename $i .cpp`.o
if [ $? != 0 ]; then
echo "error during build"
exit
fi
g++ `rospack --lang=cpp --attrib=lflags export roslib` $1/`basename $i .cpp`.o `rospack --lang=cpp --attrib=lflags export roscpp` -o $1/`basename $i .cpp`
if [ $? != 0 ]; then
echo "$error during link"
exit
fi
done
for i in `ls $1/*.cpp` ; do
echo "running `basename $i .cpp`"
attempt=1
while [ $attempt -le 20 ] ; do
attempt=$(( $attempt + 1 ))
$1/`basename $i .cpp`
if [ $? != 0 ]; then
echo "non-zero return value"
exit
fi
done
done
echo "Hooray! All tests passed."