-
Notifications
You must be signed in to change notification settings - Fork 1
/
run_tests.sh
executable file
·151 lines (115 loc) · 3.11 KB
/
run_tests.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
#!/bin/sh
#
# run_tests.sh
#
# the compiler/c++ version combinations to test
COMPILERS="g++-8,c++11 clang++-6,c++11 g++-8,c++14 clang++-8,c++11 clang++-8,c++14"
if [ -z "$OSMIUM_TEST_BUILD_ROOT" ]; then
OSMIUM_TEST_BUILD_ROOT='.'
fi
DATE=`date +'%Y%m%dT%H%M'`
exec >testrun-$DATE.log 2>&1
set -e
BOLD="\033[1m"
NORM="\033[0m"
GREEN="\033[1;32m"
DARKRED="\033[31m"
RED="\033[1;31m"
msg() {
date=`date +'%Y-%m-%dT%H:%M:%S'`
echo "$DARKRED$BOLD==== $date $*$NORM"
}
has_cmake_tests() {
num_tests=`ctest --show-only | tail -1 | cut -d: -f2`
[ "$num_tests" != " 0" ]
}
test_using_cmake() {
CURRENT_DIR=`pwd`
REPOS=$1
CMAKE_OPTIONS=$2
BUILD_DIR="${OSMIUM_TEST_BUILD_ROOT}/build-test-$REPOS-${DATE}-${CXX}-${CPP_VERSION}"
msg "Repository $REPOS: Configuring..."
SOURCE_DIR=`pwd`/$REPOS
mkdir $BUILD_DIR
cd $BUILD_DIR
cmake -L -DCMAKE_BUILD_TYPE=Dev -DUSE_CPP_VERSION=$CPP_VERSION $CMAKE_OPTIONS $SOURCE_DIR
msg "Repository $REPOS: Building..."
make VERBOSE=1
msg "Repository $REPOS: Testing..."
# run internal tests
has_cmake_tests && ctest --output-on-failure
cd ..
rm -fr $BUILD_DIR
msg "Repository $REPOS: done\n"
cd $CURRENT_DIR
}
test_using_make() {
CURRENT_DIR=`pwd`
REPOS=$1
BUILD_DIR="${OSMIUM_TEST_BUILD_ROOT}/build-test-$REPOS-${DATE}-${CXX}-${CPP_VERSION}"
msg "Repository $REPOS: Configuring..."
SOURCE_DIR=`pwd`/$REPOS
mkdir $BUILD_DIR
cd $BUILD_DIR
ln -s "$SOURCE_DIR/../libosmium"
ln -s "$SOURCE_DIR/../protozero"
git clone $SOURCE_DIR $REPOS
cd $REPOS
msg "Repository $REPOS: Building..."
make VERBOSE=1
# msg "Repository $REPOS: Testing..."
# make test
cd ../..
rm -fr $BUILD_DIR
msg "Repository $REPOS: done\n"
cd $CURRENT_DIR
}
test_python() {
CURRENT_DIR=`pwd`
REPOS=$1
PYTHON=$2
BUILD_DIR="${OSMIUM_TEST_BUILD_ROOT}/build-test-$REPOS-${DATE}-${CXX}-${CPP_VERSION}"
msg "Repository $REPOS with $PYTHON: Configuring..."
SOURCE_DIR=`pwd`/$REPOS
mkdir $BUILD_DIR
cd $BUILD_DIR
ln -s "$SOURCE_DIR/../libosmium"
git clone $SOURCE_DIR $REPOS
cd $REPOS
msg "Repository $REPOS with $PYTHON: Building..."
$PYTHON setup.py build
msg "Repository $REPOS with $PYTHON: Testing..."
cd test
$PYTHON run_tests.py
cd ../../..
rm -fr $BUILD_DIR
msg "Repository $REPOS: done\n"
cd $CURRENT_DIR
}
cd ..
msg START
for compiler in $COMPILERS; do
CXX=${compiler%,*}
if [ "${CXX%-*}" = "g++" ]; then
CC=gcc-${CXX#*-}
fi
if [ "${CXX%-*}" = "clang++" ]; then
CC=clang-${CXX#*-}
fi
CPP_VERSION=${compiler#*,}
msg "Building C++ stuff using compiler CXX=$CXX and CC=$CC and version $CPP_VERSION..."
test_using_cmake libosmium
test_using_cmake osmium-tool
test_using_cmake osmium-contrib
test_using_cmake osmcoastline
test_using_cmake osm-gis-export
test_using_cmake osm-area-tools
# test_using_make node-osmium
done
msg "Building PyOsmium using system compiler..."
unset CC
unset CXX
unset CFLAGS
unset CXXFLAGS
test_python pyosmium python3
msg DONE