Skip to content

Commit 96f382d

Browse files
committed
Defer standard output to failure for examples
1 parent 791afaa commit 96f382d

File tree

2 files changed

+35
-10
lines changed

2 files changed

+35
-10
lines changed

.evergreen/build_example_projects.sh

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,22 @@ cd examples/projects
1616
for project in bsoncxx mongocxx; do
1717
(
1818
cd $project
19-
( cd cmake/$DIR && ./build.sh )
20-
( cd cmake-deprecated/$DIR && ./build.sh )
19+
20+
if ! ( cd cmake/$DIR && ./build.sh >|output.txt 2>&1); then
21+
cat output.txt 1>&2
22+
exit 1
23+
fi
24+
25+
if ! ( cd cmake-deprecated/$DIR && ./build.sh >|output.txt 2>&1); then
26+
cat output.txt 1>&2
27+
exit 1
28+
fi
29+
2130
if [ "Windows_NT" != "$OS" ]; then
22-
( cd pkg-config/$DIR && ./build.sh )
31+
if ! ( cd pkg-config/$DIR && ./build.sh >|output.txt 2>&1); then
32+
cat output.txt 1>&2
33+
exit 1
34+
fi
2335
fi
2436
)
2537
done

.mci.yml

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,13 @@ functions:
523523
# API version to example clients, so examples will fail when requireApiVersion
524524
# is true.
525525
if [[ -z "$MONGODB_API_VERSION" ]]; then
526-
CTEST_OUTPUT_ON_FAILURE=1 MSBuild.exe /p:Configuration=${build_type} /verbosity:minimal examples/run-examples.vcxproj
526+
echo "Running examples..."
527+
if ! CTEST_OUTPUT_ON_FAILURE=1 MSBuild.exe /p:Configuration=${build_type} /verbosity:minimal examples/run-examples.vcxproj >|output.txt 2>&1; then
528+
# Only emit output on failure.
529+
cat output.txt 1>&2
530+
exit 1
531+
fi
532+
echo "Running examples... done."
527533
fi
528534
else
529535
# 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.
@@ -567,24 +573,29 @@ functions:
567573
# is true.
568574
if [[ -z "$MONGODB_API_VERSION" ]]; then
569575
for test in $EXAMPLES; do
576+
echo "Running example $test"
570577
case "$test" in
571578
*encryption*)
572-
echo "Skipping client side encryption example"
579+
echo " - Skipping client side encryption example"
573580
;;
574581
*change_stream*)
575-
echo "TODO CXX-1201, enable for servers that support change streams"
582+
echo " - TODO CXX-1201, enable for servers that support change streams"
576583
;;
577584
*client_session*)
578-
echo "TODO CXX-1201, enable for servers that support change streams"
585+
echo " - TODO CXX-1201, enable for servers that support change streams"
579586
;;
580587
*with_transaction*)
581-
echo "TODO CXX-1201, enable for servers that support transactions"
588+
echo " - TODO CXX-1201, enable for servers that support transactions"
582589
;;
583590
*causal_consistency*)
584-
echo "TODO CXX-1201, enable for servers that support transactions"
591+
echo " - TODO CXX-1201, enable for servers that support transactions"
585592
;;
586593
*)
587-
${test_params} $test
594+
if ! ${test_params} $test >|output.txt 2>&1; then
595+
# Only emit output on failure.
596+
cat output.txt 1>&2
597+
exit 1
598+
fi
588599
;;
589600
esac
590601
done
@@ -626,7 +637,9 @@ functions:
626637
# API version to example clients, so example projects will fail when requireApiVersion
627638
# is true.
628639
if [[ -z "$MONGODB_API_VERSION" ]]; then
640+
echo "Building example projects..."
629641
.evergreen/build_example_projects.sh
642+
echo "Building example projects... done."
630643
fi
631644
unset MONGODB_API_VERSION
632645

0 commit comments

Comments
 (0)