board_f: Make clear_bss generic
[platform/kernel/u-boot.git] / .azure-pipelines.yml
1 variables:
2   windows_vm: vs2017-win2016
3   ubuntu_vm: ubuntu-18.04
4   ci_runner_image: trini/u-boot-gitlab-ci-runner:bionic-20200112-07Feb2020
5   # Add '-u 0' options for Azure pipelines, otherwise we get "permission
6   # denied" error when it tries to "useradd -m -u 1001 vsts_azpcontainer",
7   # since our $(ci_runner_image) user is not root.
8   container_option: -u 0
9   work_dir: /u
10
11 jobs:
12   - job: tools_only_windows
13     displayName: 'Ensure host tools build for Windows'
14     pool:
15       vmImage: $(windows_vm)
16     strategy:
17       matrix:
18         i686:
19           MSYS_DIR: msys32
20           BASE_REPO: msys2-ci-base-i686
21         x86_64:
22           MSYS_DIR: msys64
23           BASE_REPO: msys2-ci-base
24     steps:
25       - script: |
26           git clone https://github.com/msys2/$(BASE_REPO).git %CD:~0,2%\$(MSYS_DIR)
27         displayName: 'Install MSYS2'
28       - script: |
29           set PATH=%CD:~0,2%\$(MSYS_DIR)\usr\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem
30           %CD:~0,2%\$(MSYS_DIR)\usr\bin\pacman --noconfirm -Syyuu
31         displayName: 'Update MSYS2'
32       - script: |
33           set PATH=%CD:~0,2%\$(MSYS_DIR)\usr\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem
34           %CD:~0,2%\$(MSYS_DIR)\usr\bin\pacman --noconfirm --needed -S make gcc bison diffutils openssl-devel
35         displayName: 'Install Toolchain'
36       - script: |
37           set PATH=C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem
38           echo make tools-only_defconfig tools-only NO_SDL=1 > build-tools.sh
39           %CD:~0,2%\$(MSYS_DIR)\usr\bin\bash -lc "bash build-tools.sh"
40         displayName: 'Build Host Tools'
41         env:
42           # Tell MSYS2 we need a POSIX emulation layer
43           MSYSTEM: MSYS
44           # Tell MSYS2 not to ‘cd’ our startup directory to HOME
45           CHERE_INVOKING: yes
46
47   - job: cppcheck
48     displayName: 'Static code analysis with cppcheck'
49     pool:
50       vmImage: $(ubuntu_vm)
51     container:
52       image: $(ci_runner_image)
53       options: $(container_option)
54     steps:
55       - script: cppcheck --force --quiet --inline-suppr .
56
57   - job: todo
58     displayName: 'Search for TODO within source tree'
59     pool:
60       vmImage: $(ubuntu_vm)
61     container:
62       image: $(ci_runner_image)
63       options: $(container_option)
64     steps:
65       - script: grep -r TODO .
66       - script: grep -r FIXME .
67       - script: grep -r HACK . | grep -v HACKKIT
68
69   - job: sloccount
70     displayName: 'Some statistics about the code base'
71     pool:
72       vmImage: $(ubuntu_vm)
73     container:
74       image: $(ci_runner_image)
75       options: $(container_option)
76     steps:
77       - script: sloccount .
78
79   - job: maintainers
80     displayName: 'Ensure all configs have MAINTAINERS entries'
81     pool:
82       vmImage: $(ubuntu_vm)
83     container:
84       image: $(ci_runner_image)
85       options: $(container_option)
86     steps:
87       - script: |
88           if [ `./tools/genboardscfg.py -f 2>&1 | wc -l` -ne 0 ]; then exit 1; fi
89
90   - job: tools_only
91     displayName: 'Ensure host tools build'
92     pool:
93       vmImage: $(ubuntu_vm)
94     container:
95       image: $(ci_runner_image)
96       options: $(container_option)
97     steps:
98       - script: |
99           make tools-only_config tools-only -j$(nproc)
100
101   - job: envtools
102     displayName: 'Ensure env tools build'
103     pool:
104       vmImage: $(ubuntu_vm)
105     container:
106       image: $(ci_runner_image)
107       options: $(container_option)
108     steps:
109       - script: |
110           make tools-only_config envtools -j$(nproc)
111
112   - job: utils
113     displayName: 'Run binman, buildman, dtoc and patman testsuites'
114     pool:
115       vmImage: $(ubuntu_vm)
116     steps:
117       - script: |
118           cat << EOF > build.sh
119           set -ex
120           cd ${WORK_DIR}
121           EOF
122           cat << "EOF" >> build.sh
123           git config --global user.name "Azure Pipelines"
124           git config --global user.email bmeng.cn@gmail.com
125           export USER=azure
126           virtualenv /tmp/venv
127           . /tmp/venv/bin/activate
128           pip install pyelftools
129           export UBOOT_TRAVIS_BUILD_DIR=/tmp/.bm-work/sandbox_spl
130           export PYTHONPATH=${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc/pylibfdt
131           export PATH=${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc:${PATH}
132           ./tools/buildman/buildman -o /tmp -P sandbox_spl
133           ./tools/binman/binman --toolpath ${UBOOT_TRAVIS_BUILD_DIR}/tools test
134           ./tools/buildman/buildman -t
135           ./tools/dtoc/dtoc -t
136           ./tools/patman/patman --test
137           EOF
138           cat build.sh
139           # We cannot use "container" like other jobs above, as buildman
140           # seems to hang forever with pre-configured "container" environment
141           docker run -v $PWD:$(work_dir) $(ci_runner_image) /bin/bash $(work_dir)/build.sh
142
143   - job: test_py
144     displayName: 'test.py'
145     pool:
146       vmImage: $(ubuntu_vm)
147     strategy:
148       matrix:
149         sandbox:
150           TEST_PY_BD: "sandbox"
151           BUILDMAN: "^sandbox$"
152         sandbox_clang:
153           TEST_PY_BD: "sandbox"
154           BUILDMAN: "^sandbox$"
155           OVERRIDE: "-O clang-7"
156         sandbox_spl:
157           TEST_PY_BD: "sandbox_spl"
158           TEST_PY_TEST_SPEC: "test_ofplatdata"
159           BUILDMAN: "^sandbox_spl$"
160         sandbox_flattree:
161           TEST_PY_BD: "sandbox_flattree"
162           BUILDMAN: "^sandbox_flattree$"
163         evb_ast2500:
164           TEST_PY_BD: "evb-ast2500"
165           TEST_PY_ID: "--id qemu"
166           BUILDMAN: "^evb-ast2500$"
167         vexpress_ca15_tc2:
168           TEST_PY_BD: "vexpress_ca15_tc2"
169           TEST_PY_ID: "--id qemu"
170           BUILDMAN: "^vexpress_ca15_tc2$"
171         vexpress_ca9x4:
172           TEST_PY_BD: "vexpress_ca9x4"
173           TEST_PY_ID: "--id qemu"
174           BUILDMAN: "^vexpress_ca9x4$"
175         integratorcp_cm926ejs:
176           TEST_PY_BD: "integratorcp_cm926ejs"
177           TEST_PY_ID: "--id qemu"
178           TEST_PY_TEST_SPEC: "not sleep"
179           BUILDMAN: "^integratorcp_cm926ejs$"
180         qemu_arm:
181           TEST_PY_BD: "qemu_arm"
182           TEST_PY_TEST_SPEC: "not sleep"
183           BUILDMAN: "^qemu_arm$"
184         qemu_arm64:
185           TEST_PY_BD: "qemu_arm64"
186           TEST_PY_TEST_SPEC: "not sleep"
187           BUILDMAN: "^qemu_arm64$"
188         qemu_mips:
189           TEST_PY_BD: "qemu_mips"
190           TEST_PY_TEST_SPEC: "not sleep"
191           BUILDMAN: "^qemu_mips$"
192         qemu_mipsel:
193           TEST_PY_BD: "qemu_mipsel"
194           TEST_PY_TEST_SPEC: "not sleep"
195           BUILDMAN: "^qemu_mipsel$"
196         qemu_mips64:
197           TEST_PY_BD: "qemu_mips64"
198           TEST_PY_TEST_SPEC: "not sleep"
199           BUILDMAN: "^qemu_mips64$"
200         qemu_mips64el:
201           TEST_PY_BD: "qemu_mips64el"
202           TEST_PY_TEST_SPEC: "not sleep"
203           BUILDMAN: "^qemu_mips64el$"
204         qemu_ppce500:
205           TEST_PY_BD: "qemu-ppce500"
206           TEST_PY_TEST_SPEC: "not sleep"
207           BUILDMAN: "^qemu-ppce500$"
208         qemu_riscv64:
209           TEST_PY_BD: "qemu-riscv64"
210           TEST_PY_TEST_SPEC: "not sleep"
211           BUILDMAN: "^qemu-riscv64$"
212         qemu_x86:
213           TEST_PY_BD: "qemu-x86"
214           TEST_PY_TEST_SPEC: "not sleep"
215           BUILDMAN: "^qemu-x86$"
216         qemu_x86_64:
217           TEST_PY_BD: "qemu-x86_64"
218           TEST_PY_TEST_SPEC: "not sleep"
219           BUILDMAN: "^qemu-x86_64$"
220         zynq_zc702:
221           TEST_PY_BD: "zynq_zc702"
222           TEST_PY_ID: "--id qemu"
223           TEST_PY_TEST_SPEC: "not sleep"
224           BUILDMAN: "^zynq_zc702$"
225         xilinx_versal_virt:
226           TEST_PY_BD: "xilinx_versal_virt"
227           TEST_PY_ID: "--id qemu"
228           TEST_PY_TEST_SPEC: "not sleep"
229           BUILDMAN: "^xilinx_versal_virt$"
230         xtfpga:
231           TEST_PY_BD: "xtfpga"
232           TEST_PY_ID: "--id qemu"
233           TEST_PY_TEST_SPEC: "not sleep"
234           BUILDMAN: "^xtfpga$"
235     steps:
236       - script: |
237           cat << EOF > test.sh
238           set -ex
239           # make environment variables available as tests are running inside a container
240           export WORK_DIR="${WORK_DIR}"
241           export TEST_PY_BD="${TEST_PY_BD}"
242           export TEST_PY_ID="${TEST_PY_ID}"
243           export TEST_PY_TEST_SPEC="${TEST_PY_TEST_SPEC}"
244           export BUILDMAN="${BUILDMAN}"
245           export OVERRIDE="${OVERRIDE}"
246           EOF
247           cat << "EOF" >> test.sh
248           # the below corresponds to .gitlab-ci.yml "before_script"
249           cd ${WORK_DIR}
250           git clone --depth=1 git://github.com/swarren/uboot-test-hooks.git /tmp/uboot-test-hooks
251           ln -s travis-ci /tmp/uboot-test-hooks/bin/`hostname`
252           ln -s travis-ci /tmp/uboot-test-hooks/py/`hostname`
253           grub-mkimage --prefix=\"\" -o ~/grub_x86.efi -O i386-efi normal  echo lsefimmap lsefi lsefisystab efinet tftp minicmd
254           grub-mkimage --prefix=\"\" -o ~/grub_x64.efi -O x86_64-efi normal  echo lsefimmap lsefi lsefisystab efinet tftp minicmd
255           cp /opt/grub/grubriscv64.efi ~/grub_riscv64.efi
256           cp /opt/grub/grubaa64.efi ~/grub_arm64.efi
257           cp /opt/grub/grubarm.efi ~/grub_arm.efi
258           # the below corresponds to .gitlab-ci.yml "script"
259           cd ${WORK_DIR}
260           if [[ "${BUILDMAN}" != "" ]]; then
261               ret=0;
262               tools/buildman/buildman -o /tmp -P -E ${BUILDMAN} ${OVERRIDE} || ret=$?;
263               if [[ $ret -ne 0 && $ret -ne 129 ]]; then
264                   tools/buildman/buildman -o /tmp -sdeP ${BUILDMAN};
265                   exit $ret;
266               fi;
267           fi
268           virtualenv -p /usr/bin/python3 /tmp/venv
269           . /tmp/venv/bin/activate
270           pip install -r test/py/requirements.txt
271           export UBOOT_TRAVIS_BUILD_DIR=/tmp/.bm-work/${TEST_PY_BD};
272           export PATH=/opt/qemu/bin:/tmp/uboot-test-hooks/bin:${PATH};
273           export PYTHONPATH=/tmp/uboot-test-hooks/py/travis-ci;
274           if [[ "${TEST_PY_BD}" != "" ]]; then
275               ./test/py/test.py --bd ${TEST_PY_BD} ${TEST_PY_ID} -k "${TEST_PY_TEST_SPEC:-not a_test_which_does_not_exist}" --build-dir "$UBOOT_TRAVIS_BUILD_DIR";
276               ret=$?;
277               if [[ $ret -ne 0 ]]; then
278                   exit $ret;
279               fi;
280           fi
281           # the below corresponds to .gitlab-ci.yml "after_script"
282           rm -rf /tmp/uboot-test-hooks /tmp/venv
283           EOF
284           cat test.sh
285           # make current directory writeable to uboot user inside the container
286           # as sandbox testing need create files like spi flash images, etc.
287           # (TODO: clean up this in the future)
288           chmod 777 .
289           docker run -v $PWD:$(work_dir) $(ci_runner_image) /bin/bash $(work_dir)/test.sh
290
291   - job: build_the_world
292     displayName: 'Build the World'
293     pool:
294       vmImage: $(ubuntu_vm)
295     strategy:
296       # Use almost the same target division in .travis.yml, only merged
297       # 4 small build jobs (arc/microblaze/nds32/xtensa) into one.
298       matrix:
299         arc_microblaze_nds32_xtensa:
300           BUILDMAN: "arc microblaze nds32 xtensa"
301         arm11_arm7_arm920t_arm946es:
302           BUILDMAN: "arm11 arm7 arm920t arm946es"
303         arm926ejs:
304           BUILDMAN: "arm926ejs -x freescale,siemens,at91,kirkwood,spear,omap"
305         at91_non_armv7:
306           BUILDMAN: "at91 -x armv7"
307         at91_non_arm926ejs:
308           BUILDMAN: "at91 -x arm926ejs"
309         boundary_engicam_toradex:
310           BUILDMAN: "boundary engicam toradex"
311         arm_bcm:
312           BUILDMAN: "bcm -x mips"
313         nxp_arm32:
314           BUILDMAN: "freescale -x powerpc,m68k,aarch64,ls101,ls102,ls104,ls108,ls20,lx216"
315         nxp_ls101x:
316           BUILDMAN: "freescale&ls101"
317         nxp_ls102x:
318           BUILDMAN: "freescale&ls102"
319         nxp_ls104x:
320           BUILDMAN: "freescale&ls104"
321         nxp_ls108x:
322           BUILDMAN: "freescale&ls108"
323         nxp_ls20xx:
324           BUILDMAN: "freescale&ls20"
325         nxp_lx216x:
326           BUILDMAN: "freescale&lx216"
327         imx6:
328           BUILDMAN: "mx6 -x boundary,engicam,freescale,technexion,toradex"
329         imx:
330           BUILDMAN: "mx -x mx6,freescale,technexion,toradex"
331         keystone2_keystone3:
332           BUILDMAN: "k2 k3"
333         samsung_socfpga:
334           BUILDMAN: "samsung socfpga"
335         spear:
336           BUILDMAN: "spear"
337         sun4i:
338           BUILDMAN: "sun4i"
339         sun5i:
340           BUILDMAN: "sun5i"
341         sun6i:
342           BUILDMAN: "sun6i"
343         sun7i:
344           BUILDMAN: "sun7i"
345         sun8i_32bit:
346           BUILDMAN: "sun8i&armv7"
347         sun8i_64bit:
348           BUILDMAN: "sun8i&aarch64"
349         sun9i:
350           BUILDMAN: "sun9i"
351         sun50i:
352           BUILDMAN: "sun50i"
353         arm_catch_all:
354           BUILDMAN: "arm -x arm11,arm7,arm9,aarch64,at91,bcm,freescale,kirkwood,mvebu,siemens,tegra,uniphier,mx,samsung,sunxi,am33xx,omap,rockchip,toradex,socfpga,k2,k3,zynq"
355         sandbox_x86:
356           BUILDMAN: "sandbox x86"
357         technexion:
358           BUILDMAN: "technexion"
359         kirkwood:
360           BUILDMAN: "kirkwood"
361         mvebu:
362           BUILDMAN: "mvebu"
363         m68k:
364           BUILDMAN: "m68k"
365         mips:
366           BUILDMAN: "mips"
367         non_fsl_ppc:
368           BUILDMAN: "powerpc -x freescale"
369         mpc85xx_freescale:
370           BUILDMAN: "mpc85xx&freescale -x t208xrdb -x t4qds -x t102* -x p1_p2_rdb_pc -x p1010rdb -x corenet_ds -x b4860qds -x bsc91*"
371         t208xrdb_corenet_ds:
372           BUILDMAN: "t208xrdb corenet_ds"
373         fsl_ppc:
374           BUILDMAN: "t4qds b4860qds mpc83xx&freescale mpc86xx&freescale"
375         t102x:
376           BUILDMAN: "t102*"
377         p1_p2_rdb_pc:
378           BUILDMAN: "p1_p2_rdb_pc"
379         p1010rdb_bsc91:
380           BUILDMAN: "p1010rdb bsc91"
381         siemens:
382           BUILDMAN: "siemens"
383         tegra:
384           BUILDMAN: "tegra -x toradex"
385         am33xx_no_siemens:
386           BUILDMAN: "am33xx -x siemens"
387         omap:
388           BUILDMAN: "omap"
389         uniphier:
390           BUILDMAN: "uniphier"
391         aarch64_catch_all:
392           BUILDMAN: "aarch64 -x bcm,k3,tegra,ls1,ls2,mvebu,uniphier,sunxi,samsung,rockchip,versal,zynq"
393         rockchip:
394           BUILDMAN: "rockchip"
395         sh:
396           BUILDMAN: "sh -x arm"
397         zynq:
398           BUILDMAN: "zynq&armv7"
399         zynqmp_versal:
400           BUILDMAN: "versal|zynqmp&aarch64"
401         riscv:
402           BUILDMAN: "riscv"
403     steps:
404       - script: |
405           cat << EOF > build.sh
406           set -ex
407           cd ${WORK_DIR}
408           # make environment variables available as tests are running inside a container
409           export BUILDMAN="${BUILDMAN}"
410           EOF
411           cat << "EOF" >> build.sh
412           if [[ "${BUILDMAN}" != "" ]]; then
413               ret=0;
414               tools/buildman/buildman -o /tmp -P -E ${BUILDMAN} ${OVERRIDE} || ret=$?;
415               if [[ $ret -ne 0 && $ret -ne 129 ]]; then
416                   tools/buildman/buildman -o /tmp -sdeP ${BUILDMAN};
417                   exit $ret;
418               fi;
419           fi
420           EOF
421           cat build.sh
422           docker run -v $PWD:$(work_dir) $(ci_runner_image) /bin/bash $(work_dir)/build.sh