blob: 978d666238ec1fad8cf4307d2a6f41dc8ae5073d [file] [log] [blame]
Bin Mengc7072d12019-10-27 05:19:48 -07001variables:
Tom Rinid5f27cb2021-10-31 13:24:42 -04002 windows_vm: windows-2019
Tom Rini9f151fe2022-08-08 22:44:45 -04003 ubuntu_vm: ubuntu-22.04
Tom Rini72d5de52022-07-27 11:10:24 -04004 macos_vm: macOS-12
Tom Rini9d885972023-08-25 13:21:27 -04005 ci_runner_image: trini/u-boot-gitlab-ci-runner:jammy-20230804-25Aug2023
Bin Mengddaa6b12019-10-28 07:25:03 -07006 # 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.
9 container_option: -u 0
10 work_dir: /u
Bin Mengc7072d12019-10-27 05:19:48 -070011
Tom Rini4c268a62022-01-11 19:14:28 -050012stages:
13- stage: testsuites
14 jobs:
Bin Mengc7072d12019-10-27 05:19:48 -070015 - job: tools_only_windows
16 displayName: 'Ensure host tools build for Windows'
17 pool:
18 vmImage: $(windows_vm)
Bin Mengc7072d12019-10-27 05:19:48 -070019 steps:
Bin Meng31c3bce2020-07-28 02:06:44 -070020 - powershell: |
Bin Mengbd97b0d2021-06-22 07:33:21 +080021 (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")
Bin Mengc7072d12019-10-27 05:19:48 -070022 displayName: 'Install MSYS2'
23 - script: |
Bin Meng31c3bce2020-07-28 02:06:44 -070024 sfx.exe -y -o%CD:~0,2%\
Tom Rinic7f4e6a2022-05-03 08:30:14 -040025 %CD:~0,2%\msys64\usr\bin\bash -lc " "
26 %CD:~0,2%\msys64\usr\bin\bash -lc "pacman --noconfirm -Syuu"
27 %CD:~0,2%\msys64\usr\bin\bash -lc "pacman --noconfirm -Syuu"
Bin Mengc7072d12019-10-27 05:19:48 -070028 displayName: 'Update MSYS2'
29 - script: |
AKASHI Takahiroba212432022-02-09 19:10:39 +090030 %CD:~0,2%\msys64\usr\bin\bash -lc "pacman --noconfirm --needed -Sy make gcc bison flex diffutils openssl-devel libgnutls-devel libutil-linux-devel"
Bin Mengc7072d12019-10-27 05:19:48 -070031 displayName: 'Install Toolchain'
32 - script: |
Tom Riniea79bb72022-11-19 18:45:43 -050033 echo make tools-only_defconfig tools-only > build-tools.sh
Bin Meng8c655152020-07-28 02:06:42 -070034 %CD:~0,2%\msys64\usr\bin\bash -lc "bash build-tools.sh"
Bin Mengc7072d12019-10-27 05:19:48 -070035 displayName: 'Build Host Tools'
36 env:
37 # Tell MSYS2 we need a POSIX emulation layer
38 MSYSTEM: MSYS
39 # Tell MSYS2 not to ‘cd’ our startup directory to HOME
40 CHERE_INVOKING: yes
Bin Mengddaa6b12019-10-28 07:25:03 -070041
Tom Riniab1e85b2020-05-26 20:39:03 -040042 - job: tools_only_macOS
43 displayName: 'Ensure host tools build for macOS X'
44 pool:
45 vmImage: $(macos_vm)
46 steps:
AKASHI Takahiroba212432022-02-09 19:10:39 +090047 - script: brew install make ossp-uuid
Tom Riniab1e85b2020-05-26 20:39:03 -040048 displayName: Brew install dependencies
49 - script: |
Tom Riniea79bb72022-11-19 18:45:43 -050050 gmake tools-only_config tools-only \
Tom Riniab1e85b2020-05-26 20:39:03 -040051 HOSTCFLAGS="-I/usr/local/opt/openssl@1.1/include" \
52 HOSTLDFLAGS="-L/usr/local/opt/openssl@1.1/lib" \
53 -j$(sysctl -n hw.logicalcpu)
54 displayName: 'Perform tools-only build'
55
Tom Rini1cc7e4c2022-12-04 10:14:15 -050056 - job: check_for_new_CONFIG_symbols_outside_Kconfig
57 displayName: 'Check for new CONFIG symbols outside Kconfig'
Tom Rinibdfa3762021-12-14 13:36:41 -050058 pool:
59 vmImage: $(ubuntu_vm)
60 container:
61 image: $(ci_runner_image)
62 options: $(container_option)
63 steps:
Tom Rini1cc7e4c2022-12-04 10:14:15 -050064 # If grep succeeds and finds a match the test fails as we should
65 # have no matches.
66 - script: git grep -E '^#[[:blank:]]*(define|undef)[[:blank:]]*CONFIG_'
Tom Rini8f7345c2023-01-10 11:19:46 -050067 :^doc/ :^arch/arm/dts/ :^scripts/kconfig/lkc.h
68 :^include/linux/kconfig.h :^tools/ && exit 1 || exit 0
Tom Rinibdfa3762021-12-14 13:36:41 -050069
Bin Mengddaa6b12019-10-28 07:25:03 -070070 - job: cppcheck
71 displayName: 'Static code analysis with cppcheck'
72 pool:
73 vmImage: $(ubuntu_vm)
74 container:
75 image: $(ci_runner_image)
76 options: $(container_option)
77 steps:
Simon Glasscd1ccfa2020-04-05 14:35:43 -060078 - script: cppcheck -j$(nproc) --force --quiet --inline-suppr .
Bin Mengddaa6b12019-10-28 07:25:03 -070079
Heinrich Schuchardt54de2412023-01-12 20:30:58 +010080 - job: docs
81 displayName: 'Build documentation'
Heinrich Schuchardtfbf2bf92020-02-21 18:24:02 +010082 pool:
83 vmImage: $(ubuntu_vm)
84 container:
85 image: $(ci_runner_image)
86 options: $(container_option)
87 steps:
Heinrich Schuchardt846abe42021-01-25 22:06:25 +010088 - script: |
89 virtualenv -p /usr/bin/python3 /tmp/venvhtml
90 . /tmp/venvhtml/bin/activate
91 pip install -r doc/sphinx/requirements.txt
Heinrich Schuchardt2e0c8e62023-05-02 05:04:11 +020092 make htmldocs KDOC_WERROR=1
Heinrich Schuchardt54de2412023-01-12 20:30:58 +010093 make infodocs
Heinrich Schuchardtfbf2bf92020-02-21 18:24:02 +010094
Bin Mengddaa6b12019-10-28 07:25:03 -070095 - job: todo
96 displayName: 'Search for TODO within source tree'
97 pool:
98 vmImage: $(ubuntu_vm)
99 container:
100 image: $(ci_runner_image)
101 options: $(container_option)
102 steps:
103 - script: grep -r TODO .
104 - script: grep -r FIXME .
105 - script: grep -r HACK . | grep -v HACKKIT
106
107 - job: sloccount
108 displayName: 'Some statistics about the code base'
109 pool:
110 vmImage: $(ubuntu_vm)
111 container:
112 image: $(ci_runner_image)
113 options: $(container_option)
114 steps:
115 - script: sloccount .
116
117 - job: maintainers
118 displayName: 'Ensure all configs have MAINTAINERS entries'
119 pool:
120 vmImage: $(ubuntu_vm)
121 container:
122 image: $(ci_runner_image)
123 options: $(container_option)
124 steps:
125 - script: |
Simon Glass5e728d42023-07-19 17:48:27 -0600126 ./tools/buildman/buildman --maintainer-check || exit 0
Bin Mengddaa6b12019-10-28 07:25:03 -0700127
128 - job: tools_only
129 displayName: 'Ensure host tools build'
130 pool:
131 vmImage: $(ubuntu_vm)
132 container:
133 image: $(ci_runner_image)
134 options: $(container_option)
135 steps:
136 - script: |
137 make tools-only_config tools-only -j$(nproc)
138
139 - job: envtools
140 displayName: 'Ensure env tools build'
141 pool:
142 vmImage: $(ubuntu_vm)
143 container:
144 image: $(ci_runner_image)
145 options: $(container_option)
146 steps:
147 - script: |
148 make tools-only_config envtools -j$(nproc)
149
150 - job: utils
Tom Rini0b3e0c42020-03-11 18:11:15 -0400151 displayName: 'Run binman, buildman, dtoc, Kconfig and patman testsuites'
Bin Mengddaa6b12019-10-28 07:25:03 -0700152 pool:
153 vmImage: $(ubuntu_vm)
154 steps:
155 - script: |
Tom Rinid1ed4462022-08-09 21:08:54 -0400156 cat << "EOF" > build.sh
157 cd $(work_dir)
Bin Mengddaa6b12019-10-28 07:25:03 -0700158 git config --global user.name "Azure Pipelines"
159 git config --global user.email bmeng.cn@gmail.com
Tom Rinid1ed4462022-08-09 21:08:54 -0400160 git config --global --add safe.directory $(work_dir)
Bin Mengddaa6b12019-10-28 07:25:03 -0700161 export USER=azure
Tom Rini6c883102020-02-11 12:41:14 -0500162 virtualenv -p /usr/bin/python3 /tmp/venv
Bin Mengddaa6b12019-10-28 07:25:03 -0700163 . /tmp/venv/bin/activate
Tom Rini70c66dd2021-02-26 07:52:29 -0500164 pip install -r test/py/requirements.txt
Tom Rini95f1c6cb2023-07-22 00:14:46 +0530165 pip install -r tools/buildman/requirements.txt
Tom Rini08086922023-08-10 12:52:24 -0400166 export UBOOT_TRAVIS_BUILD_DIR=/tmp/tools-only
Bin Mengddaa6b12019-10-28 07:25:03 -0700167 export PYTHONPATH=${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc/pylibfdt
168 export PATH=${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc:${PATH}
Tom Rini08086922023-08-10 12:52:24 -0400169 ./tools/buildman/buildman -T0 -o ${UBOOT_TRAVIS_BUILD_DIR} -w --board tools-only
Tom Rinid1ed4462022-08-09 21:08:54 -0400170 set -ex
Bin Mengddaa6b12019-10-28 07:25:03 -0700171 ./tools/binman/binman --toolpath ${UBOOT_TRAVIS_BUILD_DIR}/tools test
172 ./tools/buildman/buildman -t
173 ./tools/dtoc/dtoc -t
Simon Glass109e84e2020-07-05 21:41:55 -0600174 ./tools/patman/patman test
Tom Rini0b3e0c42020-03-11 18:11:15 -0400175 make O=${UBOOT_TRAVIS_BUILD_DIR} testconfig
Bin Mengddaa6b12019-10-28 07:25:03 -0700176 EOF
177 cat build.sh
178 # We cannot use "container" like other jobs above, as buildman
179 # seems to hang forever with pre-configured "container" environment
180 docker run -v $PWD:$(work_dir) $(ci_runner_image) /bin/bash $(work_dir)/build.sh
181
Pali Rohár80ad67b2020-05-17 14:38:22 +0200182 - job: nokia_rx51_test
183 displayName: 'Run tests for Nokia RX-51 (aka N900)'
184 pool:
185 vmImage: $(ubuntu_vm)
186 container:
187 image: $(ci_runner_image)
188 options: $(container_option)
189 steps:
190 - script: |
Pali Rohárd88c1472023-02-21 11:22:29 -0500191 mkdir nokia_rx51_tmp
192 ln -s /opt/nokia/u-boot-gen-combined nokia_rx51_tmp/
193 ln -s /opt/nokia/qemu-n900.tar.gz nokia_rx51_tmp/
194 ln -s /opt/nokia/kernel_2.6.28-20103103+0m5_armel.deb nokia_rx51_tmp/
195 ln -s /opt/nokia/libc6_2.5.1-1eglibc27+0m5_armel.deb nokia_rx51_tmp/
196 ln -s /opt/nokia/busybox_1.10.2.legal-1osso30+0m5_armel.deb nokia_rx51_tmp/
197 ln -s /opt/nokia/qemu-system-arm nokia_rx51_tmp/
Tom Rini3bd5ed72023-08-25 13:21:26 -0400198 export PATH=/opt/gcc-13.2.0-nolibc/arm-linux-gnueabi/bin:$PATH
Pali Rohár80ad67b2020-05-17 14:38:22 +0200199 test/nokia_rx51_test.sh
200
Simon Glassf6903262022-02-11 13:23:26 -0700201 - job: pylint
202 displayName: Check for any pylint regressions
203 pool:
204 vmImage: $(ubuntu_vm)
205 container:
206 image: $(ci_runner_image)
207 options: $(container_option)
208 steps:
209 - script: |
Tom Rinid1ed4462022-08-09 21:08:54 -0400210 git config --global --add safe.directory $(work_dir)
Simon Glassf6903262022-02-11 13:23:26 -0700211 export USER=azure
212 pip install -r test/py/requirements.txt
Tom Rini95f1c6cb2023-07-22 00:14:46 +0530213 pip install -r tools/buildman/requirements.txt
Tom Rini090ff812022-03-25 08:19:09 -0400214 pip install asteval pylint==2.12.2 pyopenssl
Simon Glassf6903262022-02-11 13:23:26 -0700215 export PATH=${PATH}:~/.local/bin
216 echo "[MASTER]" >> .pylintrc
217 echo "load-plugins=pylint.extensions.docparams" >> .pylintrc
Tom Rini08086922023-08-10 12:52:24 -0400218 export UBOOT_TRAVIS_BUILD_DIR=/tmp/tools-only
219 ./tools/buildman/buildman -T0 -o ${UBOOT_TRAVIS_BUILD_DIR} -w --board tools-only
Tom Rinid1ed4462022-08-09 21:08:54 -0400220 set -ex
Simon Glassf6903262022-02-11 13:23:26 -0700221 pylint --version
222 export PYTHONPATH=${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc/pylibfdt
223 make pylint_err
224
Simon Glassf96763a2023-02-13 08:56:39 -0700225 - job: check_for_pre_schema_tags
226 displayName: 'Check for pre-schema driver model tags'
227 pool:
228 vmImage: $(ubuntu_vm)
229 container:
230 image: $(ci_runner_image)
231 options: $(container_option)
232 steps:
233 # If grep succeeds and finds a match the test fails as we should
234 # have no matches.
235 - script: git grep u-boot,dm- -- '*.dts*' && exit 1 || exit 0
236
Simon Glass5dd13b92023-02-23 18:18:24 -0700237 - job: check_packing_of_python_tools
238 displayName: 'Check we can package the Python tools'
239 pool:
240 vmImage: $(ubuntu_vm)
241 container:
242 image: $(ci_runner_image)
243 options: $(container_option)
244 steps:
245 - script: make pip
246
Tom Rini4c268a62022-01-11 19:14:28 -0500247- stage: test_py
248 jobs:
Bin Mengddaa6b12019-10-28 07:25:03 -0700249 - job: test_py
250 displayName: 'test.py'
251 pool:
252 vmImage: $(ubuntu_vm)
253 strategy:
254 matrix:
255 sandbox:
256 TEST_PY_BD: "sandbox"
Tom Rini8b3107a2023-08-20 13:31:27 -0400257 sandbox_asan:
258 TEST_PY_BD: "sandbox"
259 OVERRIDE: "-a ASAN"
260 TEST_PY_TEST_SPEC: "version"
Tom Rini99a1bb32019-11-06 19:30:47 -0500261 sandbox_clang:
262 TEST_PY_BD: "sandbox"
Tom Riniad9b2fd2023-03-21 15:07:45 -0400263 OVERRIDE: "-O clang-16"
Tom Rini8b3107a2023-08-20 13:31:27 -0400264 sandbox_clang_asan:
265 TEST_PY_BD: "sandbox"
266 OVERRIDE: "-O clang-16 -a ASAN"
267 TEST_PY_TEST_SPEC: "version"
Simon Glass2e32f5d2022-08-03 12:13:09 -0600268 sandbox_nolto:
269 TEST_PY_BD: "sandbox"
270 BUILD_ENV: "NO_LTO=1"
Bin Mengddaa6b12019-10-28 07:25:03 -0700271 sandbox_spl:
272 TEST_PY_BD: "sandbox_spl"
Simon Glass36a69e12020-10-25 20:38:36 -0600273 TEST_PY_TEST_SPEC: "test_ofplatdata or test_handoff or test_spl"
Simon Glassa2a4eea2022-04-30 00:56:57 -0600274 sandbox_vpl:
275 TEST_PY_BD: "sandbox_vpl"
Simon Glass4e5e7f42023-04-02 14:01:26 +1200276 TEST_PY_TEST_SPEC: "vpl or test_spl"
Simon Glass492f0b02021-03-15 17:25:34 +1300277 sandbox_noinst:
278 TEST_PY_BD: "sandbox_noinst"
279 TEST_PY_TEST_SPEC: "test_ofplatdata or test_handoff or test_spl"
Bin Mengddaa6b12019-10-28 07:25:03 -0700280 sandbox_flattree:
281 TEST_PY_BD: "sandbox_flattree"
Simon Glassc2f01902023-01-15 14:16:00 -0700282 sandbox_trace:
283 TEST_PY_BD: "sandbox"
284 BUILD_ENV: "FTRACE=1 NO_LTO=1"
285 TEST_PY_TEST_SPEC: "trace"
Sughosh Ganu0c3783e2023-08-22 23:10:02 +0530286 OVERRIDE: "-a CONFIG_TRACE=y -a CONFIG_TRACE_EARLY=y -a CONFIG_TRACE_EARLY_SIZE=0x01000000 -a CONFIG_TRACE_BUFFER_SIZE=0x02000000"
Simon Glass13e1fa02022-01-21 10:23:01 -0700287 coreboot:
288 TEST_PY_BD: "coreboot"
289 TEST_PY_ID: "--id qemu"
290 TEST_PY_TEST_SPEC: "not sleep"
Bin Mengddaa6b12019-10-28 07:25:03 -0700291 evb_ast2500:
292 TEST_PY_BD: "evb-ast2500"
293 TEST_PY_ID: "--id qemu"
Joel Stanley3f21e1b2022-06-29 16:35:25 +0930294 evb_ast2600:
295 TEST_PY_BD: "evb-ast2600"
296 TEST_PY_ID: "--id qemu"
Kristian Amlie8f8a2992021-09-07 08:37:51 +0200297 vexpress_ca9x4:
298 TEST_PY_BD: "vexpress_ca9x4"
299 TEST_PY_ID: "--id qemu"
Bin Mengddaa6b12019-10-28 07:25:03 -0700300 integratorcp_cm926ejs:
301 TEST_PY_BD: "integratorcp_cm926ejs"
302 TEST_PY_ID: "--id qemu"
303 TEST_PY_TEST_SPEC: "not sleep"
Bin Mengddaa6b12019-10-28 07:25:03 -0700304 qemu_arm:
305 TEST_PY_BD: "qemu_arm"
306 TEST_PY_TEST_SPEC: "not sleep"
Bin Mengddaa6b12019-10-28 07:25:03 -0700307 qemu_arm64:
308 TEST_PY_BD: "qemu_arm64"
309 TEST_PY_TEST_SPEC: "not sleep"
Marek Vasut07240eb2023-03-23 01:22:41 +0100310 qemu_m68k:
311 TEST_PY_BD: "M5208EVBE"
312 TEST_PY_ID: "--id qemu"
313 TEST_PY_TEST_SPEC: "not sleep and not efi"
314 OVERRIDE: "-a CONFIG_M68K_QEMU=y -a ~CONFIG_MCFTMR"
Daniel Schwierzeck879bc742020-06-06 22:21:47 +0200315 qemu_malta:
316 TEST_PY_BD: "malta"
317 TEST_PY_ID: "--id qemu"
318 TEST_PY_TEST_SPEC: "not sleep and not efi"
319 qemu_maltael:
320 TEST_PY_BD: "maltael"
321 TEST_PY_ID: "--id qemu"
322 TEST_PY_TEST_SPEC: "not sleep and not efi"
323 qemu_malta64:
324 TEST_PY_BD: "malta64"
325 TEST_PY_ID: "--id qemu"
326 TEST_PY_TEST_SPEC: "not sleep and not efi"
327 qemu_malta64el:
328 TEST_PY_BD: "malta64el"
329 TEST_PY_ID: "--id qemu"
330 TEST_PY_TEST_SPEC: "not sleep and not efi"
Bin Mengddaa6b12019-10-28 07:25:03 -0700331 qemu_ppce500:
332 TEST_PY_BD: "qemu-ppce500"
333 TEST_PY_TEST_SPEC: "not sleep"
Bin Mengaeb3ea42020-03-28 07:25:27 -0700334 qemu_riscv32:
335 TEST_PY_BD: "qemu-riscv32"
336 TEST_PY_TEST_SPEC: "not sleep"
Bin Mengddaa6b12019-10-28 07:25:03 -0700337 qemu_riscv64:
338 TEST_PY_BD: "qemu-riscv64"
339 TEST_PY_TEST_SPEC: "not sleep"
Bin Mengb68d9d62020-03-28 07:25:29 -0700340 qemu_riscv32_spl:
341 TEST_PY_BD: "qemu-riscv32_spl"
342 TEST_PY_TEST_SPEC: "not sleep"
Bin Mengb68d9d62020-03-28 07:25:29 -0700343 qemu_riscv64_spl:
344 TEST_PY_BD: "qemu-riscv64_spl"
345 TEST_PY_TEST_SPEC: "not sleep"
Bin Mengddaa6b12019-10-28 07:25:03 -0700346 qemu_x86:
347 TEST_PY_BD: "qemu-x86"
348 TEST_PY_TEST_SPEC: "not sleep"
Bin Mengddaa6b12019-10-28 07:25:03 -0700349 qemu_x86_64:
350 TEST_PY_BD: "qemu-x86_64"
351 TEST_PY_TEST_SPEC: "not sleep"
Marek Vasutfc5a9d72020-09-14 21:55:58 +0200352 r2dplus_i82557c:
353 TEST_PY_BD: "r2dplus"
354 TEST_PY_ID: "--id i82557c_qemu"
355 r2dplus_pcnet:
356 TEST_PY_BD: "r2dplus"
357 TEST_PY_ID: "--id pcnet_qemu"
358 r2dplus_rtl8139:
359 TEST_PY_BD: "r2dplus"
360 TEST_PY_ID: "--id rtl8139_qemu"
361 r2dplus_tulip:
362 TEST_PY_BD: "r2dplus"
363 TEST_PY_ID: "--id tulip_qemu"
Bin Meng0ae41062021-08-26 23:33:35 +0800364 sifive_unleashed_sdcard:
365 TEST_PY_BD: "sifive_unleashed"
366 TEST_PY_ID: "--id sdcard_qemu"
367 sifive_unleashed_spi-nor:
368 TEST_PY_BD: "sifive_unleashed"
369 TEST_PY_ID: "--id spi-nor_qemu"
Michal Simekf8834fd2020-02-13 15:03:29 +0100370 xilinx_zynq_virt:
371 TEST_PY_BD: "xilinx_zynq_virt"
Bin Mengddaa6b12019-10-28 07:25:03 -0700372 TEST_PY_ID: "--id qemu"
373 TEST_PY_TEST_SPEC: "not sleep"
Bin Mengddaa6b12019-10-28 07:25:03 -0700374 xilinx_versal_virt:
375 TEST_PY_BD: "xilinx_versal_virt"
376 TEST_PY_ID: "--id qemu"
377 TEST_PY_TEST_SPEC: "not sleep"
Bin Mengddaa6b12019-10-28 07:25:03 -0700378 xtfpga:
379 TEST_PY_BD: "xtfpga"
380 TEST_PY_ID: "--id qemu"
381 TEST_PY_TEST_SPEC: "not sleep"
Bin Mengddaa6b12019-10-28 07:25:03 -0700382 steps:
383 - script: |
384 cat << EOF > test.sh
385 set -ex
386 # make environment variables available as tests are running inside a container
387 export WORK_DIR="${WORK_DIR}"
388 export TEST_PY_BD="${TEST_PY_BD}"
389 export TEST_PY_ID="${TEST_PY_ID}"
390 export TEST_PY_TEST_SPEC="${TEST_PY_TEST_SPEC}"
Tom Rini99a1bb32019-11-06 19:30:47 -0500391 export OVERRIDE="${OVERRIDE}"
Simon Glass2e32f5d2022-08-03 12:13:09 -0600392 export BUILD_ENV="${BUILD_ENV}"
Bin Mengddaa6b12019-10-28 07:25:03 -0700393 EOF
394 cat << "EOF" >> test.sh
395 # the below corresponds to .gitlab-ci.yml "before_script"
396 cd ${WORK_DIR}
Tom Rinie0f979b2022-11-21 12:52:40 -0500397 git config --global --add safe.directory ${WORK_DIR}
Tom Rini2a1df582021-02-24 17:05:04 -0500398 git clone --depth=1 https://source.denx.de/u-boot/u-boot-test-hooks /tmp/uboot-test-hooks
Bin Mengddaa6b12019-10-28 07:25:03 -0700399 ln -s travis-ci /tmp/uboot-test-hooks/bin/`hostname`
400 ln -s travis-ci /tmp/uboot-test-hooks/py/`hostname`
Bin Mengddaa6b12019-10-28 07:25:03 -0700401 grub-mkimage --prefix=\"\" -o ~/grub_x86.efi -O i386-efi normal echo lsefimmap lsefi lsefisystab efinet tftp minicmd
402 grub-mkimage --prefix=\"\" -o ~/grub_x64.efi -O x86_64-efi normal echo lsefimmap lsefi lsefisystab efinet tftp minicmd
Bin Mengb68d9d62020-03-28 07:25:29 -0700403 if [[ "${TEST_PY_BD}" == "qemu-riscv32_spl" ]]; then
Bin Meng9d41bba2023-06-20 13:55:00 +0800404 wget -O - https://github.com/riscv-software-src/opensbi/releases/download/v1.2/opensbi-1.2-rv-bin.tar.xz | tar -C /tmp -xJ;
405 export OPENSBI=/tmp/opensbi-1.2-rv-bin/share/opensbi/ilp32/generic/firmware/fw_dynamic.bin;
Bin Mengb68d9d62020-03-28 07:25:29 -0700406 fi
Bin Meng0ae41062021-08-26 23:33:35 +0800407 if [[ "${TEST_PY_BD}" == "qemu-riscv64_spl" ]] || [[ "${TEST_PY_BD}" == "sifive_unleashed" ]]; then
Bin Meng9d41bba2023-06-20 13:55:00 +0800408 wget -O - https://github.com/riscv-software-src/opensbi/releases/download/v1.2/opensbi-1.2-rv-bin.tar.xz | tar -C /tmp -xJ;
409 export OPENSBI=/tmp/opensbi-1.2-rv-bin/share/opensbi/lp64/generic/firmware/fw_dynamic.bin;
Bin Mengb68d9d62020-03-28 07:25:29 -0700410 fi
Bin Mengddaa6b12019-10-28 07:25:03 -0700411 # the below corresponds to .gitlab-ci.yml "script"
412 cd ${WORK_DIR}
Simon Glass28d83e72020-03-18 09:42:55 -0600413 export UBOOT_TRAVIS_BUILD_DIR=/tmp/${TEST_PY_BD};
Simon Glassc2f01902023-01-15 14:16:00 -0700414 if [ -n "${BUILD_ENV}" ]; then
415 export ${BUILD_ENV};
416 fi
Tom Rini95f1c6cb2023-07-22 00:14:46 +0530417 pip install -r tools/buildman/requirements.txt
Simon Glass87c80462020-03-18 09:43:00 -0600418 tools/buildman/buildman -o ${UBOOT_TRAVIS_BUILD_DIR} -w -E -W -e --board ${TEST_PY_BD} ${OVERRIDE}
Heinrich Schuchardt0c9fdd02020-07-14 00:40:19 +0200419 cp ~/grub_x86.efi ${UBOOT_TRAVIS_BUILD_DIR}/
420 cp ~/grub_x64.efi ${UBOOT_TRAVIS_BUILD_DIR}/
421 cp /opt/grub/grubriscv64.efi ${UBOOT_TRAVIS_BUILD_DIR}/grub_riscv64.efi
Heinrich Schuchardt0c9fdd02020-07-14 00:40:19 +0200422 cp /opt/grub/grubaa64.efi ${UBOOT_TRAVIS_BUILD_DIR}/grub_arm64.efi
423 cp /opt/grub/grubarm.efi ${UBOOT_TRAVIS_BUILD_DIR}/grub_arm.efi
Bin Meng0ae41062021-08-26 23:33:35 +0800424 # create sdcard / spi-nor images for sifive unleashed using genimage
425 if [[ "${TEST_PY_BD}" == "sifive_unleashed" ]]; then
426 mkdir -p root;
427 cp ${UBOOT_TRAVIS_BUILD_DIR}/spl/u-boot-spl.bin .;
428 cp ${UBOOT_TRAVIS_BUILD_DIR}/u-boot.itb .;
429 rm -rf tmp;
430 genimage --inputpath . --config board/sifive/unleashed/genimage_sdcard.cfg;
431 cp images/sdcard.img ${UBOOT_TRAVIS_BUILD_DIR}/;
432 rm -rf tmp;
433 genimage --inputpath . --config board/sifive/unleashed/genimage_spi-nor.cfg;
434 cp images/spi-nor.img ${UBOOT_TRAVIS_BUILD_DIR}/;
435 fi
Simon Glass13e1fa02022-01-21 10:23:01 -0700436 if [[ "${TEST_PY_BD}" == "coreboot" ]]; then
Simon Glass61e507b2023-08-11 12:17:43 -0600437 wget -O - "https://drive.google.com/uc?id=1uJ2VkUQ8czWFZmhJQ90Tp8V_zrJ6BrBH&export=download" |xz -dc >${UBOOT_TRAVIS_BUILD_DIR}/coreboot.rom;
Simon Glass13e1fa02022-01-21 10:23:01 -0700438 wget -O - "https://drive.google.com/uc?id=149Cz-5SZXHNKpi9xg6R_5XITWohu348y&export=download" >cbfstool;
439 chmod a+x cbfstool;
440 ./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;
441 fi
Tom Rini17e41f22019-10-31 10:45:03 -0400442 virtualenv -p /usr/bin/python3 /tmp/venv
443 . /tmp/venv/bin/activate
444 pip install -r test/py/requirements.txt
Tom Rini9303a4c2023-02-28 15:28:48 -0500445 pip install pytest-azurepipelines
Tom Rini528facb2019-11-01 13:59:14 -0400446 export PATH=/opt/qemu/bin:/tmp/uboot-test-hooks/bin:${PATH};
Bin Mengddaa6b12019-10-28 07:25:03 -0700447 export PYTHONPATH=/tmp/uboot-test-hooks/py/travis-ci;
Simon Glass2600f7e2020-03-18 09:42:56 -0600448 # "${var:+"-k $var"}" expands to "" if $var is empty, "-k $var" if not
Tom Rinida8ba7f2023-02-28 15:28:49 -0500449 ./test/py/test.py -ra -o cache_dir="$UBOOT_TRAVIS_BUILD_DIR"/.pytest_cache --bd ${TEST_PY_BD} ${TEST_PY_ID} ${TEST_PY_TEST_SPEC:+"-k ${TEST_PY_TEST_SPEC}"} --build-dir "$UBOOT_TRAVIS_BUILD_DIR" --report-dir "$UBOOT_TRAVIS_BUILD_DIR";
Bin Mengddaa6b12019-10-28 07:25:03 -0700450 # the below corresponds to .gitlab-ci.yml "after_script"
Tom Rini6d4656b2020-02-07 11:45:55 -0500451 rm -rf /tmp/uboot-test-hooks /tmp/venv
Bin Mengddaa6b12019-10-28 07:25:03 -0700452 EOF
453 cat test.sh
454 # make current directory writeable to uboot user inside the container
455 # as sandbox testing need create files like spi flash images, etc.
456 # (TODO: clean up this in the future)
457 chmod 777 .
Alper Nebi Yasakc6d25c12021-06-21 21:51:56 +0300458 # Filesystem tests need extra docker args to run
459 set --
460 if [[ "${TEST_PY_BD}" == "sandbox" ]]; then
461 # mount -o loop needs the loop devices
462 if modprobe loop; then
463 for d in $(find /dev -maxdepth 1 -name 'loop*'); do
464 set -- "$@" --device $d:$d
465 done
466 fi
467 # Needed for mount syscall (for guestmount as well)
468 set -- "$@" --cap-add SYS_ADMIN
469 # Default apparmor profile denies mounts
470 set -- "$@" --security-opt apparmor=unconfined
471 fi
Alper Nebi Yasak6fb91f62021-06-21 21:51:55 +0300472 # Some tests using libguestfs-tools need the fuse device to run
Alper Nebi Yasakc6d25c12021-06-21 21:51:56 +0300473 docker run "$@" --device /dev/fuse:/dev/fuse -v $PWD:$(work_dir) $(ci_runner_image) /bin/bash $(work_dir)/test.sh
Tom Rini6acc0192023-07-11 22:33:03 -0400474 retryCountOnTaskFailure: 2 # QEMU may be too slow, etc.
Bin Mengddaa6b12019-10-28 07:25:03 -0700475
Tom Rini4c268a62022-01-11 19:14:28 -0500476- stage: world_build
477 jobs:
Bin Mengddaa6b12019-10-28 07:25:03 -0700478 - job: build_the_world
Tom Rini88a33972023-08-20 13:31:26 -0400479 timeoutInMinutes: 0 # Use the maximum allowed
Bin Mengddaa6b12019-10-28 07:25:03 -0700480 displayName: 'Build the World'
481 pool:
482 vmImage: $(ubuntu_vm)
483 strategy:
484 # Use almost the same target division in .travis.yml, only merged
Tom Rini53320122022-04-06 09:21:25 -0400485 # 3 small build jobs (arc/microblaze/xtensa) into one.
Bin Mengddaa6b12019-10-28 07:25:03 -0700486 matrix:
Tom Rini8b3107a2023-08-20 13:31:27 -0400487 am33xx_at91_kirkwood_mvebu_omap:
488 BUILDMAN: "am33xx at91_kirkwood mvebu omap -x siemens"
489 amlogic_bcm_boundary_engicam_siemens_technexion_oradex:
490 BUILDMAN: "amlogic bcm boundary engicam siemens technexion toradex -x mips"
491 arm_nxp_minus_imx:
492 BUILDMAN: "freescale -x powerpc,m68k,imx,mx"
Bin Mengddaa6b12019-10-28 07:25:03 -0700493 imx:
Tom Rini8b3107a2023-08-20 13:31:27 -0400494 BUILDMAN: "mx imx -x boundary,engicam,technexion,toradex"
495 rk:
496 BUILDMAN: "rk"
497 sunxi:
498 BUILDMAN: "sunxi"
Tom Rinifdb677d2022-08-09 21:08:52 -0400499 powerpc:
Tom Rini8b3107a2023-08-20 13:31:27 -0400500 BUILDMAN: "powerpc"
501 arm_catch_all:
502 BUILDMAN: "arm -x aarch64,am33xx,at91,bcm,ls1,kirkwood,mvebu,omap,rk,siemens,mx,sunxi,technexion,toradex"
Bin Mengddaa6b12019-10-28 07:25:03 -0700503 aarch64_catch_all:
Tom Rini8b3107a2023-08-20 13:31:27 -0400504 BUILDMAN: "aarch64 -x amlogic,bcm,engicam,imx,ls1,ls2,lx216,mvebu,rk,siemens,sunxi,toradex"
505 everything_but_arm_and_powerpc:
506 BUILDMAN: "-x arm,powerpc"
Bin Mengddaa6b12019-10-28 07:25:03 -0700507 steps:
508 - script: |
509 cat << EOF > build.sh
510 set -ex
511 cd ${WORK_DIR}
512 # make environment variables available as tests are running inside a container
513 export BUILDMAN="${BUILDMAN}"
Tom Rinie0f979b2022-11-21 12:52:40 -0500514 git config --global --add safe.directory ${WORK_DIR}
Tom Rini95f1c6cb2023-07-22 00:14:46 +0530515 pip install -r tools/buildman/requirements.txt
Bin Mengddaa6b12019-10-28 07:25:03 -0700516 EOF
517 cat << "EOF" >> build.sh
518 if [[ "${BUILDMAN}" != "" ]]; then
519 ret=0;
Tom Rini93ebd462022-11-09 19:14:53 -0700520 tools/buildman/buildman -o /tmp -PEWM ${BUILDMAN} ${OVERRIDE} || ret=$?;
Simon Glassda499352020-03-18 09:42:57 -0600521 if [[ $ret -ne 0 ]]; then
Simon Glassad8eaed2020-03-18 09:42:53 -0600522 tools/buildman/buildman -o /tmp -seP ${BUILDMAN};
Bin Mengddaa6b12019-10-28 07:25:03 -0700523 exit $ret;
524 fi;
525 fi
526 EOF
527 cat build.sh
528 docker run -v $PWD:$(work_dir) $(ci_runner_image) /bin/bash $(work_dir)/build.sh