Skip to content

Commit 1a9d4ac

Browse files
committed
esp/ci: Add package tests
1 parent 256abfe commit 1a9d4ac

File tree

1 file changed

+54
-39
lines changed

1 file changed

+54
-39
lines changed

.gitlab-ci.yml

Lines changed: 54 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ before_script:
4646
TARGET: "Xtensa;RISCV"
4747
USE_LINKER: "ld"
4848
CROSS_BUILD_MINGW: "OFF"
49+
BUILD_TARGET_LIBS: "OFF"
4950
RUN_CORE_TESTS: "OFF"
51+
RUN_PKG_TESTS: "OFF"
5052
RUN_TARGET_LIB_TESTS: "OFF"
5153
PACK_TOOLCHAIN: "ON"
5254
PACK_STANDALONE_LIBS: "ON"
@@ -59,6 +61,7 @@ before_script:
5961
[ ! -f "${BUILD_DIR}/tests.log" ] || grep -i "internal compiler error\|Killed" ${BUILD_DIR}/tests.log || true
6062
[ ! -f "${BUILD_DIR}/compiler-rt-tests.log" ] || grep -i "internal compiler error\|Killed" ${BUILD_DIR}/compiler-rt-tests.log || true
6163
[ ! -f "${BUILD_DIR}/lld-tests.log" ] || grep -i "internal compiler error\|Killed" ${BUILD_DIR}/lld-tests.log || true
64+
[ ! -f "${BUILD_DIR}/pkg-tests.log" ] || grep -i "internal compiler error\|Killed" ${BUILD_DIR}/pkg-tests.log || true
6265
fi
6366
script:
6467
- *get_toolchain_build_scripts
@@ -72,7 +75,7 @@ before_script:
7275
# Re-use core tools built in another job.
7376
# LLVM-xxx
7477
- >
75-
if [ "${PACK_TARGET_LIBS}" == "ON" ]; then
78+
if [ "${PACK_TARGET_LIBS}" == "ON" ] || [ "${BUILD_TARGET_LIBS}" == "ON" ]; then
7679
echo "Enable target libraries build"
7780
export USE_LIBC="newlib";
7881
export USE_LIBCXX="libstdcxx";
@@ -134,6 +137,15 @@ before_script:
134137
chmod o+w ${BUILD_PATH}/compiler-rt-tests.log;
135138
runuser -u test_runner -- ninja -C ${BUILD_PATH} check-compiler-rt 2>&1 > ${BUILD_PATH}/compiler-rt-tests.log;
136139
fi
140+
if [[ "${RUN_PKG_TESTS}" == "ON" ]]; then
141+
echo "Run package tests";
142+
# to avoid test failure "fatal: detected dubious ownership in repository at '/builds/llvm-project'"
143+
chown -R test_runner $LLVM_PROJECT_PATH;
144+
touch ${BUILD_PATH}/pkg-tests.log;
145+
chmod o+w ${BUILD_PATH}/pkg-tests.log;
146+
runuser -u test_runner -- ninja -C ${BUILD_PATH} check-package-llvm-toolchain 2>&1 > ${BUILD_PATH}/pkg-tests.log;
147+
chown -R ${CUR_USER} $LLVM_PROJECT_PATH;
148+
fi
137149
chown -R ${CUR_USER} ${BUILD_PATH};
138150
fi
139151
# pack distro
@@ -167,7 +179,11 @@ before_script:
167179
ARCHIVE_NAME=$(basename ${DISTRO_PACK_PATH})
168180
echo "${ARCHIVE_NAME}" > ${PWD}/${DIST_DIR}/target_libs_arch_name
169181
fi
182+
- ls -l ${PWD}/${DIST_DIR}
170183

184+
# some Clang/LLVM unit tests fail if we build Clang for RISCV+Xtensa only
185+
# this job is intended to run unit tests only, so it builds Clang with all backends
186+
# TODO: LLVM-326 and LLVM-401
171187
build_and_test:
172188
tags: [ "amd64", "build" ]
173189
stage: test_build
@@ -209,40 +225,26 @@ build_and_test:
209225
- runuser -u test_runner -- ninja -C ${BUILD_PATH} check-lld 2>&1 > ${BUILD_PATH}/lld-tests.log;
210226
- chown -R ${CUR_USER} ${BUILD_PATH};
211227

212-
test_xesppie:
213-
stage: test
214-
dependencies:
215-
- pack_x86_64-linux-gnu
216-
when: manual
217-
allow_failure: true
218-
only:
219-
- tags
220-
script:
221-
- cd ${DIST_DIR}/
222-
- ls -l
223-
- DISTRO_PACK_FILE=$(cat dist_name_x86_64-linux-gnu)
224-
- tar -xf ${DISTRO_PACK_FILE}
225-
- ls -l
226-
- cd esp-clang
227-
- ls -l
228-
- pwd
229-
- export CC="$(pwd)/bin/clang"
230-
- export OBJDUMP="$(pwd)/bin/llvm-objdump"
231-
- git clone -q --depth=1 "${GITLAB_SSH_SERVER}/idf/esp-compiler-tests.git"
232-
- cd esp-compiler-tests/build-only/xesppie
233-
- ./test_xesppie.py
234-
235228
.build_linux-gnu_template:
236229
extends: .build_toolchain_template
237230
variables:
238231
USE_LINKER: "gold"
239232

