Configure Travis CI for GEOS (#657)
[geos.git] / tools / ci / common.sh
blob4d078efc17cc0ea1a08e96ed3bb3642bff4b3e73
1 #!/bin/bash -e
3 # Common utilities for Travis CI setup for GEOS
5 # Copyright (c) 2013 Mateusz Loskot <mateusz@loskot.net>
7 # This is free software; you can redistribute and/or modify it under
8 # the terms of the GNU Lesser General Public Licence as published
9 # by the Free Software Foundation.
10 # See the COPYING file for more information.
12 if [[ "$TRAVIS" != "true" ]] ; then
13 echo "Running this script makes no sense outside of travis-ci.org"
14 exit 1
17 # Environment
19 TCI_NUMTHREADS=2
20 if [[ -f /sys/devices/system/cpu/online ]]; then
21 # Calculates 1.5 times physical threads
22 TCI_NUMTHREADS=$(( ( $(cut -f 2 -d '-' /sys/devices/system/cpu/online) + 1 ) * 15 / 10 ))
25 # Functions
27 tmstamp()
29 echo -n "[$(date '+%H:%M:%S')]" ;
32 run_make()
34 [ $TCI_NUMTHREADS -gt 0 ] && make -j $TCI_NUMTHREADS || make
37 run_test()
39 [ -f CMakeCache.txt ] && \
40 ctest -V --output-on-failure . || \
41 make check