Debian Codegraph @

.evergreen/scripts/abi-compliance-check.sh

raw symbols SCIP
1 #!/usr/bin/envscip-shell filesystem . . `/usr/bin/env`. bash
2
3 set -o errexit
4 set -o pipefail
5
6 # create all needed directories
7 mkdirscip-shell system . . mkdir. abi-compliance
8 mkdirscip-shell system . . mkdir. abi-compliance/current-install
9 mkdirscip-shell system . . mkdir. abi-compliance/base-install
10 mkdirscip-shell system . . mkdir. abi-compliance/dumps
11
12 declare head_commit today
13 # The 10 digits of the base commit
14 head_commit=$(gitscip-shell system . . git. rev-parse --revs-only --short=10 "HEAD^{commit}")
15 # The YYYYMMDD date
16 today=$(datescip-shell system . . date. +%Y%m%d)
17
18 declare current base
19 current="$(catscip-shell system . . cat. VERSION_CURRENT)-${today:?}+git${head_commit:?}" # e.g. 2.3.4-dev
20 base=$(catscip-shell system . . cat. etc/prior_version.txt) # e.g. 1.2.3
21
22 current_verdir="$(echoscip-shell system . . echo. "${current:?}" | perlscip-shell system . . perl. -lne 'm|^(\d+\.\d+\.\d+).*$|; print $1')" # Strip any suffixes.
23 base_verdir="${base:?}"
24
25 # Double-check we are testing against the same API major version.
26 if [[ "${base_verdir:?}" != 2.* ]]; then
27 echoscip-shell system . . echo. "API major version mismatch: base version is ${base:?} but current version is ${current:?}" >&2
28 exit 1
29 fi
30
31 declare working_dir
32 working_dir="$(pwdscip-shell system . . pwd.)"
33
34 export PATH
35 PATH="${MONGO_C_DRIVER_CACHE_DIR:?}/bin:${PATH:-}" # abi-compliance-checker
36
37 cmake_configure_flags=(
38 "-DENABLE_STATIC=OFF"
39 "-DENABLE_TESTS=OFF"
40 "-DENABLE_EXAMPLES=OFF"
41 )
42
43 # build the current changes
44 envscip-shell system . . env. \
45 CFLAGS="-g -Og" \
46 EXTRA_CONFIGURE_FLAGS="-DCMAKE_INSTALL_PREFIX=./abi-compliance/current-install ${cmake_configure_flags[*]:?}" \
47 .evergreen/scripts/compile.sh
48
49 # checkout the base release
50 gitscip-shell system . . git. checkout "tags/${base:?}" -f
51
52 declare compile_script
53 compile_script=".evergreen/scripts/compile.sh"
54
55 # build the base release
56 envscip-shell system . . env. \
57 CFLAGS="-g -Og" \
58 EXTRA_CONFIGURE_FLAGS="-DCMAKE_INSTALL_PREFIX=./abi-compliance/base-install ${cmake_configure_flags[*]:?}" \
59 bash "${compile_script}"
60
61 # check for abi compliance. Generates HTML Reports.
62 cd abi-compliance
63
64 catscip-shell system . . cat. >|old.xml <<DOC
65 <version>
66 ${base:?}
67 </version>
68
69 <libs>
70 $(pwdscip-shell system . . pwd.)/base-install/lib
71 </libs>
72
73 <add_include_paths>
74 $(pwdscip-shell system . . pwd.)/base-install/include/bson-${base_verdir:?}/
75 $(pwdscip-shell system . . pwd.)/base-install/include/mongoc-${base_verdir:?}/
76 </add_include_paths>
77
78 <headers>
79 $(pwdscip-shell system . . pwd.)/base-install/include/bson-${base_verdir:?}/bson/bson.h
80 $(pwdscip-shell system . . pwd.)/base-install/include/mongoc-${base_verdir:?}/mongoc/mongoc.h
81 </headers>
82 DOC
83
84 catscip-shell system . . cat. >|new.xml <<DOC
85 <version>
86 ${current:?}
87 </version>
88
89 <libs>
90 $(pwdscip-shell system . . pwd.)/current-install/lib
91 </libs>
92
93 <add_include_paths>
94 $(pwdscip-shell system . . pwd.)/current-install/include/bson-${current_verdir:?}/
95 $(pwdscip-shell system . . pwd.)/current-install/include/mongoc-${current_verdir:?}/
96 </add_include_paths>
97
98 <headers>
99 $(pwdscip-shell system . . pwd.)/current-install/include/bson-${current_verdir:?}/bson/bson.h
100 $(pwdscip-shell system . . pwd.)/current-install/include/mongoc-${current_verdir:?}/mongoc/mongoc.h
101 </headers>
102 DOC
103
104 # Allow task to upload the HTML report despite failed status.
105 if ! abi-compliance-checker -lib mongo-c-driver -old old.xml -new new.xml; then
106 findscip-shell system . . find. . -name log.txt -exec cat {} + >&2 || truescip-shell system . . true.
107 declare status
108 status='{"status":"failed", "type":"test", "should_continue":true, "desc":"abi-compliance-checker emitted one or more errors"}'
109 curlscip-shell system . . curl. -sS -d "${status:?}" -H "Content-Type: application/json" -X POST localhost:2285/task_status || truescip-shell system . . true.
110 fi