ci-linux.sh 4.23 KB
Newer Older
Jan Möbius's avatar
Jan Möbius committed
1 2 3 4 5
#!/bin/bash

COMPILER=$1
LANGUAGE=$2

Jan Möbius's avatar
Jan Möbius committed
6 7 8
# Exit script on any error
set -e 

Jan Möbius's avatar
Jan Möbius committed
9
OPTIONS=""
Jan Möbius's avatar
Jan Möbius committed
10
BUILDPATH=""
Jan Möbius's avatar
Jan Möbius committed
11 12 13

if [ "$COMPILER" == "gcc" ]; then
  echo "Building with GCC";
Jan Möbius's avatar
Jan Möbius committed
14
  BUILDPATH="gcc"
Jan Möbius's avatar
Jan Möbius committed
15 16 17 18
elif [ "$COMPILER" == "clang" ]; then

  OPTIONS="$OPTIONS -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang"
  echo "Building with CLANG";
Jan Möbius's avatar
Jan Möbius committed
19
  BUILDPATH="clang"  
Jan Möbius's avatar
Jan Möbius committed
20 21 22 23
fi  

if [ "$LANGUAGE" == "C++98" ]; then
  echo "Building with C++98";
Jan Möbius's avatar
Jan Möbius committed
24
  BUILDPATH="$BUILDPATH-cpp98"
Jan Möbius's avatar
Jan Möbius committed
25 26 27
elif [ "$LANGUAGE" == "C++11" ]; then
  echo "Building with C++11";
  OPTIONS="$OPTIONS -DCMAKE_CXX_FLAGS='-std=c++11' "
Jan Möbius's avatar
Jan Möbius committed
28
  BUILDPATH="$BUILDPATH-cpp11"  
Jan Möbius's avatar
Jan Möbius committed
29 30
fi  

Jan Möbius's avatar
Jan Möbius committed
31 32 33 34 35
#=====================================
# Color Settings:
#=====================================
NC='\033[0m'
OUTPUT='\033[0;32m'
Jan Möbius's avatar
Jan Möbius committed
36

Jan Möbius's avatar
Jan Möbius committed
37

Jan Möbius's avatar
Jan Möbius committed
38
echo -e "${OUTPUT}"
Jan Möbius's avatar
Jan Möbius committed
39
echo ""
40 41
echo "======================================================================"
echo "Building Release version with vectorchecks enabled"
Jan Möbius's avatar
Jan Möbius committed
42
echo "======================================================================"
Jan Möbius's avatar
Jan Möbius committed
43
echo -e "${NC}"
44 45 46 47


if [ ! -d build-release-$BUILDPATH-Vector-Checks ]; then
  mkdir build-release-$BUILDPATH-Vector-Checks
Jan Möbius's avatar
Jan Möbius committed
48 49
fi

50
cd build-release-$BUILDPATH-Vector-Checks
Jan Möbius's avatar
Jan Möbius committed
51

52
cmake -DCMAKE_BUILD_TYPE=Release -DOPENMESH_BUILD_UNIT_TESTS=TRUE -DSTL_VECTOR_CHECKS=ON -DOPENMESH_BUILD_PYTHON_UNIT_TESTS=OFF $OPTIONS ../
Jan Möbius's avatar
Jan Möbius committed
53 54 55 56 57 58 59

#build it
make

#build the unit tests
make unittests

Jan Möbius's avatar
Jan Möbius committed
60
echo -e "${OUTPUT}"
Jan Möbius's avatar
Jan Möbius committed
61
echo ""
62 63
echo "======================================================================"
echo "Running unittests Release version with vectorchecks enabled"
Jan Möbius's avatar
Jan Möbius committed
64
echo "======================================================================"
Jan Möbius's avatar
Jan Möbius committed
65
echo -e "${NC}"
Jan Möbius's avatar
Jan Möbius committed
66 67 68 69 70 71 72

cd Unittests

#execute tests
./unittests --gtest_color=yes --gtest_output=xml

cd ..
73 74
cd ..

Jan Möbius's avatar
Jan Möbius committed
75
echo -e "${OUTPUT}"
Jan Möbius's avatar
Jan Möbius committed
76
echo ""
77 78
echo "======================================================================"
echo "Building Release version with vectorchecks disabled for python tests"
Jan Möbius's avatar
Jan Möbius committed
79
echo "======================================================================"
Jan Möbius's avatar
Jan Möbius committed
80
echo -e "${NC}"
81 82 83 84 85 86 87 88 89 90 91 92

