-
Notifications
You must be signed in to change notification settings - Fork 455
/
Copy pathabi-compliance-check.sh
executable file
·75 lines (61 loc) · 2.19 KB
/
abi-compliance-check.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
#!/usr/bin/env bash
set -o errexit
# create all needed directories
mkdir abi-compliance
mkdir abi-compliance/changes-install
mkdir abi-compliance/latest-release-install
mkdir abi-compliance/dumps
declare head_commit today
# The 10 digits of the current commit
head_commit=$(git rev-parse --revs-only --short=10 "HEAD^{commit}")
# The YYYYMMDD date
today=$(date +%Y%m%d)
declare newest current
current="$(cat VERSION_CURRENT)-$today+git$head_commit"
newest=$(cat etc/prior_version.txt)
declare working_dir
working_dir="$(pwd)"
export PATH
PATH="${working_dir:?}/install/bin:${PATH:-}"
# build the current changes
env \
CFLAGS="-g -Og" \
EXTRA_CONFIGURE_FLAGS="-DCMAKE_INSTALL_PREFIX=./abi-compliance/changes-install" \
.evergreen/scripts/compile.sh
# checkout the newest release
git checkout "tags/${newest}" -f
declare compile_script=".evergreen/scripts/compile.sh"
if [[ ! -f "${compile_script}" ]]; then
# Compatibility: remove once latest release contains relocated script.
compile_script=".evergreen/compile.sh"
fi
# build the newest release
env \
CFLAGS="-g -Og" \
EXTRA_CONFIGURE_FLAGS="-DCMAKE_INSTALL_PREFIX=./abi-compliance/latest-release-install" \
bash "${compile_script}"
# check for abi compliance. Generates HTML Reports.
cd abi-compliance
cat >|old.xml <<DOC
<version>${newest}</version>
<headers>
$(pwd)/latest-release-install/include/libmongoc-1.0/mongoc/mongoc.h
$(pwd)/latest-release-install/include/libbson-1.0/bson/bson.h
</headers>
<libs>$(pwd)/latest-release-install/lib</libs>
DOC
cat >|new.xml <<DOC
<version>${current}</version>
<headers>
$(pwd)/changes-install/include/libmongoc-1.0/mongoc/mongoc.h
$(pwd)/changes-install/include/libbson-1.0/bson/bson.h
</headers>
<libs>$(pwd)/changes-install/lib</libs>
DOC
# Allow task to upload the HTML report despite failed status.
if ! abi-compliance-checker -lib mongo-c-driver -old old.xml -new new.xml; then
: # CDRIVER-5930: re-enable task failure once 2.0.0 is released.
# declare status
# status='{"status":"failed", "type":"test", "should_continue":true, "desc":"abi-compliance-checker emitted one or more errors"}'
# curl -sS -d "${status:?}" -H "Content-Type: application/json" -X POST localhost:2285/task_status || true
fi