-
Notifications
You must be signed in to change notification settings - Fork 502
/
travis_ci_build.sh
executable file
·148 lines (123 loc) · 4.24 KB
/
travis_ci_build.sh
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
#!/bin/bash
# Script run in the travis CI
set -ex
if [[ "$CXX" == clang* ]]; then
export CXXFLAGS="-stdlib=libc++"
fi
if [ "x$CPPUTEST_HOME" = "x" ] ; then
export CPPUTEST_HOME=$TRAVIS_BUILD_DIR
fi
if [ "x$BUILD" = "xautotools" ]; then
autoreconf -i ..
../configure
echo "CONFIGURATION DONE. Compiling now."
if [ "${TRAVIS_EVENT_TYPE}" = "cron" ]; then
make check_all
fi
if [ "x$TRAVIS_OS_NAME" = "xosx" ]; then
COPYFILE_DISABLE=1 make dist
COPYFILE_DISABLE=1 make dist-zip
else
make dist
make dist-zip
fi
fi
if [ "x$BUILD" = "xcmake" ]; then
BUILD_ARGS=("-DWERROR=ON")
if [ -n "$CPP_STD" ]; then
BUILD_ARGS+=("-DCMAKE_CXX_STANDARD=$CPP_STD")
fi
cmake --version
cmake "${BUILD_ARGS[@]}" ..
make
ctest -V
fi
if [ "x$BUILD" = "xautotools_gtest" ]; then
autoreconf -i ..
../configure
make check_gtest
fi
if [ "x$BUILD" = "xcmake_gtest" ]; then
pwd
wget https://github.com/google/googletest/archive/release-1.6.0.zip -O gtest-1.6.0.zip && unzip gtest-1.6.0.zip;
wget https://github.com/google/googlemock/archive/release-1.6.0.zip -O gmock-1.6.0.zip && unzip gmock-1.6.0.zip;
unzip gtest-1.6.0.zip -d $TRAVIS_BUILD_DIR
unzip gmock-1.6.0.zip -d $TRAVIS_BUILD_DIR
cd $TRAVIS_BUILD_DIR
mv googletest-release-1.6.0 googlemock-release-1.6.0/gtest
cd googlemock-release-1.6.0
autoreconf -i; ./configure CXXFLAGS=-DGTEST_USE_OWN_TR1_TUPLE=1 && make
cd -
export GMOCK_HOME=$TRAVIS_BUILD_DIR/googlemock-release-1.6.0
export GTEST_HOME=$TRAVIS_BUILD_DIR/googlemock-release-1.6.0/gtest
cmake . -DGMOCK=ON
make
ctest -V
fi
if [ "x$BUILD" = "xtest_report" ]; then
if [ "x$TRAVIS_OS_NAME" = "xosx" ]; then
brew install ant
fi
autoreconf -i ..
../configure
make check
./CppUTestTests -ojunit
./CppUTestExtTests -ojunit
cp ../scripts/generate_junit_report_ant.xml .
ant -f generate_junit_report_ant.xml
fi
if [ "x$BUILD" = "xcmake_coverage" ]; then
pip install --user cpp-coveralls
cmake .. -DCMAKE_BUILD_TYPE=Debug -DC++11=ON -DCOVERAGE=ON -DLONGLONG=ON
make
ctest
coveralls -b . -r .. -i "src" -i "include" --gcov-options="-lbc" || true
fi
if [ "x$BUILD" = "xautotools_cmake_install_test" ]; then
autoreconf -i ..
../configure
rm -rf install_autotools
mkdir -p install_autotools
make DESTDIR=install_autotools install
cmake ..
rm -rf install_cmake
mkdir -p install_cmake
make DESTDIR=install_cmake install
# Hack: autotools cannot make CMake package. We cached and copied them. Here we check they are still the same
for cmakefile in CppUTestConfig.cmake CppUTestConfigVersion.cmake CppUTestTargets-relwithdebinfo.cmake CppUTestTargets.cmake; do
cat install_autotools/usr/local/lib/CppUTest/cmake/$cmakefile
cat install_cmake/usr/local/lib/CppUTest/cmake/$cmakefile
diff install_autotools/usr/local/lib/CppUTest/cmake/$cmakefile install_cmake/usr/local/lib/CppUTest/cmake/$cmakefile || exit 1
done
export INSTALL_DIFF=`diff -rq install_autotools install_cmake -X CppUTestGeneratedConfig.h -X libCppUTest.a -X libCppUTestExt.a`
if [ "x$INSTALL_DIFF" != "x" ]; then
echo "FAILED: CMake install and Autotools install is not the same!\n"
echo "Difference\n"
echo "-------------------------------\n"
echo "$INSTALL_DIFF"
echo "-------------------------------\n"
exit 1;
fi
fi
if [ "x$BUILD" = "xdocker_ubuntu_autotools" ]; then
$CPPUTEST_HOME/scripts/create_docker_images_and_containers ubuntu
docker start -i cpputest_ubuntu
fi
if [ "x$BUILD" = "xdocker_ubuntu_gcc10" ]; then
$CPPUTEST_HOME/scripts/create_docker_images_and_containers gcc10
docker start -i cpputest_gcc10
fi
if [ "x$BUILD" = "xdocker_dos" ]; then
$CPPUTEST_HOME/scripts/create_docker_images_and_containers dos
docker start -i cpputest_dos
fi
if [ "x$BUILD" = "xmake_dos" ]; then
git clone https://github.com/cpputest/watcom-compiler.git watcom
export PATH=$PATH:$PWD/watcom/binl
export WATCOM=$PWD/watcom
export CC=wcl
export CXX=wcl
$CC --version
make -f $CPPUTEST_HOME/platforms/Dos/Makefile
$CPPUTEST_HOME/platforms/Dos/alltests.sh
fi