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
@@ -96,12 +96,37 @@ if [ -z "${CMAKE}" ]; then
96
96
fi
97
97
fi
98
98
99
+ function step() {
100
+ endstep
101
+ set +x
102
+ if [[ ! -z ${GITHUB_ACTIONS+x} ]]; then
103
+ echo " ::group::$1 "
104
+ export IN_GROUP=1
105
+ else
106
+ echo " --- $1 "
107
+ fi
108
+ set -x
109
+ }
110
+
111
+ function endstep() {
112
+ set +x
113
+ if [[ ! -z ${GITHUB_ACTIONS+x} ]] && [[ ! -z ${IN_GROUP+x} ]]; then
114
+ echo " ::endgroup::"
115
+ unset IN_GROUP
116
+ fi
117
+ set -x
118
+ }
119
+
120
+ function error() {
121
+ echo " ::error::$1 "
122
+ }
123
+
99
124
function clean() {
100
125
rm -rf " ${BUILD_DIR} "
101
126
}
102
127
103
128
function generate-cmake-base() {
104
- echo " --- Generating CMake"
129
+ step " Generating CMake"
105
130
${CMAKE} \
106
131
-S " ${MONOREPO_ROOT} /runtimes" \
107
132
-B " ${BUILD_DIR} " \
@@ -138,29 +163,32 @@ function generate-cmake-android() {
138
163
}
139
164
140
165
function check-runtimes() {
141
- echo " +++ Running the libc++ tests"
166
+ step " Building libc++ test dependencies"
167
+ ${NINJA} -vC " ${BUILD_DIR} " cxx-test-depends
168
+
169
+ step " Running the libc++ tests"
142
170
${NINJA} -vC " ${BUILD_DIR} " check-cxx
143
171
144
- echo " +++ Running the libc++abi tests"
172
+ step " Running the libc++abi tests"
145
173
${NINJA} -vC " ${BUILD_DIR} " check-cxxabi
146
174
147
- echo " +++ Running the libunwind tests"
175
+ step " Running the libunwind tests"
148
176
${NINJA} -vC " ${BUILD_DIR} " check-unwind
149
177
}
150
178
151
179
# TODO: The goal is to test this against all configurations. We should also move
152
180
# this to the Lit test suite instead of being a separate CMake target.
153
181
function check-abi-list() {
154
- echo " +++ Running the libc++ ABI list test"
182
+ step " Running the libc++ ABI list test"
155
183
${NINJA} -vC " ${BUILD_DIR} " check-cxx-abilist || (
156
- echo " +++ Generating the libc++ ABI list after failed check"
184
+ error " Generating the libc++ ABI list after failed check"
157
185
${NINJA} -vC " ${BUILD_DIR} " generate-cxx-abilist
158
186
false
159
187
)
160
188
}
161
189
162
190
function check-cxx-benchmarks() {
163
- echo " --- Running the benchmarks"
191
+ step " Running the benchmarks"
164
192
${NINJA} -vC " ${BUILD_DIR} " check-cxx-benchmarks
165
193
}
166
194
@@ -170,12 +198,13 @@ function test-armv7m-picolibc() {
170
198
# To make it easier to get this builder up and running, build picolibc
171
199
# from scratch. Anecdotally, the build-picolibc script takes about 16 seconds.
172
200
# This could be optimised by building picolibc into the Docker container.
201
+ step " Building picolibc from source"
173
202
${MONOREPO_ROOT} /libcxx/utils/ci/build-picolibc.sh \
174
203
--build-dir " ${BUILD_DIR} " \
175
204
--install-dir " ${INSTALL_DIR} " \
176
205
--target armv7m-none-eabi
177
206
178
- echo " --- Generating CMake"
207
+ step " Generating CMake for compiler-rt "
179
208
flags=" --sysroot=${INSTALL_DIR} "
180
209
${CMAKE} \
181
210
-S " ${MONOREPO_ROOT} /compiler-rt" \
@@ -187,6 +216,8 @@ function test-armv7m-picolibc() {
187
216
-DCMAKE_CXX_FLAGS=" ${flags} " \
188
217
-DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON \
189
218
" ${@ } "
219
+
220
+ step " Generating CMake for libc++"
190
221
generate-cmake \
191
222
-DLIBCXX_TEST_CONFIG=" armv7m-picolibc-libc++.cfg.in" \
192
223
-DLIBCXXABI_TEST_CONFIG=" armv7m-picolibc-libc++abi.cfg.in" \
@@ -195,6 +226,7 @@ function test-armv7m-picolibc() {
195
226
-DCMAKE_CXX_FLAGS=" ${flags} " \
196
227
" ${@ } "
197
228
229
+ step " Installing compiler-rt"
198
230
${NINJA} -vC " ${BUILD_DIR} /compiler-rt" install
199
231
200
232
# Prior to clang 19, armv7m-none-eabi normalised to armv7m-none-unknown-eabi.
@@ -208,9 +240,9 @@ function test-armv7m-picolibc() {
208
240
}
209
241
210
242
# Print the version of a few tools to aid diagnostics in some cases
243
+ step " Diagnose tools in use"
211
244
${CMAKE} --version
212
245
${NINJA} --version
213
-
214
246
if [ ! -z " ${CXX} " ]; then ${CXX} --version; fi
215
247
216
248
case " ${BUILDER} " in
@@ -220,10 +252,9 @@ check-generated-output)
220
252
clean
221
253
generate-cmake
222
254
223
- set +x # Printing all the commands below just creates extremely confusing output
224
-
225
255
# Reject patches that forgot to re-run the generator scripts.
226
- echo " +++ Making sure the generator scripts were run"
256
+ step " Making sure the generator scripts were run"
257
+ set +x # Printing all the commands below just creates extremely confusing output
227
258
${NINJA} -vC " ${BUILD_DIR} " libcxx-generate-files
228
259
git diff | tee ${BUILD_DIR} /generated_output.patch
229
260
git ls-files -o --exclude-standard | tee ${BUILD_DIR} /generated_output.status
@@ -235,9 +266,8 @@ check-generated-output)
235
266
false
236
267
fi
237
268
238
- # Reject patches that introduce non-ASCII characters or hard tabs.
239
- # Depends on LC_COLLATE set at the top of this script.
240
- set -x
269
+ # This depends on LC_COLLATE set at the top of this script.
270
+ step " Reject patches that introduce non-ASCII characters or hard tabs."
241
271
! grep -rn ' [^ -~]' libcxx/include libcxx/src libcxx/test \
242
272
--exclude ' *.dat' \
243
273
--exclude ' *unicode*.cpp' \
@@ -345,7 +375,7 @@ generic-ubsan)
345
375
bootstrapping-build)
346
376
clean
347
377
348
- echo " --- Generating CMake"
378
+ step " Generating CMake"
349
379
${CMAKE} \
350
380
-S " ${MONOREPO_ROOT} /llvm" \
351
381
-B " ${BUILD_DIR} " \
@@ -362,14 +392,14 @@ bootstrapping-build)
362
392
-DLLVM_ENABLE_ASSERTIONS=ON \
363
393
-DLLVM_LIT_ARGS=" -sv --xunit-xml-output test-results.xml --timeout=1500 --time-tests"
364
394
365
- echo " +++ Running the LLDB libc++ data formatter tests"
395
+ step " Running the LLDB libc++ data formatter tests"
366
396
${NINJA} -vC " ${BUILD_DIR} " lldb-api-test-deps
367
397
${BUILD_DIR} /bin/llvm-lit -sv --param dotest-args=' --category libc++' " ${MONOREPO_ROOT} /lldb/test/API"
368
398
369
- echo " --- Running the libc++ and libc++abi tests"
399
+ step " Running the libc++ and libc++abi tests"
370
400
${NINJA} -vC " ${BUILD_DIR} " check-runtimes
371
401
372
- echo " +++ Installing libc++ and libc++abi to a fake location"
402
+ step " Installing libc++ and libc++abi to a fake location"
373
403
${NINJA} -vC " ${BUILD_DIR} " install-runtimes
374
404
375
405
ccache -s
@@ -502,6 +532,7 @@ generic-optimized-speed)
502
532
apple-configuration)
503
533
clean
504
534
535
+ step " Installing libc++ with the Apple system configuration"
505
536
arch=" $( uname -m) "
506
537
xcrun --sdk macosx \
507
538
${MONOREPO_ROOT} /libcxx/utils/ci/apple-install-libcxx.sh \
@@ -512,6 +543,7 @@ apple-configuration)
512
543
--architectures " ${arch} " \
513
544
--version " 999.99"
514
545
546
+ step " Running tests against Apple-configured libc++"
515
547
# TODO: It would be better to run the tests against the fake-installed version of libc++ instead
516
548
xcrun --sdk macosx ninja -vC " ${BUILD_DIR} /${arch} " check-cxx check-cxxabi check-cxx-abilist
517
549
;;
@@ -524,6 +556,7 @@ apple-system-hardened)
524
556
params+=" ;hardening_mode=fast"
525
557
526
558
# In the Apple system configuration, we build libc++ and libunwind separately.
559
+ step " Installing libc++ and libc++abi in Apple-system configuration"
527
560
${CMAKE} \
528
561
-S " ${MONOREPO_ROOT} /runtimes" \
529
562
-B " ${BUILD_DIR} /cxx" \
@@ -539,6 +572,7 @@ apple-system-hardened)
539
572
-DLIBCXX_TEST_PARAMS=" ${params} " \
540
573
-DLIBCXXABI_TEST_PARAMS=" ${params} "
541
574
575
+ step " Installing libunwind in Apple-system configuration"
542
576
${CMAKE} \
543
577
-S " ${MONOREPO_ROOT} /runtimes" \
544
578
-B " ${BUILD_DIR} /unwind" \
@@ -551,13 +585,13 @@ apple-system-hardened)
551
585
-DLIBUNWIND_TEST_PARAMS=" ${params} " \
552
586
-DCMAKE_INSTALL_NAME_DIR=" /usr/lib/system"
553
587
554
- echo " +++ Running the libc++ tests"
588
+ step " Running the libc++ tests"
555
589
${NINJA} -vC " ${BUILD_DIR} /cxx" check-cxx
556
590
557
- echo " +++ Running the libc++abi tests"
591
+ step " Running the libc++abi tests"
558
592
${NINJA} -vC " ${BUILD_DIR} /cxx" check-cxxabi
559
593
560
- echo " +++ Running the libunwind tests"
594
+ step " Running the libunwind tests"
561
595
${NINJA} -vC " ${BUILD_DIR} /unwind" check-unwind
562
596
;;
563
597
apple-system)
@@ -568,6 +602,7 @@ apple-system)
568
602
params=" target_triple=${arch} -apple-macosx${version} "
569
603
570
604
# In the Apple system configuration, we build libc++ and libunwind separately.
605
+ step " Installing libc++ and libc++abi in Apple-system configuration"
571
606
${CMAKE} \
572
607
-S " ${MONOREPO_ROOT} /runtimes" \
573
608
-B " ${BUILD_DIR} /cxx" \
@@ -583,6 +618,7 @@ apple-system)
583
618
-DLIBCXX_TEST_PARAMS=" ${params} " \
584
619
-DLIBCXXABI_TEST_PARAMS=" ${params} "
585
620
621
+ step " Installing libunwind in Apple-system configuration"
586
622
${CMAKE} \
587
623
-S " ${MONOREPO_ROOT} /runtimes" \
588
624
-B " ${BUILD_DIR} /unwind" \
@@ -595,13 +631,13 @@ apple-system)
595
631
-DLIBUNWIND_TEST_PARAMS=" ${params} " \
596
632
-DCMAKE_INSTALL_NAME_DIR=" /usr/lib/system"
597
633
598
- echo " +++ Running the libc++ tests"
634
+ step " Running the libc++ tests"
599
635
${NINJA} -vC " ${BUILD_DIR} /cxx" check-cxx
600
636
601
- echo " +++ Running the libc++abi tests"
637
+ step " Running the libc++abi tests"
602
638
${NINJA} -vC " ${BUILD_DIR} /cxx" check-cxxabi
603
639
604
- echo " +++ Running the libunwind tests"
640
+ step " Running the libunwind tests"
605
641
${NINJA} -vC " ${BUILD_DIR} /unwind" check-unwind
606
642
;;
607
643
benchmarks)
@@ -664,13 +700,13 @@ clang-cl-dll)
664
700
# anyway), thus just disable the experimental library. Remove this
665
701
# setting when cmake and the test driver does the right thing automatically.
666
702
generate-cmake-libcxx-win -DLIBCXX_TEST_PARAMS=" enable_experimental=False"
667
- echo " +++ Running the libc++ tests"
703
+ step " Running the libc++ tests"
668
704
${NINJA} -vC " ${BUILD_DIR} " check-cxx
669
705
;;
670
706
clang-cl-static)
671
707
clean
672
708
generate-cmake-libcxx-win -DLIBCXX_ENABLE_SHARED=OFF
673
- echo " +++ Running the libc++ tests"
709
+ step " Running the libc++ tests"
674
710
${NINJA} -vC " ${BUILD_DIR} " check-cxx
675
711
;;
676
712
clang-cl-no-vcruntime)
@@ -681,14 +717,14 @@ clang-cl-no-vcruntime)
681
717
# exceptions enabled.
682
718
generate-cmake-libcxx-win -DLIBCXX_TEST_PARAMS=" enable_experimental=False" \
683
719
-DLIBCXX_TEST_CONFIG=" llvm-libc++-shared-no-vcruntime-clangcl.cfg.in"
684
- echo " +++ Running the libc++ tests"
720
+ step " Running the libc++ tests"
685
721
${NINJA} -vC " ${BUILD_DIR} " check-cxx
686
722
;;
687
723
clang-cl-debug)
688
724
clean
689
725
generate-cmake-libcxx-win -DLIBCXX_TEST_PARAMS=" enable_experimental=False" \
690
726
-DCMAKE_BUILD_TYPE=Debug
691
- echo " +++ Running the libc++ tests"
727
+ step " Running the libc++ tests"
692
728
${NINJA} -vC " ${BUILD_DIR} " check-cxx
693
729
;;
694
730
clang-cl-static-crt)
@@ -697,7 +733,7 @@ clang-cl-static-crt)
697
733
# the static CRT, as opposed to "MultiThreadedDLL" which is the default).
698
734
generate-cmake-libcxx-win -DLIBCXX_ENABLE_SHARED=OFF \
699
735
-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded
700
- echo " +++ Running the libc++ tests"
736
+ step " Running the libc++ tests"
701
737
${NINJA} -vC " ${BUILD_DIR} " check-cxx
702
738
;;
703
739
mingw-dll)
@@ -743,6 +779,7 @@ mingw-incomplete-sysroot)
743
779
-C " ${MONOREPO_ROOT} /libcxx/cmake/caches/MinGW.cmake"
744
780
# Only test that building succeeds; there's not much extra value in running
745
781
# the tests here, as it would be equivalent to the mingw-dll config above.
782
+ step " Building the runtimes"
746
783
${NINJA} -vC " ${BUILD_DIR} "
747
784
;;
748
785
aix)
@@ -760,7 +797,7 @@ android-ndk-*)
760
797
ANDROID_EMU_IMG=" ${BUILDER# android-ndk-} "
761
798
. " ${MONOREPO_ROOT} /libcxx/utils/ci/vendor/android/emulator-functions.sh"
762
799
if ! validate_emu_img " ${ANDROID_EMU_IMG} " ; then
763
- echo " error: android-ndk suffix must be a valid emulator image (${ANDROID_EMU_IMG} )" >&2
800
+ error " android-ndk suffix must be a valid emulator image (${ANDROID_EMU_IMG} )" >&2
764
801
exit 1
765
802
fi
766
803
ARCH=$( arch_of_emu_img ${ANDROID_EMU_IMG} )
@@ -792,9 +829,9 @@ android-ndk-*)
792
829
# directories.
793
830
adb shell mkdir -p /data/local/tmp/adb_run
794
831
adb push " ${BUILD_DIR} /lib/libc++_shared.so" /data/local/tmp/libc++/libc++_shared.so
795
- echo " +++ Running the libc++ tests"
832
+ step " Running the libc++ tests"
796
833
${NINJA} -vC " ${BUILD_DIR} " check-cxx
797
- echo " +++ Running the libc++abi tests"
834
+ step " Running the libc++abi tests"
798
835
${NINJA} -vC " ${BUILD_DIR} " check-cxxabi
799
836
;;
800
837
# ################################################################
@@ -810,3 +847,5 @@ android-ndk-*)
810
847
exit 1
811
848
;;
812
849
esac
850
+
851
+ endstep # Make sure we close any still-open output group
0 commit comments