forked from msoos/cryptominisat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtravis-cmake.sh
executable file
·447 lines (376 loc) · 13 KB
/
travis-cmake.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
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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
#!/bin/bash
# Copyright (C) 2014 Mate Soos
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; version 2
# of the License.
#
# This program 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
# This file wraps CMake invocation for TravisCI
# so we can set different configurations via environment variables.
set -e
set -x
# fix TravisCI issue --> https://github.com/travis-ci/travis-ci/issues/8920
python -c "import fcntl; fcntl.fcntl(1, fcntl.F_SETFL, 0)"
check_license() {
#license check -- first print and then fail in case of problems
./utils/licensecheck/licensecheck.pl -m $1
NUM=$(./utils/licensecheck/licensecheck.pl -m $1 | grep UNK | wc -l)
shopt -s extglob
NUM="${NUM##*( )}"
NUM="${NUM%%*( )}"
shopt -u extglob
if [ "$NUM" -ne 0 ]; then
echo "There are some files without license information!"
exit -1
fi
}
check_license_fnames() {
#license check -- first print and then fail in case of problems
find $1 -type f -name $2 -exec utils/licensecheck/licensecheck.pl -m {} \;
NUM=$(find $1 -type f -name $2 -exec utils/licensecheck/licensecheck.pl -m {} \; | grep UNK | wc -l)
shopt -s extglob
NUM="${NUM##*( )}"
NUM="${NUM%%*( )}"
shopt -u extglob
if [ "$NUM" -ne 0 ]; then
echo "There are some files without license information!"
exit -1
fi
}
check_license CMakeLists.txt
check_license ./src
check_license ./tests/
check_license ./scripts/fuzz/
check_license ./scripts/learn/
check_license ./scripts/aws/
check_license_fnames tests/ CMakeLists.txt
check_license_fnames src/ CMakeLists.txt
check_license_fnames scripts/ CMakeLists.txt
NUM=$(./utils/licensecheck/licensecheck.pl -m ./tests | grep UNK | wc -l)
shopt -s extglob
NUM="${NUM##*( )}"
NUM="${NUM%%*( )}"
shopt -u extglob
if [ "$NUM" -ne 0 ]; then
echo "There are some files without license information!"
exit -1
fi
set -x
SOURCE_DIR=$(pwd)
cd build
BUILD_DIR=$(pwd)
# Note eval is needed so COMMON_CMAKE_ARGS is expanded properly
# for OSX keep prefix
PATH_PREFIX_ADD=""
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
PATH_PREFIX_ADD="-DCMAKE_INSTALL_PREFIX=/usr"
fi
case $CMS_CONFIG in
SLOW_DEBUG)
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install libboost-program-options-dev; fi
eval cmake -DENABLE_TESTING:BOOL=ON \
-DSLOW_DEBUG:BOOL=ON \
${PATH_PREFIX_ADD} \
"${SOURCE_DIR}"
;;
NORMAL)
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install libboost-program-options-dev; fi
eval cmake -DENABLE_TESTING:BOOL=ON \
${PATH_PREFIX_ADD} \
"${SOURCE_DIR}"
;;
NORMAL_PYTHON2)
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install libboost-program-options-dev; fi
eval cmake -DFORCE_PYTHON2=ON -DENABLE_TESTING:BOOL=ON \
${PATH_PREFIX_ADD} \
"${SOURCE_DIR}"
;;
LARGEMEM)
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install libboost-program-options-dev; fi
eval cmake -DENABLE_TESTING:BOOL=ON \
-DLARGEMEM:BOOL=ON \
${PATH_PREFIX_ADD} \
"${SOURCE_DIR}"
;;
LARGEMEM_GAUSS)
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install libboost-program-options-dev; fi
eval cmake -DENABLE_TESTING:BOOL=ON \
-DLARGEMEM:BOOL=ON \
-DUSE_GAUSS=ON \
"${SOURCE_DIR}"
;;
STATIC)
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install libboost-program-options-dev; fi
eval cmake -DENABLE_TESTING:BOOL=ON \
-DSTATICCOMPILE:BOOL=ON \
"${SOURCE_DIR}"
;;
ONLY_SIMPLE)
eval cmake -DENABLE_TESTING:BOOL=ON \
-DONLY_SIMPLE:BOOL=ON \
"${SOURCE_DIR}"
;;
ONLY_SIMPLE_STATIC)
eval cmake -DENABLE_TESTING:BOOL=ON \
-DONLY_SIMPLE:BOOL=ON \
-DSTATICCOMPILE:BOOL=ON \
"${SOURCE_DIR}"
;;
STATS)
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install libboost-program-options-dev; fi
eval cmake -DENABLE_TESTING:BOOL=ON \
-DSTATS:BOOL=ON \
"${SOURCE_DIR}"
;;
NOZLIB)
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install libboost-program-options-dev; fi
eval cmake -DENABLE_TESTING:BOOL=ON \
-DNOZLIB:BOOL=ON \
"${SOURCE_DIR}"
;;
RELEASE)
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install libboost-program-options-dev; fi
eval cmake -DENABLE_TESTING:BOOL=ON \
-DCMAKE_BUILD_TYPE:STRING=Release \
"${SOURCE_DIR}"
;;
NOSQLITE)
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install libboost-program-options-dev; fi
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get remove libsqlite3-dev; fi
eval cmake -DENABLE_TESTING:BOOL=ON \
"${SOURCE_DIR}"
;;
NOPYTHON)
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install libboost-program-options-dev; fi
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get remove -y python3-dev python2.7-dev python-dev libpython-dev; fi
eval cmake -DENABLE_TESTING:BOOL=ON \
"${SOURCE_DIR}"
;;
INTREE_BUILD)
cd ..
SOURCE_DIR=$(pwd)
BUILD_DIR=$(pwd)
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install libboost-program-options-dev; fi
eval cmake -DENABLE_TESTING:BOOL=ON \
"${SOURCE_DIR}"
;;
WEB)
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install libboost-program-options-dev; fi
cd "$SOURCE_DIR"
#./cmsat_mysql_setup.sh
cd "$BUILD_DIR"
eval cmake -DENABLE_TESTING:BOOL=ON \
-DSTATS:BOOL=ON \
"${SOURCE_DIR}"
;;
SQLITE)
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install libboost-program-options-dev; fi
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install libsqlite3-dev; fi
eval cmake -DENABLE_TESTING:BOOL=ON \
-DSTATS:BOOL=ON \
"${SOURCE_DIR}"
;;
NOTEST)
rm -rf ${SOURCE_DIR}/utils/gtest
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install libboost-program-options-dev; fi
eval cmake "${SOURCE_DIR}"
;;
GAUSS)
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install libboost-program-options-dev; fi
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install libsqlite3-dev; fi
eval cmake -DENABLE_TESTING:BOOL=ON \
-DUSE_GAUSS=ON \
${PATH_PREFIX_ADD} \
"${SOURCE_DIR}"
;;
M4RI)
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install libboost-program-options-dev; fi
wget https://bitbucket.org/malb/m4ri/downloads/m4ri-20140914.tar.gz
tar xzvf m4ri-20140914.tar.gz
cd m4ri-20140914/
./configure
make
sudo make install
cd ..
eval cmake -DENABLE_TESTING:BOOL=ON \
"${SOURCE_DIR}"
;;
*)
echo "\"${CMS_CONFIG}\" configuration not recognised"
exit 1
;;
esac
##################
# Run sonarqube
###################
make -j2 VERBOSE=1
if [ "$CMS_CONFIG" == "NOTEST" ]; then
sudo make install VERBOSE=1
exit 0
fi
echo $(ls lib)
echo $(ls pycryptosat)
echo $(otool -L pycryptosat/pycryptosat.so)
echo $(ldd pycryptosat/pycryptosat.so)
echo $(otool -L lib/libcryptominisat5.so.5.0)
echo $(ldd lib/libcryptominisat5.so.5.0)
if [ "$CMS_CONFIG" = "ONLY_SIMPLE_STATIC" ] || [ "$CMS_CONFIG" = "STATIC" ] ; then
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
echo $(ldd ./cryptominisat5_simple)
ldd ./cryptominisat5_simple | grep "not a dynamic";
fi
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
echo $(otool -L ./cryptominisat5_simple)
! (otool -L ./cryptominisat5_simple | grep "libcryptominisat");
! (otool -L ./cryptominisat5_simple | grep "libz");
! (otool -L ./cryptominisat5_simple | grep "libboost");
fi
fi
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then echo $(ldd ./cryptominisat5); fi
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then echo $(otool -L ./cryptominisat5); fi
if [ "$CMS_CONFIG" = "STATIC" ] ; then
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
echo $(ldd ./cryptominisat5)
ldd ./cryptominisat5 | grep "not a dynamic";
fi
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
echo $(otool -L ./cryptominisat5)
! (otool -L ./cryptominisat5 | grep "libcryptominisat");
! (otool -L ./cryptominisat5 | grep "libz");
! (otool -L ./cryptominisat5 | grep "libboost");
fi
fi
if [ "$CMS_CONFIG" == "ONLY_SIMPLE_STATIC" ] || [ "$CMS_CONFIG" == "STATIC" ]; then
exit 0
fi
ctest -V
sudo make install VERBOSE=1
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
echo $(sudo ldconfig)
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
fi
##################
# setting up python environment
##################
which python
python --version
echo $PYTHONPATH
if [ "$CMS_CONFIG" == "NORMAL_PYTHON2" ]; then
export MYPYTHON=python2
else
export MYPYTHON=python3
fi
echo "MYPYTHON is '${MYPYTHON}'"
which ${MYPYTHON}
if [[ "$CMS_CONFIG" == "NORMAL" ]] || [[ "$CMS_CONFIG" == "NORMAL_PYTHON2" ]] || [[ "$CMS_CONFIG" == "SLOW_DEBUG" ]] || [[ "$CMS_CONFIG" == "LARGEMEM" ]] || [[ "$CMS_CONFIG" == "GAUSS" ]] ; then
echo "from __future__ import print_function
import sys
print(sys.path)
" > check_path.py
${MYPYTHON} check_path.py
echo $PYTHONPATH
export PYTHONPATH=$PYTHONPATH:/usr/lib/python3.6/site-packages
export PYTHONPATH=$PYTHONPATH:/usr/lib/python2.7/site-packages
echo $PYTHONPATH
${MYPYTHON} check_path.py
(
cd pycryptosat/
${MYPYTHON} tests/test_pycryptosat.py
)
fi
case $CMS_CONFIG in
WEB)
echo "1 2 0" | ./cryptominisat5 --sql 1 --zero-exit-status
;;
SQLITE)
echo "1 2 0" | ./cryptominisat5 --sql 2 --zero-exit-status
;;
M4RI)
echo "1 2 0" | ./cryptominisat5 --xor 1 --zero-exit-status
;;
*)
echo "\"${CMS_CONFIG}\" Binary no extra testing (sql, xor, etc), skipping this part"
;;
esac
if [ "$CMS_CONFIG" == "NORMAL" ] ; then
(
cd
${MYPYTHON} -c "
import pycryptosat
a = pycryptosat.Solver()
a.add_clause([1,2,3])
print(a.solve())"
)
fi
# elimination checks
# NOTE: minisat doesn't build with clang
if [ "$CMS_CONFIG" == "NORMAL" ] && [ "$CXX" != "clang++" ] ; then
CMS_PATH="${BUILD_DIR}/cryptominisat5"
# building STP
cd "${BUILD_DIR}"
# minisat
git clone --depth 1 https://github.com/niklasso/minisat.git
cd minisat
mkdir -p build
cd build
cmake ..
make -j2
sudo make install VERBOSE=1
cd "${BUILD_DIR}"
# STP
cd "${BUILD_DIR}"
git clone --depth 1 https://github.com/stp/stp.git
cd stp
mkdir -p build
cd build
cmake ..
make -j2
sudo make install VERBOSE=1
cd "${BUILD_DIR}"
fi
#do fuzz testing
if [ "$CMS_CONFIG" != "ONLY_SIMPLE" ] && [ "$CMS_CONFIG" != "ONLY_SIMPLE_STATIC" ] && [ "$CMS_CONFIG" != "WEB" ] && [ "$CMS_CONFIG" != "NOPYTHON" ] && [ "$CMS_CONFIG" != "INTREE_BUILD" ] && [ "$CMS_CONFIG" != "STATS" ] && [ "$CMS_CONFIG" != "SQLITE" ] ; then
cd ../scripts/fuzz/
which ${MYPYTHON}
${MYPYTHON} ./fuzz_test.py --novalgrind --small --fuzzlim 30
fi
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
case $CMS_CONFIG in
WEB)
#we are now in the main dir, ./src dir is here
cd ..
pwd
cd web
sudo apt-get install python-software-properties
sudo add-apt-repository -y ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install -y nodejs
./install_web.sh
;;
STATS)
ln -s ../scripts/build_scripts/* .
ln -s ../scripts/learn/* .
# ./test_id.sh
sudo apt-get install -y --force-yes graphviz
# sudo apt-get install -y --force-yes blas
# sudo pip3 install numpy
# sudo pip3 install scipy
# sudo pip3 install sklearn
# sudo pip3 install pandas
# ./test_predict.sh
;;
*)
echo "\"${CMS_CONFIG}\" No further testing"
;;
esac
fi