forked from libcheck/check
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtravis.sh
134 lines (116 loc) · 4.06 KB
/
travis.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
#!/bin/bash
# Copyright (C) 2016 Branden Archer <[email protected]>
# Copyright (C) 2016 Joshua D. Boyd <[email protected]>
# Copyright (C) 2020 Mikko Koivunalho <[email protected]>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
set -x
if [ -d doc/check_html ]; then
echo "The HTML output folder already exists";
exit 1;
fi
if [ -d doc/doxygen ]; then
echo "The doxygen output folder already exists";
exit 1;
fi
if [ "${USE_CMAKE}" = 'YES' ] ; then
cmake --version
cmake . || exit 1
make || exit 1
ctest -V || exit 1
sudo make install || exit 1
fi
if [ "${USE_CMAKE}" = 'NO' ] ; then
autoreconf -i || exit 1
./configure ${EXTRA_ARGS} --disable-build-docs || exit 1
make || exit 1
if [ -f doc/version.texi ]; then
echo "Documentation was generated (doc/version.texi), though disabled";
exit 1;
fi
make check || exit 1
sudo make install || exit 1
make doc/check_html || exit 1
if [ ! -d doc/check_html ]; then
echo "HTML documentation not generated"
exit 1;
fi
make doc/doxygen || exit 1
if [ ! -d doc/doxygen ]; then
echo "Doxygen documentation not generated";
exit 1;
fi
pushd doc/example
autoreconf -i || exit 1
./configure || exit 1
make || exit 1
export LD_LIBRARY_PATH=/usr/local/lib
make check
test_result=$?
cat tests/test-suite.log
cat tests/check_money.trs
if [ $test_result -ne 0 ]; then
exit 1
fi
popd
fi
if [ "${PRE_RELEASE_CHECK}" = 'YES' ]; then
autoreconf --install || exit 1
./configure || exit 1
make prereleasecheck || exit 1
tar xf check-*.tar.gz
cd check-*
cmake --version
cmake . || exit 1
make || exit 1
fi
if [ "${SCAN_BUILD}" = 'YES' ]; then
autoreconf --install || exit 1
scan-build ./configure --enable-snprintf-replacement --enable-timer-replacement || exit 1
scan-build -o clang make || exit 1
if [ -n "$(find clang -type f)" ]; then
echo "scan-build found potential issues"
find clang -type f -print -exec cat \{} \;
exit 1
fi
fi
if [ "${CMAKE_PROJECT_USAGE_TEST}" = 'YES' ] ; then
cmake --version || exit 1
project_dir="project_cmake"
install_dir="${PWD}/install_cmake"
build_dir="${PWD}/build_cmake"
# For FetchContent we copy everything to a subdir.
# Otherwise the copying would be recursive and forever.
mkdir "$project_dir" || exit 1
find . -maxdepth 1 -print | grep -v -E "^(\.|\./${project_dir})\$" | grep -v '^\./\.git.*$' | xargs cp -R -t "$project_dir" || exit 1
# For find_package we need the project built and installed
mkdir "$build_dir" && cd "$build_dir" || exit 1
cmake -D BUILD_TESTING=OFF -D CMAKE_INSTALL_PREFIX="${install_dir}" ../project_cmake || exit 1
make && make install || exit 1
cd .. || exit 1
cp -R tests/cmake_project_usage_test . || exit 1
proj_dir="$PWD/${project_dir}"
build_dir="build_fetch_content"
mkdir $build_dir && cd $build_dir || exit 1
INCLUDE_CHECK_WITH='FetchContent' INCLUDE_CHECK_FROM="file://${proj_dir}" cmake -D CMAKE_BUILD_TYPE=Debug ../cmake_project_usage_test || exit 1
make && src/tests.test || exit 1
cd .. || exit 1
build_dir='build_find_package_config'
mkdir $build_dir && cd $build_dir || exit 1
INCLUDE_CHECK_WITH='find_package_config' Check_ROOT="${install_dir}" cmake -D CMAKE_BUILD_TYPE=Debug ../cmake_project_usage_test || exit 1
make && src/tests.test || exit 1
cd .. || exit 1
fi