1####################################### 2# C Benchmark Tests # 3####################################### 4 5####################################### 6# Variables # 7####################################### 8 9c_driver_variables: 10 11 ## Task list 12 benchmark_compile: &benchmark_compile 13 - name: "compile" 14 benchmark_test_list: &benchmark_tests 15 - name: "BenchMarkTests" 16 17 ## Common download urls (merge in as hashes) 18 mongo_download_url_prefixes: 19 mongo_v32: &mongo_v32 20 mongo_url: "https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-3.2.10.tgz" 21 mongo_v24: &mongo_v24 22 mongo_url: "http://downloads.mongodb.org/linux/mongodb-linux-x86_64-2.4.14.tgz" 23 24 ## Common sets of CFLAGS 25 cflags: 26 standard: &cflags_64 27 cflags: "-m64 -march=x86-64" 28 29 ## Scripts that are shared between buildvariants 30 scripts: 31 compile: 32 unix: &compile_unix 33 compile_script: | 34 set -o errexit 35 set -o verbose 36 ./autogen.sh --prefix=`pwd`/mongoc 37 make -j8 38 make install 39 git clone https://github.com/mongodb/mongo-c-driver-performance.git 40 cd mongo-c-driver-performance 41 PKG_CONFIG_PATH=../mongoc/lib/pkgconfig /opt/cmake/bin/cmake . 42 make 43 44 mongodb: 45 start_mongod_command: &start_mongod_command 46 start_mongod: | 47 set -o errexit 48 set -o verbose 49 mkdir db 50 echo "Starting Mongodb" 51 ./mongodb/bin/mongod --dbpath `pwd`/db --logpath `pwd`/db/db.log --fork 52 53 benchmark_common: &benchmark_common 54 <<: *compile_unix 55 <<: *start_mongod_command 56 57####################################### 58# Functions # 59####################################### 60 61functions: 62 63 "compile function" : 64 command: shell.exec 65 params: 66 working_dir: "mongo-c-driver" 67 script: | 68 export PATH=${extra_path}:$PATH 69 export CFLAGS="${cflags}" 70 ${compile_script} 71 72 "fetch source" : 73 command: git.get_project 74 params: 75 directory: "mongo-c-driver" 76 77 "fetch artifacts" : 78 command: shell.exec 79 params: 80 working_dir: "mongo-c-driver" 81 script: | 82 set -o verbose 83 set -o errexit 84 rm -rf mongo-c-driver* 85 curl --retry 5 http://s3.amazonaws.com/mciuploads/mongo-c-driver/c-driver-benchmark-compile/${revision}/artifacts/c-perf-binaries.tar.gz -o c-perf-binaries.tar.gz --silent --max-time 120 86 ${decompress} c-perf-binaries.tar.gz 87 rm c-perf-binaries.tar.gz 88 89 "fetch mongodb" : 90 command: shell.exec 91 params: 92 working_dir: "mongo-c-driver" 93 script: | 94 set -o verbose 95 set -o errexit 96 curl --retry 5 -s ${mongo_url} --output mongo-archive.${ext|tgz} 97 ${decompress} mongo-archive.${ext|tgz} 98 mv mongodb* mongodb 99 chmod +x ./mongodb/bin/mongod${extension} 100 101 "fetch driver test data" : 102 command: shell.exec 103 params: 104 working_dir: "mongo-c-driver" 105 script: | 106 set -o verbose 107 set -o errexit 108 curl --retry 5 https://s3.amazonaws.com/boxes.10gen.com/build/driver-test-data.tar.gz -o driver-test-data.tar.gz --silent --max-time 120 109 ${decompress} driver-test-data.tar.gz 110 111 "run benchmark tests" : 112 command: shell.exec 113 params: 114 working_dir: "mongo-c-driver" 115 script: | 116 set -o errexit 117 set -o verbose 118 119 result=-1 # Negative one. 120 121 # Run this function on exit. 122 done=false 123 finish () { 124 set +o errexit 125 if [ "$done" = false ]; then 126 # There was an error. 127 echo "something went wrong, killing mongod and exiting" 128 killall -9 mongod 129 fi 130 131 exit $result 132 } 133 134 trap finish EXIT 135 136 echo "Starting mongod" 137 ${start_mongod} 138 sleep 15 139 140 echo "Running Benchmark tests " 141 start_time=$(date +%s) 142 LD_LIBRARY_PATH=`pwd`/.libs:`pwd`/mongoc/lib:$LD_LIBRARY_PATH ./mongo-c-driver-performance/mongo-c-performance ./data 143 set +o errexit 144 result=$? 145 146 cat results.json 147 148 result=$? 149 end_time=$(date +%s) 150 elapsed_secs=$((end_time-start_time)) 151 if [ $result -eq 0 ]; then 152 status='"pass"' 153 failures=0 154 else 155 status='"fail"' 156 failures=1 157 fi 158 echo "{\"failures\": $failures, \"results\": [{\"status\": $status, \"exit_code\": $result, \"test_file\": \"BenchMarkTests\", \"start\": $start_time, \"end\": $end_time, \"elapsed\": $elapsed_secs}]}" > report.json 159 cat report.json 160 161 set +o errexit 162 killall -9 mongod 163 164 done=true 165 exit $result 166 167 "attach benchmark test results" : 168 command: attach.results 169 params: 170 file_location: mongo-c-driver/report.json 171 172 "send dashboard data" : 173 command: json.send 174 params: 175 name: perf 176 file: mongo-c-driver/results.json 177 178pre: 179 # Remove and recreate old directory 180 - command: shell.exec 181 params: 182 script: | 183 rm -rf mongo-c-driver 184 mkdir mongo-c-driver 185 186post: 187 # Remove and recreate old directory 188 - command: shell.exec 189 params: 190 script: | 191 rm -rf mongo-c-driver 192 mkdir mongo-c-driver 193 194####################################### 195# Tasks # 196####################################### 197 198tasks: 199 - name: compile 200 commands: 201 - func: "fetch source" 202 - command: git.apply_patch 203 params: 204 directory: "mongo-c-driver" 205 - func: "compile function" 206 - command: shell.exec 207 params: 208 working_dir: "mongo-c-driver" 209 script: | 210 set -o errexit 211 set -o verbose 212 tar czf ../mongo-c-driver.tar.gz . 213 - command: s3.put 214 params: 215 aws_key: ${aws_key} 216 aws_secret: ${aws_secret} 217 local_file: mongo-c-driver.tar.gz 218 remote_file: mongo-c-driver/${build_variant}/${revision}/artifacts/c-perf-binaries.tar.gz 219 bucket: mciuploads 220 permissions: public-read 221 content_type: ${content_type|application/x-gzip} 222 223 - name: BenchMarkTests 224 depends_on: 225 - variant: c-driver-benchmark-compile 226 name: compile 227 commands: 228 - func: "fetch artifacts" 229 - func: "fetch mongodb" 230 - func: "fetch driver test data" 231 - func: "run benchmark tests" 232 - func: "attach benchmark test results" 233 - func: "send dashboard data" 234 235####################################### 236# Buildvariants # 237####################################### 238 239buildvariants: 240 241- name: c-driver-benchmark-compile 242 display_name: "C Driver Benchmark Compile" 243 expansions: 244 <<: *cflags_64 245 <<: *mongo_v32 246 <<: *benchmark_common 247 run_on: 248 - rhel62-small 249 tasks: *benchmark_compile 250 251- name: c-driver-benchmark-mongo24 252 display_name: "C Driver Benchmark Mongo 2.4" 253 expansions: 254 <<: *cflags_64 255 <<: *mongo_v24 256 <<: *benchmark_common 257 run_on: 258 - centos6-perf 259 tasks: *benchmark_tests 260 261- name: c-driver-benchmark-mongo32 262 display_name: "C Driver Benchmark Mongo 3.2" 263 expansions: 264 <<: *cflags_64 265 <<: *mongo_v32 266 <<: *benchmark_common 267 run_on: 268 - centos6-perf 269 tasks: *benchmark_tests 270