7
7
#
8
8
# ===----------------------------------------------------------------------===##
9
9
10
- set -ex
10
+ set -e
11
11
set -o pipefail
12
12
unset LANG
13
13
unset LC_ALL
@@ -104,12 +104,37 @@ if [ -z "${CMAKE}" ]; then
104
104
fi
105
105
fi
106
106
107
+ function step() {
108
+ endstep
109
+ set +x
110
+ if [[ -v GITHUB_ACTIONS ]]; then
111
+ echo " ::group::$1 "
112
+ export IN_GROUP=1
113
+ else
114
+ echo " --- $1 "
115
+ fi
116
+ set -x
117
+ }
118
+
119
+ function endstep() {
120
+ set +x
121
+ if [[ -v GITHUB_ACTIONS ]] && [[ -v IN_GROUP ]]; then
122
+ echo " ::endgroup::"
123
+ unset IN_GROUP
124
+ fi
125
+ set -x
126
+ }
127
+
128
+ function error() {
129
+ echo " ::error::$1 "
130
+ }
131
+
107
132
function clean() {
108
133
rm -rf " ${BUILD_DIR} "
109
134
}
110
135
111
136
function generate-cmake-base() {
112
- echo " --- Generating CMake"
137
+ step " Generating CMake"
113
138
${CMAKE} \
114
139
-S " ${MONOREPO_ROOT} /runtimes" \
115
140
-B " ${BUILD_DIR} " \
@@ -146,29 +171,32 @@ function generate-cmake-android() {
146
171
}
147
172
148
173
function check-runtimes() {
149
- echo " +++ Running the libc++ tests"
174
+ step " Building libc++ test dependencies"
175
+ ${NINJA} -vC " ${BUILD_DIR} " cxx-test-depends
176
+
177
+ step " Running the libc++ tests"
150
178
${NINJA} -vC " ${BUILD_DIR} " check-cxx
151
179
152
- echo " +++ Running the libc++abi tests"
180
+ step " Running the libc++abi tests"
153
181
${NINJA} -vC " ${BUILD_DIR} " check-cxxabi
154
182
155
- echo " +++ Running the libunwind tests"
183
+ step " Running the libunwind tests"
156
184
${NINJA} -vC " ${BUILD_DIR} " check-unwind
157
185
}
158
186
159
187
# TODO: The goal is to test this against all configurations. We should also move
160
188
# this to the Lit test suite instead of being a separate CMake target.
161
189
function check-abi-list() {
162
- echo " +++ Running the libc++ ABI list test"
190
+ step " Running the libc++ ABI list test"
163
191
${NINJA} -vC " ${BUILD_DIR} " check-cxx-abilist || (
164
- echo " +++ Generating the libc++ ABI list after failed check"
192
+ error " Generating the libc++ ABI list after failed check"
165
193
${NINJA} -vC " ${BUILD_DIR} " generate-cxx-abilist
166
194
false
167
195
)
168
196
}
169
197
170
198
function check-cxx-benchmarks() {
171
- echo " --- Running the benchmarks"
199
+ step " Running the benchmarks"
172
200
${NINJA} -vC " ${BUILD_DIR} " check-cxx-benchmarks
173
201
}
174
202
@@ -178,12 +206,13 @@ function test-armv7m-picolibc() {
178
206
# To make it easier to get this builder up and running, build picolibc
179
207
# from scratch. Anecdotally, the build-picolibc script takes about 16 seconds.
180
208
# This could be optimised by building picolibc into the Docker container.
209
+ step " Building picolibc from source"
181
210
${MONOREPO_ROOT} /libcxx/utils/ci/build-picolibc.sh \
182
211
--build-dir " ${BUILD_DIR} " \
183
212
--install-dir " ${INSTALL_DIR} " \
184
213
--target armv7m-none-eabi
185
214
186
- echo " --- Generating CMake"
215
+ step " Generating CMake for compiler-rt "
187
216
flags=" --sysroot=${INSTALL_DIR} "
188
217
${CMAKE} \
189
218
-S " ${MONOREPO_ROOT} /compiler-rt" \
@@ -195,6 +224,8 @@ function test-armv7m-picolibc() {
195
224
-DCMAKE_CXX_FLAGS=" ${flags} " \
196
225
-DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON \
197
226
" ${@ } "
227
+
228
+ step " Generating CMake for libc++"
198
229
generate-cmake \
199
230
-DLIBCXX_TEST_CONFIG=" armv7m-picolibc-libc++.cfg.in" \
200
231
-DLIBCXXABI_TEST_CONFIG=" armv7m-picolibc-libc++abi.cfg.in" \
@@ -203,6 +234,7 @@ function test-armv7m-picolibc() {
203
234
-DCMAKE_CXX_FLAGS=" ${flags} " \
204
235
" ${@ } "
205
236
237
+ step " Installing compiler-rt"
206
238
${NINJA} -vC " ${BUILD_DIR} /compiler-rt" install
207
239
208
240
# Prior to clang 19, armv7m-none-eabi normalised to armv7m-none-unknown-eabi.
@@ -216,9 +248,9 @@ function test-armv7m-picolibc() {
216
248
}
217
249
218
250
# Print the version of a few tools to aid diagnostics in some cases
251
+ step " Diagnose tools in use"
219
252
${CMAKE} --version
220
253
${NINJA} --version
221
-
222
254
if [ ! -z " ${CXX} " ]; then ${CXX} --version; fi
223
255
224
256
case " ${BUILDER} " in
@@ -228,10 +260,9 @@ check-generated-output)
228
260
clean
229
261
generate-cmake
230
262
231
- set +x # Printing all the commands below just creates extremely confusing output
232
-
233
263
# Reject patches that forgot to re-run the generator scripts.
234
- echo " +++ Making sure the generator scripts were run"
264
+ step " Making sure the generator scripts were run"
265
+ set +x # Printing all the commands below just creates extremely confusing output
235
266
${NINJA} -vC " ${BUILD_DIR} " libcxx-generate-files
236
267
git diff | tee ${BUILD_DIR} /generated_output.patch
237
268
git ls-files -o --exclude-standard | tee ${BUILD_DIR} /generated_output.status
@@ -243,9 +274,8 @@ check-generated-output)
243
274
false
244
275
fi
245
276
246
- # Reject patches that introduce non-ASCII characters or hard tabs.
247
- # Depends on LC_COLLATE set at the top of this script.
248
- set -x
277
+ # This depends on LC_COLLATE set at the top of this script.
278
+ step " Reject patches that introduce non-ASCII characters or hard tabs."
249
279
! grep -rn ' [^ -~]' libcxx/include libcxx/src libcxx/test libcxx/benchmarks \
250
280
--exclude ' *.dat' \
251
281
--exclude ' *unicode*.cpp' \
@@ -353,7 +383,7 @@ generic-ubsan)
353
383
bootstrapping-build)
354
384
clean
355
385
356
- echo " --- Generating CMake"
386
+ step " Generating CMake"
357
387
${CMAKE} \
358
388
-S " ${MONOREPO_ROOT} /llvm" \
359
389
-B " ${BUILD_DIR} " \
@@ -370,14 +400,14 @@ bootstrapping-build)
370
400
-DLLVM_ENABLE_ASSERTIONS=ON \
371
401
-DLLVM_LIT_ARGS=" -sv --xunit-xml-output test-results.xml --timeout=1500 --time-tests"
372
402
373
- echo " +++ Running the LLDB libc++ data formatter tests"
403
+ step " Running the LLDB libc++ data formatter tests"
374
404
${NINJA} -vC " ${BUILD_DIR} " lldb-api-test-deps
375
405
${BUILD_DIR} /bin/llvm-lit -sv --param dotest-args=' --category libc++' " ${MONOREPO_ROOT} /lldb/test/API"
376
406
377
- echo " --- Running the libc++ and libc++abi tests"
407
+ step " Running the libc++ and libc++abi tests"
378
408
${NINJA} -vC " ${BUILD_DIR} " check-runtimes
379
409
380
- echo " +++ Installing libc++ and libc++abi to a fake location"
410
+ step " Installing libc++ and libc++abi to a fake location"
381
411
${NINJA} -vC " ${BUILD_DIR} " install-runtimes
382
412
383
413
ccache -s
@@ -510,6 +540,7 @@ generic-optimized-speed)
510
540
apple-configuration)
511
541
clean
512
542
543
+ step " Installing libc++ with the Apple system configuration"
513
544
arch=" $( uname -m) "
514
545
xcrun --sdk macosx \
515
546
${MONOREPO_ROOT} /libcxx/utils/ci/apple-install-libcxx.sh \
@@ -520,6 +551,7 @@ apple-configuration)
520
551
--architectures " ${arch} " \
521
552
--version " 999.99"
522
553
554
+ step " Running tests against Apple-configured libc++"
523
555
# TODO: It would be better to run the tests against the fake-installed version of libc++ instead
524
556
xcrun --sdk macosx ninja -vC " ${BUILD_DIR} /${arch} " check-cxx check-cxxabi check-cxx-abilist
525
557
;;
@@ -532,6 +564,7 @@ apple-system-hardened)
532
564
params+=" ;hardening_mode=fast"
533
565
534
566
# In the Apple system configuration, we build libc++ and libunwind separately.
567
+ step " Installing libc++ and libc++abi in Apple-system configuration"
535
568
${CMAKE} \
536
569
-S " ${MONOREPO_ROOT} /runtimes" \
537
570
-B " ${BUILD_DIR} /cxx" \
@@ -547,6 +580,7 @@ apple-system-hardened)
547
580
-DLIBCXX_TEST_PARAMS=" ${params} " \
548
581
-DLIBCXXABI_TEST_PARAMS=" ${params} "
549
582
583
+ step " Installing libunwind in Apple-system configuration"
550
584
${CMAKE} \
551
585
-S " ${MONOREPO_ROOT} /runtimes" \
552
586
-B " ${BUILD_DIR} /unwind" \
@@ -559,13 +593,13 @@ apple-system-hardened)
559
593
-DLIBUNWIND_TEST_PARAMS=" ${params} " \
560
594
-DCMAKE_INSTALL_NAME_DIR=" /usr/lib/system"
561
595
562
- echo " +++ Running the libc++ tests"
596
+ step " Running the libc++ tests"
563
597
${NINJA} -vC " ${BUILD_DIR} /cxx" check-cxx
564
598
565
- echo " +++ Running the libc++abi tests"
599
+ step " Running the libc++abi tests"
566
600
${NINJA} -vC " ${BUILD_DIR} /cxx" check-cxxabi
567
601
568
- echo " +++ Running the libunwind tests"
602
+ step " Running the libunwind tests"
569
603
${NINJA} -vC " ${BUILD_DIR} /unwind" check-unwind
570
604
;;
571
605
apple-system)
@@ -576,6 +610,7 @@ apple-system)
576
610
params=" target_triple=${arch} -apple-macosx${version} "
577
611
578
612
# In the Apple system configuration, we build libc++ and libunwind separately.
613
+ step " Installing libc++ and libc++abi in Apple-system configuration"
579
614
${CMAKE} \
580
615
-S " ${MONOREPO_ROOT} /runtimes" \
581
616
-B " ${BUILD_DIR} /cxx" \
@@ -591,6 +626,7 @@ apple-system)
591
626
-DLIBCXX_TEST_PARAMS=" ${params} " \
592
627
-DLIBCXXABI_TEST_PARAMS=" ${params} "
593
628
629
+ step " Installing libunwind in Apple-system configuration"
594
630
${CMAKE} \
595
631
-S " ${MONOREPO_ROOT} /runtimes" \
596
632
-B " ${BUILD_DIR} /unwind" \
@@ -603,13 +639,13 @@ apple-system)
603
639
-DLIBUNWIND_TEST_PARAMS=" ${params} " \
604
640
-DCMAKE_INSTALL_NAME_DIR=" /usr/lib/system"
605
641
606
- echo " +++ Running the libc++ tests"
642
+ step " Running the libc++ tests"
607
643
${NINJA} -vC " ${BUILD_DIR} /cxx" check-cxx
608
644
609
- echo " +++ Running the libc++abi tests"
645
+ step " Running the libc++abi tests"
610
646
${NINJA} -vC " ${BUILD_DIR} /cxx" check-cxxabi
611
647
612
- echo " +++ Running the libunwind tests"
648
+ step " Running the libunwind tests"
613
649
${NINJA} -vC " ${BUILD_DIR} /unwind" check-unwind
614
650
;;
615
651
benchmarks)
@@ -672,13 +708,13 @@ clang-cl-dll)
672
708
# anyway), thus just disable the experimental library. Remove this
673
709
# setting when cmake and the test driver does the right thing automatically.
674
710
generate-cmake-libcxx-win -DLIBCXX_TEST_PARAMS=" enable_experimental=False"
675
- echo " +++ Running the libc++ tests"
711
+ step " Running the libc++ tests"
676
712
${NINJA} -vC " ${BUILD_DIR} " check-cxx
677
713
;;
678
714
clang-cl-static)
679
715
clean
680
716
generate-cmake-libcxx-win -DLIBCXX_ENABLE_SHARED=OFF
681
- echo " +++ Running the libc++ tests"
717
+ step " Running the libc++ tests"
682
718
${NINJA} -vC " ${BUILD_DIR} " check-cxx
683
719
;;
684
720
clang-cl-no-vcruntime)
@@ -689,14 +725,14 @@ clang-cl-no-vcruntime)
689
725
# exceptions enabled.
690
726
generate-cmake-libcxx-win -DLIBCXX_TEST_PARAMS=" enable_experimental=False" \
691
727
-DLIBCXX_TEST_CONFIG=" llvm-libc++-shared-no-vcruntime-clangcl.cfg.in"
692
- echo " +++ Running the libc++ tests"
728
+ step " Running the libc++ tests"
693
729
${NINJA} -vC " ${BUILD_DIR} " check-cxx
694
730
;;
695
731
clang-cl-debug)
696
732
clean
697
733
generate-cmake-libcxx-win -DLIBCXX_TEST_PARAMS=" enable_experimental=False" \
698
734
-DCMAKE_BUILD_TYPE=Debug
699
- echo " +++ Running the libc++ tests"
735
+ step " Running the libc++ tests"
700
736
${NINJA} -vC " ${BUILD_DIR} " check-cxx
701
737
;;
702
738
clang-cl-static-crt)
@@ -705,7 +741,7 @@ clang-cl-static-crt)
705
741
# the static CRT, as opposed to "MultiThreadedDLL" which is the default).
706
742
generate-cmake-libcxx-win -DLIBCXX_ENABLE_SHARED=OFF \
707
743
-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded
708
- echo " +++ Running the libc++ tests"
744
+ step " Running the libc++ tests"
709
745
${NINJA} -vC " ${BUILD_DIR} " check-cxx
710
746
;;
711
747
mingw-dll)
@@ -751,6 +787,7 @@ mingw-incomplete-sysroot)
751
787
-C " ${MONOREPO_ROOT} /libcxx/cmake/caches/MinGW.cmake"
752
788
# Only test that building succeeds; there's not much extra value in running
753
789
# the tests here, as it would be equivalent to the mingw-dll config above.
790
+ step " Building the runtimes"
754
791
${NINJA} -vC " ${BUILD_DIR} "
755
792
;;
756
793
aix)
@@ -768,7 +805,7 @@ android-ndk-*)
768
805
ANDROID_EMU_IMG=" ${BUILDER# android-ndk-} "
769
806
. " ${MONOREPO_ROOT} /libcxx/utils/ci/vendor/android/emulator-functions.sh"
770
807
if ! validate_emu_img " ${ANDROID_EMU_IMG} " ; then
771
- echo " error: android-ndk suffix must be a valid emulator image (${ANDROID_EMU_IMG} )" >&2
808
+ error " android-ndk suffix must be a valid emulator image (${ANDROID_EMU_IMG} )" >&2
772
809
exit 1
773
810
fi
774
811
ARCH=$( arch_of_emu_img ${ANDROID_EMU_IMG} )
@@ -800,9 +837,9 @@ android-ndk-*)
800
837
# directories.
801
838
adb shell mkdir -p /data/local/tmp/adb_run
802
839
adb push " ${BUILD_DIR} /lib/libc++_shared.so" /data/local/tmp/libc++/libc++_shared.so
803
- echo " +++ Running the libc++ tests"
840
+ step " Running the libc++ tests"
804
841
${NINJA} -vC " ${BUILD_DIR} " check-cxx
805
- echo " +++ Running the libc++abi tests"
842
+ step " Running the libc++abi tests"
806
843
${NINJA} -vC " ${BUILD_DIR} " check-cxxabi
807
844
;;
808
845
# ################################################################
@@ -818,3 +855,5 @@ android-ndk-*)
818
855
exit 1
819
856
;;
820
857
esac
858
+
859
+ endstep # Make sure we close any still-open output group
0 commit comments