2 windows_vm: windows-2019
3 ubuntu_vm: ubuntu-18.04
5 ci_runner_image: trini/u-boot-gitlab-ci-runner:focal-20220105-10Jan2022
6 # Add '-u 0' options for Azure pipelines, otherwise we get "permission
7 # denied" error when it tries to "useradd -m -u 1001 vsts_azpcontainer",
8 # since our $(ci_runner_image) user is not root.
15 - job: tools_only_windows
16 displayName: 'Ensure host tools build for Windows'
18 vmImage: $(windows_vm)
21 (New-Object Net.WebClient).DownloadFile("https://github.com/msys2/msys2-installer/releases/download/2021-06-04/msys2-base-x86_64-20210604.sfx.exe", "sfx.exe")
22 displayName: 'Install MSYS2'
24 sfx.exe -y -o%CD:~0,2%\
25 %CD:~0,2%\msys64\usr\bin\bash -lc "pacman --noconfirm -Syyuu"
26 displayName: 'Update MSYS2'
28 %CD:~0,2%\msys64\usr\bin\bash -lc "pacman --noconfirm --needed -Sy make gcc bison flex diffutils openssl-devel"
29 displayName: 'Install Toolchain'
31 echo make tools-only_defconfig tools-only NO_SDL=1 > build-tools.sh
32 %CD:~0,2%\msys64\usr\bin\bash -lc "bash build-tools.sh"
33 displayName: 'Build Host Tools'
35 # Tell MSYS2 we need a POSIX emulation layer
37 # Tell MSYS2 not to ‘cd’ our startup directory to HOME
40 - job: tools_only_macOS
41 displayName: 'Ensure host tools build for macOS X'
45 - script: brew install make
46 displayName: Brew install dependencies
48 gmake tools-only_config tools-only NO_SDL=1 \
49 HOSTCFLAGS="-I/usr/local/opt/openssl@1.1/include" \
50 HOSTLDFLAGS="-L/usr/local/opt/openssl@1.1/lib" \
51 -j$(sysctl -n hw.logicalcpu)
52 displayName: 'Perform tools-only build'
54 - job: check_for_migrated_symbols_in_board_header
55 displayName: 'Check for migrated symbols in board header'
59 image: $(ci_runner_image)
60 options: $(container_option)
65 cat `find . -name "Kconfig*"` | \
66 sed -n -e 's/^\s*config *\([A-Za-z0-9_]*\).*$/CONFIG_\1/p' \
67 -e 's/^\s*menuconfig *\([A-Za-z0-9_]*\).*$/CONFIG_\1/p' \
69 for CFG in `find include/configs -name "*.h"`; do
70 grep '#define[[:blank:]]CONFIG_' $CFG | \
71 sed -n 's/#define.\(CONFIG_[A-Za-z0-9_]*\).*/\1/p' | \
72 sort -u > ${KUSEDLST} || true
73 NUM=`comm -12 --total --output-delimiter=, ${KSYMLST} ${KUSEDLST} | \
75 if [[ $NUM -ne 0 ]]; then
76 echo "Unmigrated symbols found in $CFG"
82 displayName: 'Static code analysis with cppcheck'
86 image: $(ci_runner_image)
87 options: $(container_option)
89 - script: cppcheck -j$(nproc) --force --quiet --inline-suppr .
92 displayName: 'Build HTML documentation'
96 image: $(ci_runner_image)
97 options: $(container_option)
100 virtualenv -p /usr/bin/python3 /tmp/venvhtml
101 . /tmp/venvhtml/bin/activate
102 pip install -r doc/sphinx/requirements.txt
106 displayName: 'Search for TODO within source tree'
108 vmImage: $(ubuntu_vm)
110 image: $(ci_runner_image)
111 options: $(container_option)
113 - script: grep -r TODO .
114 - script: grep -r FIXME .
115 - script: grep -r HACK . | grep -v HACKKIT
118 displayName: 'Some statistics about the code base'
120 vmImage: $(ubuntu_vm)
122 image: $(ci_runner_image)
123 options: $(container_option)
125 - script: sloccount .
128 displayName: 'Ensure all configs have MAINTAINERS entries'
130 vmImage: $(ubuntu_vm)
132 image: $(ci_runner_image)
133 options: $(container_option)
136 if [ `./tools/genboardscfg.py -f 2>&1 | wc -l` -ne 0 ]; then exit 1; fi
139 displayName: 'Ensure host tools build'
141 vmImage: $(ubuntu_vm)
143 image: $(ci_runner_image)
144 options: $(container_option)
147 make tools-only_config tools-only -j$(nproc)
150 displayName: 'Ensure env tools build'
152 vmImage: $(ubuntu_vm)
154 image: $(ci_runner_image)
155 options: $(container_option)
158 make tools-only_config envtools -j$(nproc)
161 displayName: 'Run binman, buildman, dtoc, Kconfig and patman testsuites'
163 vmImage: $(ubuntu_vm)
166 cat << EOF > build.sh
170 cat << "EOF" >> build.sh
171 git config --global user.name "Azure Pipelines"
172 git config --global user.email bmeng.cn@gmail.com
174 virtualenv -p /usr/bin/python3 /tmp/venv
175 . /tmp/venv/bin/activate
176 pip install -r test/py/requirements.txt
177 export UBOOT_TRAVIS_BUILD_DIR=/tmp/sandbox_spl
178 export PYTHONPATH=${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc/pylibfdt
179 export PATH=${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc:${PATH}
180 ./tools/buildman/buildman -T0 -o ${UBOOT_TRAVIS_BUILD_DIR} -w --board sandbox_spl
181 ./tools/binman/binman --toolpath ${UBOOT_TRAVIS_BUILD_DIR}/tools test
182 ./tools/buildman/buildman -t
184 ./tools/patman/patman test
185 make O=${UBOOT_TRAVIS_BUILD_DIR} testconfig
188 # We cannot use "container" like other jobs above, as buildman
189 # seems to hang forever with pre-configured "container" environment
190 docker run -v $PWD:$(work_dir) $(ci_runner_image) /bin/bash $(work_dir)/build.sh
192 - job: nokia_rx51_test
193 displayName: 'Run tests for Nokia RX-51 (aka N900)'
195 vmImage: $(ubuntu_vm)
197 image: $(ci_runner_image)
198 options: $(container_option)
201 export PATH=/opt/gcc-11.1.0-nolibc/arm-linux-gnueabi/bin:$PATH
202 test/nokia_rx51_test.sh
207 displayName: 'test.py'
209 vmImage: $(ubuntu_vm)
213 TEST_PY_BD: "sandbox"
215 TEST_PY_BD: "sandbox"
216 OVERRIDE: "-O clang-13"
218 TEST_PY_BD: "sandbox_spl"
219 TEST_PY_TEST_SPEC: "test_ofplatdata or test_handoff or test_spl"
221 TEST_PY_BD: "sandbox_noinst"
222 TEST_PY_TEST_SPEC: "test_ofplatdata or test_handoff or test_spl"
224 TEST_PY_BD: "sandbox_flattree"
226 TEST_PY_BD: "coreboot"
227 TEST_PY_ID: "--id qemu"
228 TEST_PY_TEST_SPEC: "not sleep"
230 TEST_PY_BD: "evb-ast2500"
231 TEST_PY_ID: "--id qemu"
233 TEST_PY_BD: "vexpress_ca9x4"
234 TEST_PY_ID: "--id qemu"
235 integratorcp_cm926ejs:
236 TEST_PY_BD: "integratorcp_cm926ejs"
237 TEST_PY_ID: "--id qemu"
238 TEST_PY_TEST_SPEC: "not sleep"
240 TEST_PY_BD: "qemu_arm"
241 TEST_PY_TEST_SPEC: "not sleep"
243 TEST_PY_BD: "qemu_arm64"
244 TEST_PY_TEST_SPEC: "not sleep"
247 TEST_PY_ID: "--id qemu"
248 TEST_PY_TEST_SPEC: "not sleep and not efi"
250 TEST_PY_BD: "maltael"
251 TEST_PY_ID: "--id qemu"
252 TEST_PY_TEST_SPEC: "not sleep and not efi"
254 TEST_PY_BD: "malta64"
255 TEST_PY_ID: "--id qemu"
256 TEST_PY_TEST_SPEC: "not sleep and not efi"
258 TEST_PY_BD: "malta64el"
259 TEST_PY_ID: "--id qemu"
260 TEST_PY_TEST_SPEC: "not sleep and not efi"
262 TEST_PY_BD: "qemu-ppce500"
263 TEST_PY_TEST_SPEC: "not sleep"
265 TEST_PY_BD: "qemu-riscv32"
266 TEST_PY_TEST_SPEC: "not sleep"
268 TEST_PY_BD: "qemu-riscv64"
269 TEST_PY_TEST_SPEC: "not sleep"
271 TEST_PY_BD: "qemu-riscv32_spl"
272 TEST_PY_TEST_SPEC: "not sleep"
274 TEST_PY_BD: "qemu-riscv64_spl"
275 TEST_PY_TEST_SPEC: "not sleep"
277 TEST_PY_BD: "qemu-x86"
278 TEST_PY_TEST_SPEC: "not sleep"
280 TEST_PY_BD: "qemu-x86_64"
281 TEST_PY_TEST_SPEC: "not sleep"
283 TEST_PY_BD: "r2dplus"
284 TEST_PY_ID: "--id i82557c_qemu"
286 TEST_PY_BD: "r2dplus"
287 TEST_PY_ID: "--id pcnet_qemu"
289 TEST_PY_BD: "r2dplus"
290 TEST_PY_ID: "--id rtl8139_qemu"
292 TEST_PY_BD: "r2dplus"
293 TEST_PY_ID: "--id tulip_qemu"
294 sifive_unleashed_sdcard:
295 TEST_PY_BD: "sifive_unleashed"
296 TEST_PY_ID: "--id sdcard_qemu"
297 sifive_unleashed_spi-nor:
298 TEST_PY_BD: "sifive_unleashed"
299 TEST_PY_ID: "--id spi-nor_qemu"
301 TEST_PY_BD: "xilinx_zynq_virt"
302 TEST_PY_ID: "--id qemu"
303 TEST_PY_TEST_SPEC: "not sleep"
305 TEST_PY_BD: "xilinx_versal_virt"
306 TEST_PY_ID: "--id qemu"
307 TEST_PY_TEST_SPEC: "not sleep"
310 TEST_PY_ID: "--id qemu"
311 TEST_PY_TEST_SPEC: "not sleep"
316 # make environment variables available as tests are running inside a container
317 export WORK_DIR="${WORK_DIR}"
318 export TEST_PY_BD="${TEST_PY_BD}"
319 export TEST_PY_ID="${TEST_PY_ID}"
320 export TEST_PY_TEST_SPEC="${TEST_PY_TEST_SPEC}"
321 export OVERRIDE="${OVERRIDE}"
323 cat << "EOF" >> test.sh
324 # the below corresponds to .gitlab-ci.yml "before_script"
326 git clone --depth=1 https://source.denx.de/u-boot/u-boot-test-hooks /tmp/uboot-test-hooks
327 ln -s travis-ci /tmp/uboot-test-hooks/bin/`hostname`
328 ln -s travis-ci /tmp/uboot-test-hooks/py/`hostname`
329 grub-mkimage --prefix=\"\" -o ~/grub_x86.efi -O i386-efi normal echo lsefimmap lsefi lsefisystab efinet tftp minicmd
330 grub-mkimage --prefix=\"\" -o ~/grub_x64.efi -O x86_64-efi normal echo lsefimmap lsefi lsefisystab efinet tftp minicmd
331 if [[ "${TEST_PY_BD}" == "qemu-riscv32_spl" ]]; then
332 wget -O - https://github.com/riscv/opensbi/releases/download/v0.9/opensbi-0.9-rv-bin.tar.xz | tar -C /tmp -xJ;
333 export OPENSBI=/tmp/opensbi-0.9-rv-bin/share/opensbi/ilp32/generic/firmware/fw_dynamic.bin;
335 if [[ "${TEST_PY_BD}" == "qemu-riscv64_spl" ]] || [[ "${TEST_PY_BD}" == "sifive_unleashed" ]]; then
336 wget -O - https://github.com/riscv/opensbi/releases/download/v0.9/opensbi-0.9-rv-bin.tar.xz | tar -C /tmp -xJ;
337 export OPENSBI=/tmp/opensbi-0.9-rv-bin/share/opensbi/lp64/generic/firmware/fw_dynamic.bin;
339 # the below corresponds to .gitlab-ci.yml "script"
341 export UBOOT_TRAVIS_BUILD_DIR=/tmp/${TEST_PY_BD};
342 tools/buildman/buildman -o ${UBOOT_TRAVIS_BUILD_DIR} -w -E -W -e --board ${TEST_PY_BD} ${OVERRIDE}
343 cp ~/grub_x86.efi ${UBOOT_TRAVIS_BUILD_DIR}/
344 cp ~/grub_x64.efi ${UBOOT_TRAVIS_BUILD_DIR}/
345 cp /opt/grub/grubriscv64.efi ${UBOOT_TRAVIS_BUILD_DIR}/grub_riscv64.efi
346 cp /opt/grub/grubaa64.efi ${UBOOT_TRAVIS_BUILD_DIR}/grub_arm64.efi
347 cp /opt/grub/grubarm.efi ${UBOOT_TRAVIS_BUILD_DIR}/grub_arm.efi
348 # create sdcard / spi-nor images for sifive unleashed using genimage
349 if [[ "${TEST_PY_BD}" == "sifive_unleashed" ]]; then
351 cp ${UBOOT_TRAVIS_BUILD_DIR}/spl/u-boot-spl.bin .;
352 cp ${UBOOT_TRAVIS_BUILD_DIR}/u-boot.itb .;
354 genimage --inputpath . --config board/sifive/unleashed/genimage_sdcard.cfg;
355 cp images/sdcard.img ${UBOOT_TRAVIS_BUILD_DIR}/;
357 genimage --inputpath . --config board/sifive/unleashed/genimage_spi-nor.cfg;
358 cp images/spi-nor.img ${UBOOT_TRAVIS_BUILD_DIR}/;
360 if [[ "${TEST_PY_BD}" == "coreboot" ]]; then
361 wget -O - "https://drive.google.com/uc?id=1x6nrtWIyIRPLS2cQBwYTnT2TbOI8UjmM&export=download" |xz -dc >${UBOOT_TRAVIS_BUILD_DIR}/coreboot.rom;
362 wget -O - "https://drive.google.com/uc?id=149Cz-5SZXHNKpi9xg6R_5XITWohu348y&export=download" >cbfstool;
364 ./cbfstool ${UBOOT_TRAVIS_BUILD_DIR}/coreboot.rom add-flat-binary -f ${UBOOT_TRAVIS_BUILD_DIR}/u-boot.bin -n fallback/payload -c LZMA -l 0x1110000 -e 0x1110000;
366 virtualenv -p /usr/bin/python3 /tmp/venv
367 . /tmp/venv/bin/activate
368 pip install -r test/py/requirements.txt
369 export PATH=/opt/qemu/bin:/tmp/uboot-test-hooks/bin:${PATH};
370 export PYTHONPATH=/tmp/uboot-test-hooks/py/travis-ci;
371 # "${var:+"-k $var"}" expands to "" if $var is empty, "-k $var" if not
372 ./test/py/test.py -ra --bd ${TEST_PY_BD} ${TEST_PY_ID} ${TEST_PY_TEST_SPEC:+"-k ${TEST_PY_TEST_SPEC}"} --build-dir "$UBOOT_TRAVIS_BUILD_DIR";
373 # the below corresponds to .gitlab-ci.yml "after_script"
374 rm -rf /tmp/uboot-test-hooks /tmp/venv
377 # make current directory writeable to uboot user inside the container
378 # as sandbox testing need create files like spi flash images, etc.
379 # (TODO: clean up this in the future)
381 # Filesystem tests need extra docker args to run
383 if [[ "${TEST_PY_BD}" == "sandbox" ]]; then
384 # mount -o loop needs the loop devices
385 if modprobe loop; then
386 for d in $(find /dev -maxdepth 1 -name 'loop*'); do
387 set -- "$@" --device $d:$d
390 # Needed for mount syscall (for guestmount as well)
391 set -- "$@" --cap-add SYS_ADMIN
392 # Default apparmor profile denies mounts
393 set -- "$@" --security-opt apparmor=unconfined
395 # Some tests using libguestfs-tools need the fuse device to run
396 docker run "$@" --device /dev/fuse:/dev/fuse -v $PWD:$(work_dir) $(ci_runner_image) /bin/bash $(work_dir)/test.sh
400 - job: build_the_world
401 displayName: 'Build the World'
403 vmImage: $(ubuntu_vm)
405 # Use almost the same target division in .travis.yml, only merged
406 # 4 small build jobs (arc/microblaze/nds32/xtensa) into one.
408 arc_microblaze_nds32_xtensa:
409 BUILDMAN: "arc microblaze nds32 xtensa"
410 arm11_arm7_arm920t_arm946es:
411 BUILDMAN: "arm11 arm7 arm920t arm946es"
413 BUILDMAN: "arm926ejs -x freescale,siemens,at91,kirkwood,omap"
415 BUILDMAN: "at91 -x armv7"
417 BUILDMAN: "at91 -x arm926ejs"
418 boundary_engicam_toradex:
419 BUILDMAN: "boundary engicam toradex"
421 BUILDMAN: "bcm -x mips"
423 BUILDMAN: "freescale -x powerpc,m68k,aarch64,ls101,ls102,ls104,ls108,ls20,lx216"
425 BUILDMAN: "freescale&ls101"
427 BUILDMAN: "freescale&ls102"
429 BUILDMAN: "freescale&ls104"
431 BUILDMAN: "freescale&ls108"
433 BUILDMAN: "freescale&ls20"
435 BUILDMAN: "freescale&lx216"
437 BUILDMAN: "mx6 -x boundary,engicam,freescale,technexion,toradex"
439 BUILDMAN: "mx -x mx6,freescale,technexion,toradex"
445 BUILDMAN: "samsung socfpga"
455 BUILDMAN: "sun8i&armv7"
457 BUILDMAN: "sun8i&aarch64"
463 BUILDMAN: "arm -x arm11,arm7,arm9,aarch64,at91,bcm,freescale,kirkwood,mvebu,renesas,siemens,tegra,uniphier,mx,samsung,sunxi,am33xx,omap,rk,toradex,socfpga,k2,k3,zynq"
465 BUILDMAN: "sandbox x86"
467 BUILDMAN: "technexion"
477 BUILDMAN: "powerpc -x freescale"
479 BUILDMAN: "mpc85xx&freescale -x t208xrdb -x t102* -x p1_p2_rdb_pc -x p1010rdb -x corenet_ds -x bsc91*"
481 BUILDMAN: "t208xrdb corenet_ds"
483 BUILDMAN: "mpc83xx&freescale"
487 BUILDMAN: "p1_p2_rdb_pc"
489 BUILDMAN: "p1010rdb bsc91"
493 BUILDMAN: "tegra -x toradex"
495 BUILDMAN: "am33xx -x siemens"
501 BUILDMAN: "aarch64 -x bcm,imx8,k3,tegra,ls1,ls2,lx216,mvebu,uniphier,renesas,sunxi,samsung,socfpga,rk,versal,zynq"
507 BUILDMAN: "zynq&armv7"
509 BUILDMAN: "versal|zynqmp&aarch64"
514 cat << EOF > build.sh
517 # make environment variables available as tests are running inside a container
518 export BUILDMAN="${BUILDMAN}"
520 cat << "EOF" >> build.sh
521 if [[ "${BUILDMAN}" != "" ]]; then
523 tools/buildman/buildman -o /tmp -P -E -W ${BUILDMAN} ${OVERRIDE} || ret=$?;
524 if [[ $ret -ne 0 ]]; then
525 tools/buildman/buildman -o /tmp -seP ${BUILDMAN};
531 docker run -v $PWD:$(work_dir) $(ci_runner_image) /bin/bash $(work_dir)/build.sh