233+
# Actually this job builds and packs distro for x86_64-linux-gnu,
234+
# but also it runs package tests. So keep it in 'test_build' stage
240235
build_x86_64-linux-gnu:
241236
extends: .build_linux-gnu_template
242-
stage: build
237+
stage: test_build
243238
variables:
244239
CONF_HOST: "x86_64-linux-gnu"
245-
240+
# Build complete distro it is necessary for running package tests
241+
BUILD_TARGET_LIBS: "ON"
242+
RUN_PKG_TESTS: "ON"
243+
244+
# Target libs are built in build_x86_64-linux-gnu, but due to artifacts
245+
# size limit we have to produce target libs archive in this job.
246+
# Archive with target libs from this job will be used in pack jobs
247+
# for all platform except for x86_64-linux-gnu.
246248
build_target_libs:
247249
extends: .build_linux-gnu_template
248250
stage: build
@@ -306,7 +308,7 @@ build_aarch64-apple-darwin:
306308
paths:
307309
- ${DIST_DIR}/
308310
when: always
309-
expire_in: 1 day
311+
expire_in: 3 day
310312
variables:
311313
PACK_TOOL: "tar cJf"
312314
UNPACK_TOOL: "tar xJf"
@@ -328,15 +330,6 @@ build_aarch64-apple-darwin:
328330
- rm -rf ${DISTRO_PACK_DIR}
329331
- ls -l
330332

331-
pack_x86_64-linux-gnu:
332-
extends: .pack_template
333-
needs:
334-
# needs target libs archive from native build job
335-
- job: "build_target_libs"
336-
- job: "build_x86_64-linux-gnu"
337-
variables:
338-
CONF_HOST: "x86_64-linux-gnu"
339-
340333
pack_x86_64-w64-mingw32:
341334
extends: .pack_template
342335
needs:
@@ -449,7 +442,7 @@ test_esp_dsp:
449442
matrix:
450443
- CHIP: esp32p4
451444
needs:
452-
- job: "pack_x86_64-linux-gnu"
445+
- job: "build_x86_64-linux-gnu"
453446
variables:
454447
# use IDF 'master' from docker image
455448
TEST_APP_IDF_CUSTOM_BRANCH: ""
@@ -467,6 +460,28 @@ test_esp_dsp:
467460
- idf.py set-target ${CHIP} 2>&1 | tee ${BUILD_LOG}
468461
- idf.py build 2>&1 | tee -a ${BUILD_LOG}
469462

463+
test_xesppie:
464+
stage: test
465+
dependencies:
466+
- build_x86_64-linux-gnu
467+
allow_failure: true
468+
only:
469+
- tags
470+
script:
471+
- cd ${DIST_DIR}/
472+
- ls -l
473+
- DISTRO_PACK_FILE=$(cat dist_name_x86_64-linux-gnu)
474+
- tar -xf ${DISTRO_PACK_FILE}
475+
- ls -l
476+
- cd esp-clang
477+
- ls -l
478+
- pwd
479+
- export CC="$(pwd)/bin/clang"
480+
- export OBJDUMP="$(pwd)/bin/llvm-objdump"
481+
- git clone -q --depth=1 "${GITLAB_SSH_SERVER}/idf/esp-compiler-tests.git"
482+
- cd esp-compiler-tests/build-only/xesppie
483+
- ./test_xesppie.py
484+
470485
upload_to_http:
471486
stage: private_deploy
472487
when: manual
@@ -476,7 +491,7 @@ upload_to_http:
476491
# force the fetch strategy to clean old archives up in dist/ dir
477492
GIT_STRATEGY: fetch
478493
needs:
479-
- job: pack_x86_64-linux-gnu
494+
- job: build_x86_64-linux-gnu
480495
script:
481496
- cit_add_ssh_key "${HTTP_UPLOAD_KEY}"
482497
# List of archives
@@ -514,7 +529,7 @@ upload_to_github:
514529
TOOLCHAIN_SHA256_FILE: clang-${CI_COMMIT_TAG}-checksum.sha256
515530
LIBS_SHA256_FILE: libs-clang-${CI_COMMIT_TAG}-checksum.sha256
516531
needs:
517-
- job: pack_x86_64-linux-gnu
532+
- job: build_x86_64-linux-gnu
518533
- job: pack_arm-linux-gnueabihf
519534
- job: pack_aarch64-linux-gnu
520535
- job: pack_x86_64-w64-mingw32

0 commit comments

Comments
 (0)