forked from mongodb/mongo-cxx-driver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.mci.yml
1722 lines (1571 loc) · 68 KB
/
.mci.yml
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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#######################################
# CXX Driver Config for MCI #
#######################################
#######################################
# Variables #
#######################################
variables:
mongoc_version_default: &mongoc_version_default "2966c67d"
mongocrypt_version_default: &mongocrypt_version_default "1.5.2"
# If updating mongoc_version_minimum, also update:
# - the default value of --c-driver-build-ref in etc/make_release.py
# - LIBMONGOC_REQUIRED_VERSION in src/mongocxx/CMakeLists.txt
mongoc_version_minimum: &mongoc_version_minimum "1.22.1"
mongocrypt_version_minimum: &mongocrypt_version_minimum "1.5.2"
mongodb_version:
version_latest: &version_latest "latest"
version_60: &version_60 "6.0"
version_50: &version_50 "5.0"
version_44: &version_44 "4.4"
version_42: &version_42 "4.2"
version_40: &version_40 "4.0"
## cmake path variables
extra_path:
linux_extra_path: &linux_extra_path /opt/cmake/bin
macos_extra_path: &macos_extra_path /Applications/Cmake.app/Contents/bin
msvc2015_extra_path: &msvc2015_extra_path "/cygdrive/c/cmake/bin:/cygdrive/c/Program Files (x86)/MSBuild/14.0/Bin"
msvc2017_extra_path: &msvc2017_extra_path "/cygdrive/c/cmake/bin:/cygdrive/c/Program Files (x86)/Microsoft Visual Studio/2017/Professional/MSBuild/15.0/Bin"
## tar options variables
tar_options:
linux_tar_options: &linux_tar_options --wildcards --no-anchored
## cmake flag variables
cmake_flags:
linux_cmake_flags: &linux_cmake_flags -DCMAKE_C_FLAGS="-Wall -Wextra -Wno-attributes -Werror -Wno-missing-field-initializers $ignore_deprecated" -DCMAKE_CXX_FLAGS="-Wall -Wextra -Wconversion -Wnarrowing -Wno-expansion-to-defined -pedantic -Werror -Wno-missing-field-initializers -Wno-aligned-new $ignore_deprecated"
macos_cmake_flags: &macos_cmake_flags -DCMAKE_C_FLAGS="-Wall -Wextra -Wno-attributes -Werror -Wno-missing-field-initializers $ignore_deprecated" -DCMAKE_CXX_FLAGS="-stdlib=libc++ -Wall -Wextra -Wconversion -Wnarrowing -pedantic -Werror $ignore_deprecated"
asan_cmake_flags: &asan_cmake_flags -DCMAKE_C_FLAGS="-Wall -Wextra -Wno-attributes -Werror -Wno-missing-field-initializers $ignore_deprecated" -DCMAKE_CXX_COMPILER="/usr/bin/clang++" -DCMAKE_CXX_FLAGS="-D_GLIBCXX_USE_CXX11_ABI=0 -fsanitize=address -O1 -g -fno-omit-frame-pointer -Wall -Wextra -Wconversion -Wnarrowing -pedantic -Werror $ignore_deprecated"
ubsan_cmake_flags: &ubsan_cmake_flags -DCMAKE_C_FLAGS="-Wall -Wextra -Wno-attributes -Werror -Wno-missing-field-initializers $ignore_deprecated" -DCMAKE_CXX_COMPILER="/usr/bin/clang++" -DCMAKE_CXX_FLAGS="-D_GLIBCXX_USE_CXX11_ABI=0 -fsanitize=undefined -fsanitize-blacklist=$(pwd)/etc/ubsan.ignorelist -fno-sanitize-recover=undefined -O1 -g -fno-omit-frame-pointer -Wall -Wextra -Wconversion -Wnarrowing -pedantic -Werror $ignore_deprecated"
msvc2015_cmake_flags: &msvc2015_cmake_flags -DBOOST_ROOT=c:/local/boost_1_60_0
msvc2015_generator: &msvc2015_generator Visual Studio 14 2015 Win64
msvc2017_cmake_flags: &msvc2017_cmake_flags -DCMAKE_CXX_STANDARD=17
msvc2017_generator: &msvc2017_generator Visual Studio 15 2017 Win64
code_coverage_cmake_flags: &code_coverage_cmake_flags -DENABLE_CODE_COVERAGE=ON
# power8_cmake_flags includes -Wno-maybe-uninitialized to ignore a warning from the std::optional implementation of MNMLSTC.
power8_cmake_flags: &power8_cmake_flags -DCMAKE_C_FLAGS="-Wall -Wextra -Wno-attributes -Werror -Wno-missing-field-initializers $ignore_deprecated" -DCMAKE_CXX_FLAGS="-Wall -Wextra -Wconversion -Wnarrowing -Wno-expansion-to-defined -pedantic -Werror -Wno-missing-field-initializers -Wno-aligned-new $ignore_deprecated -Wno-error=maybe-uninitialized"
example_projects_cc:
asan_cc_path: &asan_cc_path /usr/bin/clang
ubsan_cc_path: &ubsan_cc_path /usr/bin/clang
example_projects_cxx:
asan_cxx_path: &asan_cxx_path /usr/bin/clang++
ubsan_cxx_path: &ubsan_cxx_path /usr/bin/clang++
example_projects_cxxflags:
asan_cxxflags: &asan_cxxflags -D_GLIBCXX_USE_CXX11_ABI=0 -fsanitize=address -fno-omit-frame-pointer
ubsan_cxxflags: &ubsan_cxxflags -D_GLIBCXX_USE_CXX11_ABI=0 -fsanitize=undefined -fno-sanitize-recover=undefined -fno-omit-frame-pointer
example_projects_ldflags:
asan_ldflags: &asan_ldflags -fsanitize=address
ubsan_ldflags: &ubsan_ldflags -fsanitize=undefined -fno-sanitize-recover=undefined
example_projects_cxx_standard:
std_experimental_cxx_standard: &std_experimental_cxx_standard 14
poly_flags:
poly_boost_flags: &poly_boost_flags -DBSONCXX_POLY_USE_BOOST=ON
poly_std_experimental_flags: &poly_std_experimental_flags -DBSONCXX_POLY_USE_STD_EXPERIMENTAL=ON -DCMAKE_CXX_STANDARD=14
poly_mnmlstc: &poly_mnmlstc -DBSONCXX_POLY_USE_MNMLSTC=ON
## test parameters
test_params:
asan_test_params: &asan_test_params PATH="/usr/lib/llvm-3.8/bin" ASAN_OPTIONS="detect_leaks=1"
ubsan_test_params: &ubsan_test_params PATH="/usr/lib/llvm-3.8/bin" UBSAN_OPTIONS="print_stacktrace=1"
valgrind_test_params: &valgrind_test_params valgrind --leak-check=full --track-origins=yes --num-callers=50 --error-exitcode=1 --error-limit=no --read-var-info=yes --suppressions=../etc/memcheck.suppressions
#######################################
# Functions #
#######################################
functions:
"setup":
- command: shell.exec
params:
shell: bash
script: |
set -o errexit
set -o pipefail
rm -rf "mongo-cxx-driver"
rm -fr "mongo-c-driver"
rm -fr mongod
rm -fr drivers-evergreen-tools
- command: git.get_project
params:
directory: "mongo-cxx-driver"
- command: shell.exec
params:
shell: bash
working_dir: "."
script: |
set -o errexit
set -o pipefail
cc --version || true
c++ --version || true
gcc --version || true
g++ --version || true
clang --version || true
cmake --version || true
openssl version || true
"build_mongohouse":
command: shell.exec
params:
shell: bash
script: |
if [ ! -d "drivers-evergreen-tools" ]; then
git clone [email protected]:mongodb-labs/drivers-evergreen-tools.git
fi
cd drivers-evergreen-tools
export DRIVERS_TOOLS=$(pwd)
sh .evergreen/atlas_data_lake/build-mongohouse-local.sh
"run_mongohouse":
command: shell.exec
params:
shell: bash
background: true
script: |
cd drivers-evergreen-tools
export DRIVERS_TOOLS=$(pwd)
sh .evergreen/atlas_data_lake/run-mongohouse-local.sh
"test_mongohouse":
command: shell.exec
params:
shell: bash
working_dir: "mongo-cxx-driver"
script: |
echo "testing that mongohouse is running..."
ps aux | grep mongohouse
cd build
export PREFIX=$(pwd)/../../mongoc
# Use LD_LIBRARY_PATH to inform the tests where to find dependencies on Linux.
# This task only runs on Linux.
if [ -n "${lib_dir}" ]; then
export LD_LIBRARY_PATH=.:$PREFIX/${lib_dir}/
else
export LD_LIBRARY_PATH=.:$PREFIX/lib/
fi
export MONGOHOUSE_TESTS_PATH="$(pwd)/../data/mongohouse"
ulimit -c unlimited || true
./src/mongocxx/test/test_mongohouse_specs
"start_mongod":
command: shell.exec
params:
shell: bash
working_dir: "."
script: |
set -o errexit
set -o pipefail
if [ ! -d "drivers-evergreen-tools" ]; then
git clone [email protected]:mongodb-labs/drivers-evergreen-tools.git
fi
cd drivers-evergreen-tools
export DRIVERS_TOOLS=$(pwd)
if [ "Windows_NT" == "$OS" ]; then
export DRIVERS_TOOLS=$(cygpath -m $DRIVERS_TOOLS)
fi
export MONGODB_BINARIES=$DRIVERS_TOOLS/mongodb/bin
export MONGO_ORCHESTRATION_HOME=$DRIVERS_TOOLS/.evergreen/orchestration
export MONGODB_VERSION=${mongodb_version}
export AUTH=${AUTH}
export TOPOLOGY=${TOPOLOGY|server}
export REQUIRE_API_VERSION=${REQUIRE_API_VERSION}
export ORCHESTRATION_FILE=${ORCHESTRATION_FILE}
export PATH="$MONGODB_BINARIES:$PATH"
echo "{ \"releases\": { \"default\": \"$MONGODB_BINARIES\" }}" > $MONGO_ORCHESTRATION_HOME/orchestration.config
./.evergreen/run-orchestration.sh
# Copy mongocryptd up so other functions can find it later, since we can't share PATHs
if [ -f $MONGODB_BINARIES/mongocryptd ]; then
cp $MONGODB_BINARIES/mongocryptd ../mongocryptd
fi
cd ../
pwd
"stop_mongod":
command: shell.exec
params:
shell: bash
working_dir: "."
script: |
set -o errexit
set -o pipefail
if cd drivers-evergreen-tools/.evergreen/orchestration; then
. ../venv-utils.sh
if venvactivate venv; then
mongo-orchestration stop
fi
fi
"install_c_driver":
- command: expansions.update
params:
updates:
- key: mongoc_version_default
value: *mongoc_version_default
- key: mongocrypt_version_default
value: *mongocrypt_version_default
- command: shell.exec
params:
shell: bash
working_dir: "mongo-cxx-driver"
script: |
set -o errexit
set -o pipefail
export PREFIX=$(pwd)/../mongoc/
if [ "Windows_NT" == "$OS" ]; then
PREFIX=$(cygpath -m "$PREFIX")
fi
export CMAKE=${cmake}
export GENERATOR="${generator}"
if [ "1" == "${BSON_EXTRA_ALIGNMENT}" ]; then
echo "Building C driver with BSON extra alignment"
fi
MONGOC_VERSION=${mongoc_version}
MONGOCRYPT_VERSION=${mongocrypt_version}
if [[ -z $MONGOC_VERSION ]]; then
MONGOC_VERSION=${mongoc_version_default}
fi
if [[ -z $MONGOCRYPT_VERSION ]]; then
MONGOCRYPT_VERSION=${mongocrypt_version_default}
fi
BSON_EXTRA_ALIGNMENT=${BSON_EXTRA_ALIGNMENT} MONGOC_VERSION=$MONGOC_VERSION MONGOCRYPT_VERSION=$MONGOCRYPT_VERSION ./.evergreen/install_c_driver.sh
"lint":
- command: shell.exec
params:
shell: bash
working_dir: "mongo-cxx-driver"
script: |
set -o errexit
set -o pipefail
python etc/clang_format.py lint
"clang-tidy":
- command: shell.exec
params:
shell: bash
working_dir: "mongo-cxx-driver"
script: |
set -o errexit
set -o pipefail
./etc/run-clang-tidy.sh
"clone_drivers-evergreen-tools":
- command: shell.exec
params:
shell: bash
script: |-
set -o errexit
if [ ! -d "drivers-evergreen-tools" ]; then
git clone [email protected]:mongodb-labs/drivers-evergreen-tools.git --depth=1
fi
"run_kms_servers":
- command: shell.exec
params:
shell: bash
script: |-
set -o errexit
echo "Preparing CSFLE venv environment..."
cd ./drivers-evergreen-tools/.evergreen/csfle
# This function ensures future invocations of activate-kmstlsvenv.sh conducted in
# parallel do not race to setup a venv environment; it has already been prepared.
# This primarily addresses the situation where the "test" and "run_kms_servers"
# functions invoke 'activate-kmstlsvenv.sh' simultaneously.
if [[ "$OSTYPE" =~ cygwin && ! -d kmstlsvenv ]]; then
# Avoid using Python 3.10 on Windows due to incompatible cipher suites.
# See CXX-2628.
. ../venv-utils.sh
venvcreate "C:/python/Python39/python.exe" kmstlsvenv || # windows-2017
venvcreate "C:/python/Python38/python.exe" kmstlsvenv # windows-2015
python -m pip install --upgrade boto3~=1.19 pykmip~=0.10.0 "sqlalchemy<2.0.0"
deactivate
else
. ./activate-kmstlsvenv.sh
deactivate
fi
echo "Preparing CSFLE venv environment... done."
- command: shell.exec
params:
background: true
shell: bash
script: |-
set -o errexit
echo "Starting mock KMS servers..."
cd ./drivers-evergreen-tools/.evergreen/csfle
. ./activate-kmstlsvenv.sh
python -u kms_http_server.py --ca_file ../x509gen/ca.pem --cert_file ../x509gen/server.pem --port 8999 &
python -u kms_http_server.py --ca_file ../x509gen/ca.pem --cert_file ../x509gen/expired.pem --port 9000 &
python -u kms_http_server.py --ca_file ../x509gen/ca.pem --cert_file ../x509gen/wrong-host.pem --port 9001 &
python -u kms_http_server.py --ca_file ../x509gen/ca.pem --cert_file ../x509gen/server.pem --port 9002 --require_client_cert &
python -u kms_kmip_server.py &
echo "Starting mock KMS servers... done."
"compile":
- command: shell.exec
params:
shell: bash
working_dir: "mongo-cxx-driver"
script: |
set -o errexit
set -o pipefail
export BUILD_TYPE=${build_type}
export PATH="${extra_path}:$PATH"
export RUN_DISTCHECK=${RUN_DISTCHECK}
ADDL_OPTS=${code_coverage_cmake_flags}
if [ "${USE_STATIC_LIBS}" ]; then
ADDL_OPTS="$ADDL_OPTS -DBUILD_SHARED_LIBS=OFF"
fi
if [ "${ENABLE_TESTS}" = "OFF" ]; then
ADDL_OPTS="$ADDL_OPTS -DENABLE_TESTS=OFF"
fi
MONGOC_PREFIX="$(pwd)/../mongoc"
echo "MONGOC_PREFIX=$MONGOC_PREFIX"
ls -l $MONGOC_PREFIX
if [ "Windows_NT" == "$OS" ]; then
MONGOC_PREFIX=$(cygpath -m "$MONGOC_PREFIX")
fi
export CMAKE=${cmake}
if [ ! -d ../drivers-evergreen-tools ]; then
git clone --depth 1 [email protected]:mongodb-labs/drivers-evergreen-tools.git ../drivers-evergreen-tools
fi
. ../drivers-evergreen-tools/.evergreen/find-python3.sh
. ../drivers-evergreen-tools/.evergreen/venv-utils.sh
venvcreate "$(find_python3)" venv
python -m pip install GitPython
export GENERATOR="${generator}"
if [ "$(echo ${branch_name} | cut -f2 -d'/')" != "${branch_name}" ]; then
# ignore deprecation warnings when building on a release branch
ignore_deprecated=-Wno-deprecated-declarations
fi
.evergreen/compile.sh -DCMAKE_PREFIX_PATH="$MONGOC_PREFIX" ${cmake_flags} ${poly_flags} $ADDL_OPTS -DCMAKE_INSTALL_PREFIX=install
"test":
- command: shell.exec
params:
shell: bash
working_dir: "mongo-cxx-driver"
script: |
set -o errexit
set -o pipefail
# Grabs the mongocryptd path
pushd ..
export MONGOCRYPTD_PATH=$(pwd)/
if [ "Windows_NT" == "$OS" ]; then
export MONGOCRYPTD_PATH=$(cygpath -m $MONGOCRYPTD_PATH)
fi
popd # ..
export PATH="${extra_path}:$PATH"
pushd build
export PREFIX=$(pwd)/../../mongoc
# Use PATH / LD_LIBRARY_PATH / DYLD_LIBRARY_PATH to inform the tests where to find
# mongoc library dependencies on Windows / Linux / Mac OS, respectively.
# Additionally, on Windows, we also need to inform the tests where to find
# mongocxx library dependencies.
if [ -n "${lib_dir}" ]; then
export LD_LIBRARY_PATH=.:$PREFIX/${lib_dir}/
export DYLD_LIBRARY_PATH=.:$PREFIX/${lib_dir}/
else
export LD_LIBRARY_PATH=.:$PREFIX/lib/
export DYLD_LIBRARY_PATH=.:$PREFIX/lib/
fi
export PATH=$(pwd)/src/bsoncxx/${build_type}:$(pwd)/src/mongocxx/${build_type}:$PREFIX/bin:$(pwd)/install/bin:$PATH
export CRUD_LEGACY_TESTS_PATH="$(pwd)/../data/crud/legacy"
export CRUD_UNIFIED_TESTS_PATH="$(pwd)/../data/crud/unified"
export CHANGE_STREAMS_UNIFIED_TESTS_PATH="$(pwd)/../data/change-streams/unified"
export ENCRYPTION_TESTS_PATH="$(pwd)/../data/client_side_encryption"
export GRIDFS_TESTS_PATH="$(pwd)/../data/gridfs"
export COMMAND_MONITORING_TESTS_PATH="$(pwd)/../data/command-monitoring"
export TRANSACTIONS_TESTS_PATH="$(pwd)/../data/transactions"
export WITH_TRANSACTION_TESTS_PATH="$(pwd)/../data/with_transaction"
export RETRYABLE_READS_TESTS_PATH="$(pwd)/../data/retryable-reads"
export READ_WRITE_CONCERN_OPERATION_TESTS_PATH="$(pwd)/../data/read-write-concern/operation"
export UNIFIED_FORMAT_TESTS_PATH=$(pwd)/../data/unified-format
export SESSION_UNIFIED_TESTS_PATH="$(pwd)/../data/sessions/unified"
export VERSIONED_API_TESTS_PATH=$(pwd)/../data/versioned-api
export COLLECTION_MANAGEMENT_TESTS_PATH="$(pwd)/../data/collection-management"
export MONGODB_API_VERSION="${MONGODB_API_VERSION}"
pushd ../../drivers-evergreen-tools
export DRIVERS_TOOLS=$(pwd)
if [ "Windows_NT" == "$OS" ]; then
export DRIVERS_TOOLS=$(cygpath -m $DRIVERS_TOOLS)
fi
popd # ../../drivers-evergreen-tools
if [ "$(uname -m)" == "ppc64le" ]; then
echo "Skipping CSFLE test setup (CDRIVER-4246/CXX-2423)"
else
# export environment variables for encryption tests
set +o errexit
# Avoid printing credentials in logs.
set +o xtrace
echo "Setting temporary credentials..."
pushd "$DRIVERS_TOOLS/.evergreen/csfle"
export AWS_SECRET_ACCESS_KEY="${cse_aws_secret_access_key}"
export AWS_ACCESS_KEY_ID="${cse_aws_access_key_id}"
export AWS_DEFAULT_REGION="us-east-1"
echo "Running activate-kmstlsvenv.sh..."
. ./activate-kmstlsvenv.sh
echo "Running activate-kmstlsvenv.sh... done."
echo "Running set-temp-creds.sh..."
. ./set-temp-creds.sh
echo "Running set-temp-creds.sh... done."
deactivate
popd # "$DRIVERS_TOOLS/.evergreen/csfle"
echo "Setting temporary credentials... done."
# Ensure temporary credentials were properly set.
if [ -z "$CSFLE_AWS_TEMP_ACCESS_KEY_ID" ]; then
echo "Failed to set temporary credentials!"
exit 1
fi
export MONGOCXX_TEST_CSFLE_TLS_CA_FILE=$DRIVERS_TOOLS/.evergreen/x509gen/ca.pem
export MONGOCXX_TEST_CSFLE_TLS_CERTIFICATE_KEY_FILE=$DRIVERS_TOOLS/.evergreen/x509gen/client.pem
export MONGOCXX_TEST_AWS_TEMP_ACCESS_KEY_ID="$CSFLE_AWS_TEMP_ACCESS_KEY_ID"
export MONGOCXX_TEST_AWS_TEMP_SECRET_ACCESS_KEY="$CSFLE_AWS_TEMP_SECRET_ACCESS_KEY"
export MONGOCXX_TEST_AWS_TEMP_SESSION_TOKEN="$CSFLE_AWS_TEMP_SESSION_TOKEN"
export MONGOCXX_TEST_AWS_SECRET_ACCESS_KEY="${cse_aws_secret_access_key}"
export MONGOCXX_TEST_AWS_ACCESS_KEY_ID="${cse_aws_access_key_id}"
export MONGOCXX_TEST_AZURE_TENANT_ID="${cse_azure_tenant_id}"
export MONGOCXX_TEST_AZURE_CLIENT_ID="${cse_azure_client_id}"
export MONGOCXX_TEST_AZURE_CLIENT_SECRET="${cse_azure_client_secret}"
export MONGOCXX_TEST_GCP_EMAIL="${cse_gcp_email}"
export MONGOCXX_TEST_GCP_PRIVATEKEY="${cse_gcp_privatekey}"
set -o errexit
fi
if [ "$(uname -m)" == "ppc64le" ]; then
echo "Skipping CSFLE test setup (CDRIVER-4246/CXX-2423)"
else
# Register CA certificate required by KMS TLS connections.
echo "Registering CA certificate for KMS TLS tests..."
register_ca_cert() {
local OS=$(uname -s | tr '[:upper:]' '[:lower:]')
echo "register_ca_cert: OS: $OS"
case "$OS" in
cygwin*)
certutil.exe -addstore "Root" "$DRIVERS_TOOLS\.evergreen\x509gen\ca.pem"
;;
darwin*)
sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain $DRIVERS_TOOLS/.evergreen/x509gen/ca.pem
;;
*)
if [ -f /etc/redhat-release ]; then
# CSE KMS TLS tests are disabled on RHEL due to sudo permissions. See BUILD-14068.
# sudo cp -v $DRIVERS_TOOLS/.evergreen/x509gen/ca.pem /usr/share/pki/ca-trust-source/anchors/cdriver.crt
# sudo update-ca-trust extract --verbose
export MONGOCXX_TEST_SKIP_KMS_TLS_TESTS=1
else
sudo cp -v $DRIVERS_TOOLS/.evergreen/x509gen/ca.pem /usr/local/share/ca-certificates/cdriver.crt
sudo update-ca-certificates --verbose
fi
;;
esac
}
register_ca_cert
echo "Registering CA certificate for KMS TLS tests... done."
# Ensure mock KMS servers are running before starting tests.
wait_for_kms_server() {
for i in $(seq 60); do
# Exit code 7: "Failed to connect to host".
if curl -s "localhost:$1"; (($? != 7)); then
return 0
else
sleep 1
fi
done
echo "Could not detect mock KMS server on port $1"
return 1
}
echo "Waiting for mock KMS servers to start..."
wait_for_kms_server 8999
wait_for_kms_server 9000
wait_for_kms_server 9001
wait_for_kms_server 9002
wait_for_kms_server 5698
echo "Waiting for mock KMS servers to start... done."
fi
if [ "Windows_NT" == "$OS" ]; then
CTEST_OUTPUT_ON_FAILURE=1 MSBuild.exe /p:Configuration=${build_type} RUN_TESTS.vcxproj
# Only run examples if MONGODB_API_VERSION is unset. We do not append
# API version to example clients, so examples will fail when requireApiVersion
# is true.
if [[ -z "$MONGODB_API_VERSION" ]]; then
CTEST_OUTPUT_ON_FAILURE=1 MSBuild.exe /p:Configuration=${build_type} examples/run-examples.vcxproj
fi
else
# ENABLE_SLOW_TESTS is required to run the slow tests that are disabled by default. The slow tests should not be run if explicitly disabled.
if [ -z "${disable_slow_tests}" ]; then
export MONGOCXX_ENABLE_SLOW_TESTS=1
fi
ulimit -c unlimited || true
# Run tests and examples 1-by-1 with "test_params" so we can run them with valgrind.
${test_params} ./src/bsoncxx/test/test_bson
${test_params} ./src/mongocxx/test/test_driver
${test_params} ./src/mongocxx/test/test_client_side_encryption_specs
${test_params} ./src/mongocxx/test/test_crud_specs
${test_params} ./src/mongocxx/test/test_gridfs_specs
${test_params} ./src/mongocxx/test/test_command_monitoring_specs
${test_params} ./src/mongocxx/test/test_instance
${test_params} ./src/mongocxx/test/test_transactions_specs
${test_params} ./src/mongocxx/test/test_logging
${test_params} ./src/mongocxx/test/test_retryable_reads_specs
${test_params} ./src/mongocxx/test/test_read_write_concern_specs
${test_params} ./src/mongocxx/test/test_unified_format_spec
# Some platforms like OS X don't support the /mode syntax to the -perm option
# of find(1), and some platforms like Ubuntu 16.04 don't support the +mode
# syntax, so we use Perl to help us find executable files.
EXAMPLES=$(find examples -type f | sort | perl -nlwe 'print if -x')
# Only run examples if MONGODB_API_VERSION is unset. We do not append
# API version to example clients, so examples will fail when requireApiVersion
# is true.
if [[ -z "$MONGODB_API_VERSION" ]]; then
for test in $EXAMPLES; do
case "$test" in
*encryption*)
echo "Skipping client side encryption example"
;;
*change_stream*)
echo "TODO CXX-1201, enable for servers that support change streams"
;;
*client_session*)
echo "TODO CXX-1201, enable for servers that support change streams"
;;
*with_transaction*)
echo "TODO CXX-1201, enable for servers that support transactions"
;;
*causal_consistency*)
echo "TODO CXX-1201, enable for servers that support transactions"
;;
*)
${test_params} $test
;;
esac
done
fi
fi
popd # ./build
export CMAKE_PREFIX_PATH=$PREFIX:$(pwd)/build/install
if [ -n "${lib_dir}" ]; then
export PKG_CONFIG_PATH=$PREFIX/${lib_dir}/pkgconfig:$(pwd)/build/install/${lib_dir}/pkgconfig
else
export PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig:$(pwd)/build/install/lib/pkgconfig
fi
export USE_STATIC_LIBS="${USE_STATIC_LIBS}"
export BUILD_TYPE="${build_type}"
export CXXFLAGS="${example_projects_cxxflags}"
export LDFLAGS="${example_projects_ldflags}"
export CC="${example_projects_cc}"
export CXX="${example_projects_cxx}"
export CXX_STANDARD="${example_projects_cxx_standard}"
export CMAKE=${cmake}
if [ "Windows_NT" == "$OS" ]; then
export MSVC=1
elif [ "$(uname -s | tr '[:upper:]' '[:lower:]')" == "darwin" ]; then
export DYLD_LIBRARY_PATH="$(pwd)/build/install/lib:$DYLD_LIBRARY_PATH"
else
if [ -n "${lib_dir}" ]; then # only needed on Linux
export LD_LIBRARY_PATH="$(pwd)/build/install/${lib_dir}:$LD_LIBRARY_PATH"
else
export LD_LIBRARY_PATH="$(pwd)/build/install/lib:$LD_LIBRARY_PATH"
fi
fi
# The example projects never run under valgrind, since we haven't added execution
# logic to handle ${test_params}.
#
# Only run example projects if MONGODB_API_VERSION is unset. We do not append
# API version to example clients, so example projects will fail when requireApiVersion
# is true.
if [[ -z "$MONGODB_API_VERSION" ]]; then
.evergreen/build_example_projects.sh
fi
unset MONGODB_API_VERSION
"test auth":
- command: shell.exec
params:
shell: bash
working_dir: "mongo-cxx-driver"
script: |
export MONGOC_INSTALL_PREFIX=$(pwd)/../mongoc
export MONGOCXX_INSTALL_PREFIX=$(pwd)/build/install
export LIB_DIR=${lib_dir}
export BUILD_TYPE=${build_type}
export BUILD_DIR=$(pwd)/build
export URI="mongodb://bob:pwd123@localhost"
./.evergreen/connect.sh
"test atlas connectivity":
- command: shell.exec
params:
shell: bash
working_dir: "mongo-cxx-driver"
silent: true
script: |
export MONGOC_INSTALL_PREFIX=$(pwd)/../mongoc
export MONGOCXX_INSTALL_PREFIX=$(pwd)/build/install
export LIB_DIR=${lib_dir}
export BUILD_TYPE=${build_type}
export BUILD_DIR=$(pwd)/build
# The atlas_serverless_uri expansion is set in the Evergreen project settings.
export URI="${atlas_serverless_uri}"
./.evergreen/connect.sh
"backtrace":
- command: shell.exec
params:
working_dir: "mongo-cxx-driver"
script: |
./etc/debug-core-evergreen.sh
"upload working dir":
- command: archive.targz_pack
params:
target: "working-dir.tar.gz"
source_dir: "mongo-cxx-driver"
include:
- "./**"
- command: s3.put
params:
aws_key: ${aws_key}
aws_secret: ${aws_secret}
local_file: working-dir.tar.gz
remote_file: mongo-cxx-driver/${build_variant}/${revision}/${version_id}/${build_id}/artifacts/${task_id}-${execution}-working-dir.tar.gz
bucket: mciuploads
permissions: public-read
content_type: ${content_type|application/x-gzip}
display_name: "working-dir.tar.gz"
"upload mongo orchestration artifacts":
- command: shell.exec
params:
working_dir: "."
script: |
find . -name \*.log | xargs tar czf mongodb-logs.tar.gz
- command: s3.put
params:
aws_key: ${aws_key}
aws_secret: ${aws_secret}
local_file: mongodb-logs.tar.gz
remote_file: mongo-cxx-driver/${build_variant}/${revision}/${version_id}/${build_id}/logs/${task_id}-${execution}-mongodb-logs.tar.gz
bucket: mciuploads
permissions: public-read
content_type: ${content_type|application/x-gzip}
display_name: "mongodb-logs.tar.gz"
"upload code coverage":
- command: shell.exec
params:
shell: bash
working_dir: "mongo-cxx-driver"
script: |
# redacted code coverage token
export CODECOV_TOKEN="${codecov_token}"
set -o errexit
set -o pipefail
bash <(curl -s https://codecov.io/bash) || echo "Codecov did not collect coverage reports"
#######################################
# Post Task #
#######################################
post:
- func: "stop_mongod"
- func: "backtrace"
# Workaround for CXX-2040
# - func: "upload working dir"
- func: "upload mongo orchestration artifacts"
- func: "upload code coverage"
#######################################
# Tasks #
#######################################
tasks:
- name: lint
commands:
- func: "setup"
- func: "lint"
- name: clang-tidy
commands:
- func: "setup"
- func: "install_c_driver"
- func: "compile"
- func: "clang-tidy"
- name: compile_and_test_with_shared_libs
commands:
- func: "setup"
- func: "start_mongod"
- func: "install_c_driver"
- func: "compile"
vars:
RUN_DISTCHECK: 1
- func: "clone_drivers-evergreen-tools"
- func: "run_kms_servers"
- func: "test"
- name: compile_and_test_with_shared_libs_extra_alignment
commands:
- func: "setup"
- func: "start_mongod"
- func: "install_c_driver"
vars:
BSON_EXTRA_ALIGNMENT: 1
- func: "compile"
- func: "clone_drivers-evergreen-tools"
- func: "run_kms_servers"
- func: "test"
- name: compile_with_shared_libs
commands:
- func: "setup"
- func: "start_mongod"
- func: "install_c_driver"
- func: "compile"
- name: compile_without_tests
commands:
- func: "setup"
- func: "install_c_driver"
- func: "compile"
vars:
ENABLE_TESTS: OFF
- name: compile_and_test_auth_with_shared_libs
commands:
- func: "setup"
- func: "start_mongod"
vars:
AUTH: auth
- func: "install_c_driver"
- func: "compile"
- func: "test auth"
- func: "test atlas connectivity"
- name: compile_and_test_with_static_libs
commands:
- func: "setup"
- func: "start_mongod"
- func: "install_c_driver"
- func: "compile"
vars:
USE_STATIC_LIBS: 1
RUN_DISTCHECK: 1
- func: "clone_drivers-evergreen-tools"
- func: "run_kms_servers"
- func: "test"
vars:
USE_STATIC_LIBS: 1
- name: compile_and_test_with_static_libs_extra_alignment
commands:
- func: "setup"
- func: "start_mongod"
- func: "install_c_driver"
vars:
BSON_EXTRA_ALIGNMENT: 1
- func: "compile"
vars:
USE_STATIC_LIBS: 1
- func: "clone_drivers-evergreen-tools"
- func: "run_kms_servers"
- func: "test"
vars:
USE_STATIC_LIBS: 1
- name: compile_and_test_with_shared_libs_replica_set
commands:
- func: "setup"
- func: "start_mongod"
vars:
TOPOLOGY: "replica_set"
- func: "install_c_driver"
- func: "compile"
vars:
RUN_DISTCHECK: 1
- func: "clone_drivers-evergreen-tools"
- func: "run_kms_servers"
- func: "test"
- name: uninstall_check
commands:
- func: "setup"
- func: "install_c_driver"
- func: "compile"
- command: expansions.update
params:
updates:
- key: mongocxx_version_finder_sh
value: $(sed -nE 's/^#define MONGOCXX_VERSION_STRING "([^"]+)".*/\1/p' build/src/mongocxx/config/version.hpp)
- command: shell.exec
type: test
params:
shell: bash
working_dir: "mongo-cxx-driver"
script: |-
set -o errexit
export INSTALL_VERSION=${mongocxx_version_finder_sh}
sh ./.evergreen/uninstall_check.sh
- name: uninstall_check_windows
commands:
- func: "setup"
- func: "install_c_driver"
- func: "compile"
- command: expansions.update
params:
updates:
- key: mongocxx_version_finder_sh
value: $(sed -nE 's/^#define MONGOCXX_VERSION_STRING "([^"]+)".*/\1/p' build/src/mongocxx/config/version.hpp)
- command: shell.exec
type: test
params:
shell: bash
working_dir: "mongo-cxx-driver"
script: |-
set -o errexit
export INSTALL_VERSION=${mongocxx_version_finder_sh}
cmd.exe /c .\\.evergreen\\uninstall_check_windows.cmd
- name: build_example_with_add_subdirectory
commands:
- func: "setup"
- func: "start_mongod"
- command: shell.exec
type: test
params:
working_dir: "mongo-cxx-driver"
shell: bash
script: |-
set -o errexit
. .evergreen/find_cmake.sh
cd examples/add_subdirectory
[ -d mongo-c-driver ] || git clone --depth 1 https://github.com/mongodb/mongo-c-driver
rsync -aq --exclude='examples/add_subdirectory' $(readlink -f ../..) .
[ -d build ] || mkdir build
cd build
$CMAKE -DCMAKE_VERBOSE_MAKEFILE=ON ..
$CMAKE --build . -- -j 8
./hello_mongocxx
- name: debian-package-build
commands:
- func: "setup"
- command: shell.exec
type: test
params:
working_dir: "mongo-cxx-driver"
shell: bash
script: |-
set -o errexit
export IS_PATCH="${is_patch}"
sh .evergreen/debian_package_build.sh
- command: s3.put
params:
aws_key: ${aws_key}
aws_secret: ${aws_secret}
local_file: deb.tar.gz
remote_file: mongo-cxx-driver/${branch_name}/${revision}/${version_id}/${build_id}/${execution}/debian-packages.tar.gz
bucket: mciuploads
permissions: public-read
content_type: ${content_type|application/x-gzip}
display_name: "deb.tar.gz"
- name: debian-package-build-mnmlstc
commands:
- func: "setup"
- command: shell.exec
type: test
params:
working_dir: "mongo-cxx-driver"
shell: bash
script: |-
set -o errexit
export IS_PATCH="${is_patch}"
export DEB_BUILD_PROFILES="pkg.mongo-cxx-driver.mnmlstc"
sh .evergreen/debian_package_build.sh
- command: s3.put
params:
aws_key: ${aws_key}
aws_secret: ${aws_secret}
local_file: deb.tar.gz
remote_file: mongo-cxx-driver/${branch_name}/${revision}/${version_id}/${build_id}/${execution}/debian-packages-mnmlstc.tar.gz
bucket: mciuploads
permissions: public-read
content_type: ${content_type|application/x-gzip}
display_name: "deb.tar.gz"
- name: rpm-package-build
commands:
- func: "setup"
- command: shell.exec
type: test
params:
working_dir: "mongo-cxx-driver"
shell: bash
script: |-
set -o errexit
sh .evergreen/build_snapshot_rpm.sh
- command: s3.put
params:
aws_key: ${aws_key}
aws_secret: ${aws_secret}
remote_file: mongo-cxx-driver/${branch_name}/${revision}/${version_id}/${build_id}/${execution}/rpm-packages.tar.gz
bucket: mciuploads
permissions: public-read
local_file: rpm.tar.gz
content_type: ${content_type|application/x-gzip}
- name: test_mongohouse
commands:
- func: "setup"
- func: "install_c_driver"
- func: "compile"
- func: "build_mongohouse"
- func: "run_mongohouse"
- func: "test_mongohouse"
- name: test_versioned_api
commands:
- func: "setup"
- func: "start_mongod"
vars:
REQUIRE_API_VERSION: true
# Authentication with versioned API should already be tested
# in the C driver.
AUTH: noauth
- func: "install_c_driver"
- func: "compile"
- func: "clone_drivers-evergreen-tools"
- func: "run_kms_servers"
- func: "test"