if [ ! -d build-release-$BUILDPATH ]; then
  mkdir build-release-$BUILDPATH
fi

cd build-release-$BUILDPATH

cmake -DCMAKE_BUILD_TYPE=Release -DOPENMESH_BUILD_PYTHON_UNIT_TESTS=ON -DBUILD_APPS=OFF $OPTIONS ../

#build it
make

Jan Möbius's avatar
Jan Möbius committed
93
echo -e "${OUTPUT}"
Jan Möbius's avatar
Jan Möbius committed
94
echo ""
95 96
echo "======================================================================"
echo "Running Python unittests Release version "
Jan Möbius's avatar
Jan Möbius committed
97
echo "======================================================================"
Jan Möbius's avatar
Jan Möbius committed
98
echo -e "${NC}"
99

Jan Möbius's avatar
Jan Möbius committed
100 101 102

# Execute Python unittests
cd Python-Unittests
103

104
python -m unittest discover -v
Jan Möbius's avatar
Jan Möbius committed
105 106 107 108 109 110

cd ..
cd ..



Jan Möbius's avatar
Jan Möbius committed
111
echo -e "${OUTPUT}"
Jan Möbius's avatar
Jan Möbius committed
112
echo ""
113 114
echo "======================================================================"
echo "Building Debug version with vectorchecks enabled"
Jan Möbius's avatar
Jan Möbius committed
115
echo "======================================================================"
Jan Möbius's avatar
Jan Möbius committed
116
echo -e "${NC}"
117 118 119 120


if [ ! -d build-debug-$BUILDPATH-Vector-Checks ]; then
  mkdir build-debug-$BUILDPATH-Vector-Checks
Jan Möbius's avatar
Jan Möbius committed
121 122
fi

123
cd build-debug-$BUILDPATH-Vector-Checks
Jan Möbius's avatar
Jan Möbius committed
124

125
cmake -DCMAKE_BUILD_TYPE=Debug -DOPENMESH_BUILD_UNIT_TESTS=TRUE -DSTL_VECTOR_CHECKS=ON -DOPENMESH_BUILD_PYTHON_UNIT_TESTS=OFF $OPTIONS ../
Jan Möbius's avatar
Jan Möbius committed
126

127 128 129
#build it
make

Jan Möbius's avatar
Jan Möbius committed
130 131 132
#build the unit tests
make unittests

Jan Möbius's avatar
Jan Möbius committed
133
echo -e "${OUTPUT}"
Jan Möbius's avatar
Jan Möbius committed
134
echo ""
135 136
echo "======================================================================"
echo "Running unittests Debug version with vectorchecks enabled"
Jan Möbius's avatar
Jan Möbius committed
137
echo "======================================================================"
Jan Möbius's avatar
Jan Möbius committed
138
echo -e "${NC}"
Jan Möbius's avatar
Jan Möbius committed
139 140 141 142


cd Unittests

143
#execute tests
Jan Möbius's avatar
Jan Möbius committed
144 145
./unittests --gtest_color=yes --gtest_output=xml

146
cd ..
147 148
cd ..

Jan Möbius's avatar
Jan Möbius committed
149
echo -e "${OUTPUT}"
Jan Möbius's avatar
Jan Möbius committed
150
echo ""
151 152
echo "======================================================================"
echo "Building Debug version with vectorchecks disabled for python tests"
Jan Möbius's avatar
Jan Möbius committed
153
echo "======================================================================"
Jan Möbius's avatar
Jan Möbius committed
154
echo -e "${NC}"
155 156 157 158 159 160 161 162 163 164 165 166

if [ ! -d build-debug-$BUILDPATH ]; then
  mkdir build-debug-$BUILDPATH
fi

cd build-debug-$BUILDPATH

cmake -DCMAKE_BUILD_TYPE=DEBUG -DOPENMESH_BUILD_PYTHON_UNIT_TESTS=ON -DBUILD_APPS=OFF $OPTIONS ../

#build it
make

Jan Möbius's avatar
Jan Möbius committed
167
echo -e "${OUTPUT}"
Jan Möbius's avatar
Jan Möbius committed
168
echo ""
169 170
echo "======================================================================"
echo "Running Python unittests Debug version "
Jan Möbius's avatar
Jan Möbius committed
171
echo "======================================================================"
Jan Möbius's avatar
Jan Möbius committed
172
echo -e "${NC}"
173

174 175 176

# Execute Python unittests
cd Python-Unittests
Jan Möbius's avatar
Jan Möbius committed
177

178
python -m unittest discover -v