File: travis_ci_build.sh

package info (click to toggle)
cpputest 4.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 6,688 kB
  • sloc: cpp: 31,212; sh: 4,978; ansic: 1,360; makefile: 775; ruby: 676; xml: 8; sed: 1
file content (178 lines) | stat: -rwxr-xr-x 5,146 bytes parent folder | download | duplicates (2)
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
#!/bin/bash
# Script run in the travis CI
set -ex

if [ "x$CPPUTEST_HOME" = "x" ] ; then
  export CPPUTEST_HOME=$TRAVIS_BUILD_DIR
fi

if [ "x$BUILD" = "xautotools" ]; then
    autoreconf -i ..
    ../configure
    make tdd
fi

if [ "x$BUILD" = "xmakefileworker" ]; then
    make -C $CPPUTEST_HOME -f Makefile_using_MakefileWorker test_all
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
    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 gcovr

    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 -Bw install_autotools/usr/local/lib/CppUTest/cmake/$cmakefile  install_cmake/usr/local/lib/CppUTest/cmake/$cmakefile || exit 1
    done

    export INSTALL_DIFF=`diff -rwBq 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_dos" ]; then
    $CPPUTEST_HOME/scripts/create_docker_images_and_containers dos
    docker start -i cpputest_dos
fi

if [ "x$BUILD" = "xmake_dos" ]; then
    if [ ! -d watcom ]; then
        git clone https://github.com/cpputest/watcom-compiler.git watcom
    fi
    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 clean
    make -f $CPPUTEST_HOME/platforms/Dos/Makefile
    $CPPUTEST_HOME/platforms/Dos/alltests.sh
fi

if [ "x$BUILD" = "xextensive_check" ]; then
    autoreconf -i ..
    ../configure
    make check_all
fi

if [ "x$BUILD" = "xautotools_dist" ]; then
    autoreconf -i ..
    ../configure

    if [ "x$TRAVIS_OS_NAME" = "xosx" ]; then
        COPYFILE_DISABLE=1 make dist VERSION=latest
        COPYFILE_DISABLE=1 make dist-zip VERSION=latest
    else
        make dist VERSION=latest
        make dist-zip VERSION=latest
    fi
fi

if [ "x$BUILD" = "xautotools_install_and_test_examples" ]; then
    autoreconf -i ..
    ../configure

    make tdd
    sudo make install
    make -C $CPPUTEST_HOME/examples -f $CPPUTEST_HOME/examples/Makefile_ExamplesWithCppUTestInstalled.mk
fi

if [ "x$BUILD" = "xvc_windows" ]; then
    export PATH=$MSBUILD_PATH:$PATH
    cmake ..
    MSBuild.exe ALL_BUILD.vcxproj
    ./tests/CppUTest/CppUTestTests.exe
    ./tests/CppUTestExt/CppUTestExtTests.exe
fi

if [ "x$BUILD" = "xcmake_windows" ]; then
    choco install make
    BUILD_ARGS=("-DWERROR=ON")

    if [ -n "$CPP_STD" ]; then
        BUILD_ARGS+=("-DCMAKE_CXX_STANDARD=$CPP_STD")
    fi

    cmake --version
    cmake -G 'Unix Makefiles' "${BUILD_ARGS[@]}" ..
    make
    ctest -V
fi