.azure-pipelines.yml 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468
  1. variables:
  2. windows_vm: vs2017-win2016
  3. ubuntu_vm: ubuntu-18.04
  4. macos_vm: macOS-10.15
  5. ci_runner_image: trini/u-boot-gitlab-ci-runner:focal-20210723-30Sep2021
  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.
  9. container_option: -u 0
  10. work_dir: /u
  11. jobs:
  12. - job: tools_only_windows
  13. displayName: 'Ensure host tools build for Windows'
  14. pool:
  15. vmImage: $(windows_vm)
  16. steps:
  17. - powershell: |
  18. (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")
  19. displayName: 'Install MSYS2'
  20. - script: |
  21. sfx.exe -y -o%CD:~0,2%\
  22. %CD:~0,2%\msys64\usr\bin\bash -lc "pacman --noconfirm -Syyuu"
  23. displayName: 'Update MSYS2'
  24. - script: |
  25. %CD:~0,2%\msys64\usr\bin\bash -lc "pacman --noconfirm --needed -Sy make gcc bison flex diffutils openssl-devel"
  26. displayName: 'Install Toolchain'
  27. - script: |
  28. echo make tools-only_defconfig tools-only NO_SDL=1 > build-tools.sh
  29. %CD:~0,2%\msys64\usr\bin\bash -lc "bash build-tools.sh"
  30. displayName: 'Build Host Tools'
  31. env:
  32. # Tell MSYS2 we need a POSIX emulation layer
  33. MSYSTEM: MSYS
  34. # Tell MSYS2 not to ‘cd’ our startup directory to HOME
  35. CHERE_INVOKING: yes
  36. - job: tools_only_macOS
  37. displayName: 'Ensure host tools build for macOS X'
  38. pool:
  39. vmImage: $(macos_vm)
  40. steps:
  41. - script: brew install make
  42. displayName: Brew install dependencies
  43. - script: |
  44. gmake tools-only_config tools-only NO_SDL=1 \
  45. HOSTCFLAGS="-I/usr/local/opt/openssl@1.1/include" \
  46. HOSTLDFLAGS="-L/usr/local/opt/openssl@1.1/lib" \
  47. -j$(sysctl -n hw.logicalcpu)
  48. displayName: 'Perform tools-only build'
  49. - job: cppcheck
  50. displayName: 'Static code analysis with cppcheck'
  51. pool:
  52. vmImage: $(ubuntu_vm)
  53. container:
  54. image: $(ci_runner_image)
  55. options: $(container_option)
  56. steps:
  57. - script: cppcheck -j$(nproc) --force --quiet --inline-suppr .
  58. - job: htmldocs
  59. displayName: 'Build HTML documentation'
  60. pool:
  61. vmImage: $(ubuntu_vm)
  62. container:
  63. image: $(ci_runner_image)
  64. options: $(container_option)
  65. steps:
  66. - script: |
  67. virtualenv -p /usr/bin/python3 /tmp/venvhtml
  68. . /tmp/venvhtml/bin/activate
  69. pip install -r doc/sphinx/requirements.txt
  70. make htmldocs
  71. - job: todo
  72. displayName: 'Search for TODO within source tree'
  73. pool:
  74. vmImage: $(ubuntu_vm)
  75. container:
  76. image: $(ci_runner_image)
  77. options: $(container_option)
  78. steps:
  79. - script: grep -r TODO .
  80. - script: grep -r FIXME .
  81. - script: grep -r HACK . | grep -v HACKKIT
  82. - job: sloccount
  83. displayName: 'Some statistics about the code base'
  84. pool:
  85. vmImage: $(ubuntu_vm)
  86. container:
  87. image: $(ci_runner_image)
  88. options: $(container_option)
  89. steps:
  90. - script: sloccount .
  91. - job: maintainers
  92. displayName: 'Ensure all configs have MAINTAINERS entries'
  93. pool:
  94. vmImage: $(ubuntu_vm)
  95. container:
  96. image: $(ci_runner_image)
  97. options: $(container_option)
  98. steps:
  99. - script: |
  100. if [ `./tools/genboardscfg.py -f 2>&1 | wc -l` -ne 0 ]; then exit 1; fi
  101. - job: tools_only
  102. displayName: 'Ensure host 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 tools-only -j$(nproc)
  111. - job: envtools
  112. displayName: 'Ensure env tools build'
  113. pool:
  114. vmImage: $(ubuntu_vm)
  115. container:
  116. image: $(ci_runner_image)
  117. options: $(container_option)
  118. steps:
  119. - script: |
  120. make tools-only_config envtools -j$(nproc)
  121. - job: utils
  122. displayName: 'Run binman, buildman, dtoc, Kconfig and patman testsuites'
  123. pool:
  124. vmImage: $(ubuntu_vm)
  125. steps:
  126. - script: |
  127. cat << EOF > build.sh
  128. set -ex
  129. cd ${WORK_DIR}
  130. EOF
  131. cat << "EOF" >> build.sh
  132. git config --global user.name "Azure Pipelines"
  133. git config --global user.email bmeng.cn@gmail.com
  134. export USER=azure
  135. virtualenv -p /usr/bin/python3 /tmp/venv
  136. . /tmp/venv/bin/activate
  137. pip install -r test/py/requirements.txt
  138. export UBOOT_TRAVIS_BUILD_DIR=/tmp/sandbox_spl
  139. export PYTHONPATH=${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc/pylibfdt
  140. export PATH=${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc:${PATH}
  141. ./tools/buildman/buildman -T0 -o ${UBOOT_TRAVIS_BUILD_DIR} -w --board sandbox_spl
  142. ./tools/binman/binman --toolpath ${UBOOT_TRAVIS_BUILD_DIR}/tools test
  143. ./tools/buildman/buildman -t
  144. ./tools/dtoc/dtoc -t
  145. ./tools/patman/patman test
  146. make O=${UBOOT_TRAVIS_BUILD_DIR} testconfig
  147. EOF
  148. cat build.sh
  149. # We cannot use "container" like other jobs above, as buildman
  150. # seems to hang forever with pre-configured "container" environment
  151. docker run -v $PWD:$(work_dir) $(ci_runner_image) /bin/bash $(work_dir)/build.sh
  152. - job: nokia_rx51_test
  153. displayName: 'Run tests for Nokia RX-51 (aka N900)'
  154. pool:
  155. vmImage: $(ubuntu_vm)
  156. container:
  157. image: $(ci_runner_image)
  158. options: $(container_option)
  159. steps:
  160. - script: |
  161. ./tools/buildman/buildman --fetch-arch arm
  162. export PATH=~/.buildman-toolchains/gcc-9.2.0-nolibc/arm-linux-gnueabi/bin/:$PATH
  163. test/nokia_rx51_test.sh
  164. - job: test_py
  165. displayName: 'test.py'
  166. pool:
  167. vmImage: $(ubuntu_vm)
  168. strategy:
  169. matrix:
  170. sandbox:
  171. TEST_PY_BD: "sandbox"
  172. sandbox_clang:
  173. TEST_PY_BD: "sandbox"
  174. OVERRIDE: "-O clang-12"
  175. sandbox_spl:
  176. TEST_PY_BD: "sandbox_spl"
  177. TEST_PY_TEST_SPEC: "test_ofplatdata or test_handoff or test_spl"
  178. sandbox_noinst:
  179. TEST_PY_BD: "sandbox_noinst"
  180. TEST_PY_TEST_SPEC: "test_ofplatdata or test_handoff or test_spl"
  181. sandbox_flattree:
  182. TEST_PY_BD: "sandbox_flattree"
  183. evb_ast2500:
  184. TEST_PY_BD: "evb-ast2500"
  185. TEST_PY_ID: "--id qemu"
  186. integratorcp_cm926ejs:
  187. TEST_PY_BD: "integratorcp_cm926ejs"
  188. TEST_PY_ID: "--id qemu"
  189. TEST_PY_TEST_SPEC: "not sleep"
  190. qemu_arm:
  191. TEST_PY_BD: "qemu_arm"
  192. TEST_PY_TEST_SPEC: "not sleep"
  193. qemu_arm64:
  194. TEST_PY_BD: "qemu_arm64"
  195. TEST_PY_TEST_SPEC: "not sleep"
  196. qemu_malta:
  197. TEST_PY_BD: "malta"
  198. TEST_PY_ID: "--id qemu"
  199. TEST_PY_TEST_SPEC: "not sleep and not efi"
  200. qemu_maltael:
  201. TEST_PY_BD: "maltael"
  202. TEST_PY_ID: "--id qemu"
  203. TEST_PY_TEST_SPEC: "not sleep and not efi"
  204. qemu_malta64:
  205. TEST_PY_BD: "malta64"
  206. TEST_PY_ID: "--id qemu"
  207. TEST_PY_TEST_SPEC: "not sleep and not efi"
  208. qemu_malta64el:
  209. TEST_PY_BD: "malta64el"
  210. TEST_PY_ID: "--id qemu"
  211. TEST_PY_TEST_SPEC: "not sleep and not efi"
  212. qemu_ppce500:
  213. TEST_PY_BD: "qemu-ppce500"
  214. TEST_PY_TEST_SPEC: "not sleep"
  215. qemu_riscv32:
  216. TEST_PY_BD: "qemu-riscv32"
  217. TEST_PY_TEST_SPEC: "not sleep"
  218. qemu_riscv64:
  219. TEST_PY_BD: "qemu-riscv64"
  220. TEST_PY_TEST_SPEC: "not sleep"
  221. qemu_riscv32_spl:
  222. TEST_PY_BD: "qemu-riscv32_spl"
  223. TEST_PY_TEST_SPEC: "not sleep"
  224. qemu_riscv64_spl:
  225. TEST_PY_BD: "qemu-riscv64_spl"
  226. TEST_PY_TEST_SPEC: "not sleep"
  227. qemu_x86:
  228. TEST_PY_BD: "qemu-x86"
  229. TEST_PY_TEST_SPEC: "not sleep"
  230. qemu_x86_64:
  231. TEST_PY_BD: "qemu-x86_64"
  232. TEST_PY_TEST_SPEC: "not sleep"
  233. r2dplus_i82557c:
  234. TEST_PY_BD: "r2dplus"
  235. TEST_PY_ID: "--id i82557c_qemu"
  236. r2dplus_pcnet:
  237. TEST_PY_BD: "r2dplus"
  238. TEST_PY_ID: "--id pcnet_qemu"
  239. r2dplus_rtl8139:
  240. TEST_PY_BD: "r2dplus"
  241. TEST_PY_ID: "--id rtl8139_qemu"
  242. r2dplus_tulip:
  243. TEST_PY_BD: "r2dplus"
  244. TEST_PY_ID: "--id tulip_qemu"
  245. xilinx_zynq_virt:
  246. TEST_PY_BD: "xilinx_zynq_virt"
  247. TEST_PY_ID: "--id qemu"
  248. TEST_PY_TEST_SPEC: "not sleep"
  249. xilinx_versal_virt:
  250. TEST_PY_BD: "xilinx_versal_virt"
  251. TEST_PY_ID: "--id qemu"
  252. TEST_PY_TEST_SPEC: "not sleep"
  253. xtfpga:
  254. TEST_PY_BD: "xtfpga"
  255. TEST_PY_ID: "--id qemu"
  256. TEST_PY_TEST_SPEC: "not sleep"
  257. steps:
  258. - script: |
  259. cat << EOF > test.sh
  260. set -ex
  261. # make environment variables available as tests are running inside a container
  262. export WORK_DIR="${WORK_DIR}"
  263. export TEST_PY_BD="${TEST_PY_BD}"
  264. export TEST_PY_ID="${TEST_PY_ID}"
  265. export TEST_PY_TEST_SPEC="${TEST_PY_TEST_SPEC}"
  266. export OVERRIDE="${OVERRIDE}"
  267. EOF
  268. cat << "EOF" >> test.sh
  269. # the below corresponds to .gitlab-ci.yml "before_script"
  270. cd ${WORK_DIR}
  271. git clone --depth=1 https://source.denx.de/u-boot/u-boot-test-hooks /tmp/uboot-test-hooks
  272. ln -s travis-ci /tmp/uboot-test-hooks/bin/`hostname`
  273. ln -s travis-ci /tmp/uboot-test-hooks/py/`hostname`
  274. grub-mkimage --prefix=\"\" -o ~/grub_x86.efi -O i386-efi normal echo lsefimmap lsefi lsefisystab efinet tftp minicmd
  275. grub-mkimage --prefix=\"\" -o ~/grub_x64.efi -O x86_64-efi normal echo lsefimmap lsefi lsefisystab efinet tftp minicmd
  276. if [[ "${TEST_PY_BD}" == "qemu-riscv32_spl" ]]; then
  277. wget -O - https://github.com/riscv/opensbi/releases/download/v0.9/opensbi-0.9-rv-bin.tar.xz | tar -C /tmp -xJ;
  278. export OPENSBI=/tmp/opensbi-0.9-rv-bin/share/opensbi/ilp32/generic/firmware/fw_dynamic.bin;
  279. fi
  280. if [[ "${TEST_PY_BD}" == "qemu-riscv64_spl" ]]; then
  281. wget -O - https://github.com/riscv/opensbi/releases/download/v0.9/opensbi-0.9-rv-bin.tar.xz | tar -C /tmp -xJ;
  282. export OPENSBI=/tmp/opensbi-0.9-rv-bin/share/opensbi/lp64/generic/firmware/fw_dynamic.bin;
  283. fi
  284. # the below corresponds to .gitlab-ci.yml "script"
  285. cd ${WORK_DIR}
  286. export UBOOT_TRAVIS_BUILD_DIR=/tmp/${TEST_PY_BD};
  287. tools/buildman/buildman -o ${UBOOT_TRAVIS_BUILD_DIR} -w -E -W -e --board ${TEST_PY_BD} ${OVERRIDE}
  288. cp ~/grub_x86.efi ${UBOOT_TRAVIS_BUILD_DIR}/
  289. cp ~/grub_x64.efi ${UBOOT_TRAVIS_BUILD_DIR}/
  290. cp /opt/grub/grubriscv64.efi ${UBOOT_TRAVIS_BUILD_DIR}/grub_riscv64.efi
  291. cp /opt/grub/grubaa64.efi ${UBOOT_TRAVIS_BUILD_DIR}/grub_arm64.efi
  292. cp /opt/grub/grubarm.efi ${UBOOT_TRAVIS_BUILD_DIR}/grub_arm.efi
  293. virtualenv -p /usr/bin/python3 /tmp/venv
  294. . /tmp/venv/bin/activate
  295. pip install -r test/py/requirements.txt
  296. export PATH=/opt/qemu/bin:/tmp/uboot-test-hooks/bin:${PATH};
  297. export PYTHONPATH=/tmp/uboot-test-hooks/py/travis-ci;
  298. # "${var:+"-k $var"}" expands to "" if $var is empty, "-k $var" if not
  299. ./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";
  300. # the below corresponds to .gitlab-ci.yml "after_script"
  301. rm -rf /tmp/uboot-test-hooks /tmp/venv
  302. EOF
  303. cat test.sh
  304. # make current directory writeable to uboot user inside the container
  305. # as sandbox testing need create files like spi flash images, etc.
  306. # (TODO: clean up this in the future)
  307. chmod 777 .
  308. # Filesystem tests need extra docker args to run
  309. set --
  310. if [[ "${TEST_PY_BD}" == "sandbox" ]]; then
  311. # mount -o loop needs the loop devices
  312. if modprobe loop; then
  313. for d in $(find /dev -maxdepth 1 -name 'loop*'); do
  314. set -- "$@" --device $d:$d
  315. done
  316. fi
  317. # Needed for mount syscall (for guestmount as well)
  318. set -- "$@" --cap-add SYS_ADMIN
  319. # Default apparmor profile denies mounts
  320. set -- "$@" --security-opt apparmor=unconfined
  321. fi
  322. # Some tests using libguestfs-tools need the fuse device to run
  323. docker run "$@" --device /dev/fuse:/dev/fuse -v $PWD:$(work_dir) $(ci_runner_image) /bin/bash $(work_dir)/test.sh
  324. - job: build_the_world
  325. displayName: 'Build the World'
  326. pool:
  327. vmImage: $(ubuntu_vm)
  328. strategy:
  329. # Use almost the same target division in .travis.yml, only merged
  330. # 4 small build jobs (arc/microblaze/nds32/xtensa) into one.
  331. matrix:
  332. arc_microblaze_nds32_xtensa:
  333. BUILDMAN: "arc microblaze nds32 xtensa"
  334. arm11_arm7_arm920t_arm946es:
  335. BUILDMAN: "arm11 arm7 arm920t arm946es"
  336. arm926ejs:
  337. BUILDMAN: "arm926ejs -x freescale,siemens,at91,kirkwood,omap"
  338. at91_non_armv7:
  339. BUILDMAN: "at91 -x armv7"
  340. at91_non_arm926ejs:
  341. BUILDMAN: "at91 -x arm926ejs"
  342. boundary_engicam_toradex:
  343. BUILDMAN: "boundary engicam toradex"
  344. arm_bcm:
  345. BUILDMAN: "bcm -x mips"
  346. nxp_arm32:
  347. BUILDMAN: "freescale -x powerpc,m68k,aarch64,ls101,ls102,ls104,ls108,ls20,lx216"
  348. nxp_ls101x:
  349. BUILDMAN: "freescale&ls101"
  350. nxp_ls102x:
  351. BUILDMAN: "freescale&ls102"
  352. nxp_ls104x:
  353. BUILDMAN: "freescale&ls104"
  354. nxp_ls108x:
  355. BUILDMAN: "freescale&ls108"
  356. nxp_ls20xx:
  357. BUILDMAN: "freescale&ls20"
  358. nxp_lx216x:
  359. BUILDMAN: "freescale&lx216"
  360. imx6:
  361. BUILDMAN: "mx6 -x boundary,engicam,freescale,technexion,toradex"
  362. imx:
  363. BUILDMAN: "mx -x mx6,freescale,technexion,toradex"
  364. imx8:
  365. BUILDMAN: "imx8"
  366. keystone2_keystone3:
  367. BUILDMAN: "k2 k3"
  368. samsung_socfpga:
  369. BUILDMAN: "samsung socfpga"
  370. sun4i:
  371. BUILDMAN: "sun4i"
  372. sun5i:
  373. BUILDMAN: "sun5i"
  374. sun6i:
  375. BUILDMAN: "sun6i"
  376. sun7i:
  377. BUILDMAN: "sun7i"
  378. sun8i_32bit:
  379. BUILDMAN: "sun8i&armv7"
  380. sun8i_64bit:
  381. BUILDMAN: "sun8i&aarch64"
  382. sun9i:
  383. BUILDMAN: "sun9i"
  384. sun50i:
  385. BUILDMAN: "sun50i"
  386. arm_catch_all:
  387. 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"
  388. sandbox_x86:
  389. BUILDMAN: "sandbox x86"
  390. technexion:
  391. BUILDMAN: "technexion"
  392. kirkwood:
  393. BUILDMAN: "kirkwood"
  394. mvebu:
  395. BUILDMAN: "mvebu"
  396. m68k:
  397. BUILDMAN: "m68k"
  398. mips:
  399. BUILDMAN: "mips"
  400. non_fsl_ppc:
  401. BUILDMAN: "powerpc -x freescale"
  402. mpc85xx_freescale:
  403. BUILDMAN: "mpc85xx&freescale -x t208xrdb -x t102* -x p1_p2_rdb_pc -x p1010rdb -x corenet_ds -x bsc91*"
  404. t208xrdb_corenet_ds:
  405. BUILDMAN: "t208xrdb corenet_ds"
  406. fsl_ppc:
  407. BUILDMAN: "mpc83xx&freescale"
  408. t102x:
  409. BUILDMAN: "t102*"
  410. p1_p2_rdb_pc:
  411. BUILDMAN: "p1_p2_rdb_pc"
  412. p1010rdb_bsc91:
  413. BUILDMAN: "p1010rdb bsc91"
  414. siemens:
  415. BUILDMAN: "siemens"
  416. tegra:
  417. BUILDMAN: "tegra -x toradex"
  418. am33xx_no_siemens:
  419. BUILDMAN: "am33xx -x siemens"
  420. omap:
  421. BUILDMAN: "omap"
  422. uniphier:
  423. BUILDMAN: "uniphier"
  424. aarch64_catch_all:
  425. BUILDMAN: "aarch64 -x bcm,imx8,k3,tegra,ls1,ls2,lx216,mvebu,uniphier,renesas,sunxi,samsung,socfpga,rk,versal,zynq"
  426. rockchip:
  427. BUILDMAN: "rk"
  428. renesas:
  429. BUILDMAN: "renesas"
  430. zynq:
  431. BUILDMAN: "zynq&armv7"
  432. zynqmp_versal:
  433. BUILDMAN: "versal|zynqmp&aarch64"
  434. riscv:
  435. BUILDMAN: "riscv"
  436. steps:
  437. - script: |
  438. cat << EOF > build.sh
  439. set -ex
  440. cd ${WORK_DIR}
  441. # make environment variables available as tests are running inside a container
  442. export BUILDMAN="${BUILDMAN}"
  443. EOF
  444. cat << "EOF" >> build.sh
  445. if [[ "${BUILDMAN}" != "" ]]; then
  446. ret=0;
  447. tools/buildman/buildman -o /tmp -P -E -W ${BUILDMAN} ${OVERRIDE} || ret=$?;
  448. if [[ $ret -ne 0 ]]; then
  449. tools/buildman/buildman -o /tmp -seP ${BUILDMAN};
  450. exit $ret;
  451. fi;
  452. fi
  453. EOF
  454. cat build.sh
  455. docker run -v $PWD:$(work_dir) $(ci_runner_image) /bin/bash $(work_dir)/build.sh