-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathbuild_catkin_module
executable file
·67 lines (53 loc) · 1.7 KB
/
build_catkin_module
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
#!/bin/bash
if [ -z "$3" ]; then
echo -e "Usage:"
echo -e "\t$0 [sanitizer] [github repo] [module] [path_optional]"
echo -e ""
echo -e "Use .. for [path_optional] if module is directly in repo."
exit 2
fi
BASEDIR="/catkin"
REPODIR="$BASEDIR/repos/"
BUILDDIR="$BASEDIR/buildtmp/"
LOGDIR="$BASEDIR/logfiles"
[ -d "$REPODIR" ] || mkdir -p "$REPODIR"
[ -d "$BUILDDIR" ] || mkdir -p "$BUILDDIR"
[ -d "$LOGDIR" ] || mkdir -p "$LOGDIR"
before="$(ls $LOGDIR)"
SANITIZER="$1"
REPO="$2"
MODULE="$3"
REPOPATH="$4"
CXXFLAGS="-fsanitize=$SANITIZER -g"
export UBSAN_OPTIONS="log_path=$LOGDIR/ubsan-$MODULE"
export ASAN_OPTIONS="log_path=$LOGDIR/asan-$MODULE"
export TSAN_OPTIONS="log_path=$LOGDIR/tsan-$MODULE"
echo -e "\e[92m * Check if repo is already there, else check it out \e[39m"
cd "$REPODIR"
if ! [[ -d "$REPO" ]]; then
git clone --depth=1 "https://github.com/ros/$REPO.git"
else
cd "$REPO"
git pull
fi
echo -e "\e[92m * check if build dir already exists \e[39m"
if [[ -d "$BUILDDIR/$MODULE" ]]; then
rm -r "$BUILDDIR/$MODULE"
fi
# http://wiki.ros.org/catkin/Tutorials/create_a_workspace
echo -e "\e[92m * create catkin workspace \e[39m"
source /opt/ros/melodic/setup.bash
mkdir -p "$BUILDDIR/$MODULE/src"
cd "$BUILDDIR/$MODULE"
catkin_make
source devel/setup.bash
cp -r "$REPODIR/$REPO/$REPOPATH/$MODULE" src/
echo -e "\e[92m * compile \e[39m"
catkin_make -DCMAKE_CXX_FLAGS="$CXXFLAGS" --make-args VERBOSE=1
RET1=$?
echo -e "\e[92m * run tests \e[39m"
catkin_make -DCMAKE_CXX_FLAGS="$CXXFLAGS" --make-args VERBOSE=1 run_tests
RET2=$?
after="$(ls $LOGDIR)"
difference="$(comm -13 <(echo "$before") <(echo "$after"))"
echo "$MODULE" "$REPO" "$REPOPATH" "$SANITIZER" "$RET1" "$RET2" "$difference" >> $BASEDIR/catkin-sanitize.log