Skip to content

Commit 2e5be75

Browse files
BUILD-1924 Add benchmark yml for Evergreen
1 parent 253fbac commit 2e5be75

File tree

1 file changed

+217
-0
lines changed

1 file changed

+217
-0
lines changed

.benchmark.yml

Lines changed: 217 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,217 @@
1+
#######################################
2+
# C Benchmark Tests #
3+
#######################################
4+
5+
#######################################
6+
# Variables #
7+
#######################################
8+
9+
c_driver_variables:
10+
11+
## Task list
12+
benchmark_test_list: &benchmark_tests
13+
- name: "BenchMarkTests"
14+
15+
## Common download urls (merge in as hashes)
16+
mongo_download_url_prefixes:
17+
mongo_v32: &mongo_v32
18+
#mongo_url: "http://downloads.mongodb.org/linux/mongodb-linux-x86_64-ubuntu1604-latest.tgz"
19+
mongo_url: "https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu1604-3.2.10.tgz"
20+
mongo_v24: &mongo_v24
21+
mongo_url: "http://downloads.mongodb.org/linux/mongodb-linux-x86_64-2.4.14.tgz"
22+
23+
## Common sets of CFLAGS
24+
cflags:
25+
standard: &cflags_64
26+
cflags: "-m64 -march=x86-64 -Werror"
27+
standard_no_werror: &cflags_64_no_werror
28+
cflags: "-m64 -march=x86-64"
29+
30+
## Extra $PATH entries
31+
paths:
32+
unix_path: &unix_path
33+
extra_path:
34+
35+
## Scripts that are shared between buildvariants
36+
scripts:
37+
compile:
38+
unix: &compile_unix
39+
compile_script: |
40+
set -o errexit
41+
set -o verbose
42+
./autogen.sh --prefix=`pwd`/mongoc
43+
make -j8
44+
make install
45+
git clone https://github.com/mongodb/mongo-c-driver-performance.git
46+
cd mongo-c-driver-performance
47+
PKG_CONFIG_PATH=../mongoc/lib/pkgconfig /opt/cmake/bin/cmake .
48+
#PKG_CONFIG_PATH=../mongoc/lib/pkgconfig cmake .
49+
make
50+
cd ..
51+
mongodb:
52+
start_mongod_command: &start_mongod_command
53+
start_mongod: |
54+
set -o errexit
55+
set -o verbose
56+
mkdir db
57+
./mongodb/bin/mongod --dbpath `pwd`/db --logpath `pwd`/db/db.log --fork --logappend --smallfiles --oplogSize 50
58+
59+
benchmark_common: &benchmark_common
60+
<<: *compile_unix
61+
<<: *start_mongod_command
62+
<<: *unix_path
63+
64+
#######################################
65+
# Functions #
66+
#######################################
67+
68+
functions:
69+
70+
"run benchmark tests" :
71+
command: shell.exec
72+
params:
73+
working_dir: "mongo-c-driver"
74+
script: |
75+
set -o errexit
76+
set -o verbose
77+
78+
result=-1 # Negative one.
79+
80+
# Run this function on exit.
81+
done=false
82+
finish () {
83+
set +o errexit
84+
if [ "$done" = false ]; then
85+
# There was an error.
86+
echo "something went wrong, killing mongod and exiting"
87+
killall -9 mongod
88+
fi
89+
90+
exit $result
91+
}
92+
93+
trap finish EXIT
94+
95+
echo "Compiling the C driver and performance binaries"
96+
${compile_script}
97+
98+
echo "Starting mongod"
99+
${start_mongod}
100+
sleep 15
101+
102+
echo "Running Benchmark tests "
103+
start_time=$(date +%s)
104+
# LD_LIBRARY_PATH=`pwd`/.libs:`pwd`/mongoc/lib:$LD_LIBRARY_PATH ./mongo-c-driver-performance/mongo-c-performance ./data TestFlatEncoding TestDeepEncoding
105+
LD_LIBRARY_PATH=`pwd`/.libs:`pwd`/mongoc/lib:$LD_LIBRARY_PATH ./mongo-c-driver-performance/mongo-c-performance ./data
106+
set +o errexit
107+
result=$?
108+
109+
cat results.json
110+
111+
result=$?
112+
end_time=$(date +%s)
113+
elapsed_secs=$((end_time-start_time))
114+
if [ $result -eq 0 ]; then
115+
status='"pass"'
116+
failures=0
117+
else
118+
status='"fail"'
119+
failures=1
120+
fi
121+
echo "{\"failures\": $failures, \"results\": [{\"status\": $status, \"exit_code\": $result, \"test_file\": \"BenchMarkTests\", \"start\": $start_time, \"end\": $end_time, \"elapsed\": $elapsed_secs}]}" > report.json
122+
cat report.json
123+
124+
set +o errexit
125+
killall -9 mongod
126+
127+
done=true
128+
exit $result
129+
130+
pre:
131+
# Remove and recreate old directory
132+
- command: shell.exec
133+
params:
134+
script: |
135+
rm -rf mongo-c-driver
136+
mkdir mongo-c-driver
137+
# git checkout mongo-c-driver
138+
- command: git.get_project
139+
params:
140+
directory: "mongo-c-driver"
141+
- command: git.apply_patch
142+
params:
143+
directory: "mongo-c-driver"
144+
# Fetch mongodb
145+
- command: shell.exec
146+
params:
147+
working_dir: "mongo-c-driver"
148+
script: |
149+
set -o verbose
150+
set -o errexit
151+
#ls -la
152+
curl -s ${mongo_url} --output mongo-archive.${ext|tgz}
153+
${decompress} mongo-archive.${ext|tgz}
154+
mv mongodb* mongodb
155+
chmod +x ./mongodb/bin/mongod${extension}
156+
# Fetch driver test data
157+
- command: shell.exec
158+
params:
159+
working_dir: "mongo-c-driver"
160+
script: |
161+
set -o verbose
162+
set -o errexit
163+
#ls -la
164+
curl https://s3.amazonaws.com/boxes.10gen.com/build/driver-test-data.tar.gz -o driver-test-data.tar.gz --silent --max-time 120
165+
${decompress} driver-test-data.tar.gz
166+
167+
post:
168+
- command: shell.exec
169+
params:
170+
script: |
171+
echo "post-task run."
172+
true
173+
- command: attach.results
174+
params:
175+
file_location: mongo-c-driver/report.json
176+
# Send perf dashboard data
177+
- command: json.send
178+
params:
179+
name: perf
180+
file: mongo-c-driver/results.json
181+
182+
183+
#######################################
184+
# Tasks #
185+
#######################################
186+
187+
tasks:
188+
189+
- name: BenchMarkTests
190+
commands:
191+
- func: "run benchmark tests"
192+
193+
#######################################
194+
# Buildvariants #
195+
#######################################
196+
197+
buildvariants:
198+
199+
- name: ubuntu-1604-mongo24
200+
display_name: "C Driver Mongo 2.4"
201+
expansions:
202+
<<: *cflags_64
203+
<<: *mongo_v24
204+
<<: *benchmark_common
205+
run_on:
206+
- ubuntu1604-test
207+
tasks: *benchmark_tests
208+
209+
- name: ubuntu-1604-mongo32
210+
display_name: "C Driver Mongo 3.2"
211+
expansions:
212+
<<: *cflags_64
213+
<<: *mongo_v32
214+
<<: *benchmark_common
215+
run_on:
216+
- ubuntu1604-test
217+
tasks: *benchmark_tests

0 commit comments

Comments
 (0)