.gitlab-ci.yml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368
  1. # SPDX-License-Identifier: GPL-2.0+
  2. # Grab our configured image. The source for this is found at:
  3. # https://source.denx.de/u-boot/gitlab-ci-runner
  4. image: trini/u-boot-gitlab-ci-runner:focal-20211006-14Nov2021
  5. # We run some tests in different order, to catch some failures quicker.
  6. stages:
  7. - testsuites
  8. - test.py
  9. - world build
  10. .buildman_and_testpy_template: &buildman_and_testpy_dfn
  11. stage: test.py
  12. before_script:
  13. # Clone uboot-test-hooks
  14. - git clone --depth=1 https://source.denx.de/u-boot/u-boot-test-hooks /tmp/uboot-test-hooks
  15. - ln -s travis-ci /tmp/uboot-test-hooks/bin/`hostname`
  16. - ln -s travis-ci /tmp/uboot-test-hooks/py/`hostname`
  17. - grub-mkimage --prefix="" -o ~/grub_x86.efi -O i386-efi normal echo lsefimmap lsefi lsefisystab efinet tftp minicmd
  18. - grub-mkimage --prefix="" -o ~/grub_x64.efi -O x86_64-efi normal echo lsefimmap lsefi lsefisystab efinet tftp minicmd
  19. - if [[ "${TEST_PY_BD}" == "qemu-riscv32_spl" ]]; then
  20. wget -O - https://github.com/riscv/opensbi/releases/download/v0.9/opensbi-0.9-rv-bin.tar.xz | tar -C /tmp -xJ;
  21. export OPENSBI=/tmp/opensbi-0.9-rv-bin/share/opensbi/ilp32/generic/firmware/fw_dynamic.bin;
  22. fi
  23. - if [[ "${TEST_PY_BD}" == "qemu-riscv64_spl" ]] || [[ "${TEST_PY_BD}" == "sifive_unleashed" ]]; then
  24. wget -O - https://github.com/riscv/opensbi/releases/download/v0.9/opensbi-0.9-rv-bin.tar.xz | tar -C /tmp -xJ;
  25. export OPENSBI=/tmp/opensbi-0.9-rv-bin/share/opensbi/lp64/generic/firmware/fw_dynamic.bin;
  26. fi
  27. after_script:
  28. - rm -rf /tmp/uboot-test-hooks /tmp/venv
  29. script:
  30. # If we've been asked to use clang only do one configuration.
  31. - export UBOOT_TRAVIS_BUILD_DIR=/tmp/${TEST_PY_BD}
  32. - tools/buildman/buildman -o ${UBOOT_TRAVIS_BUILD_DIR} -w -E -W -e
  33. --board ${TEST_PY_BD} ${OVERRIDE}
  34. - cp ~/grub_x86.efi $UBOOT_TRAVIS_BUILD_DIR/
  35. - cp ~/grub_x64.efi $UBOOT_TRAVIS_BUILD_DIR/
  36. - cp /opt/grub/grubriscv64.efi $UBOOT_TRAVIS_BUILD_DIR/grub_riscv64.efi
  37. - cp /opt/grub/grubaa64.efi $UBOOT_TRAVIS_BUILD_DIR/grub_arm64.efi
  38. - cp /opt/grub/grubarm.efi $UBOOT_TRAVIS_BUILD_DIR/grub_arm.efi
  39. # create sdcard / spi-nor images for sifive unleashed using genimage
  40. - if [[ "${TEST_PY_BD}" == "sifive_unleashed" ]]; then
  41. mkdir -p root;
  42. cp ${UBOOT_TRAVIS_BUILD_DIR}/spl/u-boot-spl.bin .;
  43. cp ${UBOOT_TRAVIS_BUILD_DIR}/u-boot.itb .;
  44. rm -rf tmp;
  45. genimage --inputpath . --config board/sifive/unleashed/genimage_sdcard.cfg;
  46. cp images/sdcard.img ${UBOOT_TRAVIS_BUILD_DIR}/;
  47. rm -rf tmp;
  48. genimage --inputpath . --config board/sifive/unleashed/genimage_spi-nor.cfg;
  49. cp images/spi-nor.img ${UBOOT_TRAVIS_BUILD_DIR}/;
  50. fi
  51. - virtualenv -p /usr/bin/python3 /tmp/venv
  52. - . /tmp/venv/bin/activate
  53. - pip install -r test/py/requirements.txt
  54. # "${var:+"-k $var"}" expands to "" if $var is empty, "-k $var" if not
  55. - export PATH=/opt/qemu/bin:/tmp/uboot-test-hooks/bin:${PATH};
  56. export PYTHONPATH=/tmp/uboot-test-hooks/py/travis-ci;
  57. ./test/py/test.py -ra --bd ${TEST_PY_BD} ${TEST_PY_ID}
  58. ${TEST_PY_TEST_SPEC:+"-k ${TEST_PY_TEST_SPEC}"}
  59. --build-dir "$UBOOT_TRAVIS_BUILD_DIR"
  60. build all 32bit ARM platforms:
  61. stage: world build
  62. script:
  63. - ret=0;
  64. ./tools/buildman/buildman -o /tmp -P -E -W arm -x aarch64 || ret=$?;
  65. if [[ $ret -ne 0 ]]; then
  66. ./tools/buildman/buildman -o /tmp -seP;
  67. exit $ret;
  68. fi;
  69. build all 64bit ARM platforms:
  70. stage: world build
  71. script:
  72. - virtualenv -p /usr/bin/python3 /tmp/venv
  73. - . /tmp/venv/bin/activate
  74. - pip install pyelftools
  75. - ret=0;
  76. ./tools/buildman/buildman -o /tmp -P -E -W aarch64 || ret=$?;
  77. if [[ $ret -ne 0 ]]; then
  78. ./tools/buildman/buildman -o /tmp -seP;
  79. exit $ret;
  80. fi;
  81. build all PowerPC platforms:
  82. stage: world build
  83. script:
  84. - ret=0;
  85. ./tools/buildman/buildman -o /tmp -P -E -W powerpc || ret=$?;
  86. if [[ $ret -ne 0 ]]; then
  87. ./tools/buildman/buildman -o /tmp -seP;
  88. exit $ret;
  89. fi;
  90. build all other platforms:
  91. stage: world build
  92. script:
  93. - ret=0;
  94. ./tools/buildman/buildman -o /tmp -P -E -W -x arm,powerpc || ret=$?;
  95. if [[ $ret -ne 0 ]]; then
  96. ./tools/buildman/buildman -o /tmp -seP;
  97. exit $ret;
  98. fi;
  99. # QA jobs for code analytics
  100. # static code analysis with cppcheck (we can add --enable=all later)
  101. cppcheck:
  102. stage: testsuites
  103. script:
  104. - cppcheck -j$(nproc) --force --quiet --inline-suppr .
  105. # search for TODO within source tree
  106. grep TODO/FIXME/HACK:
  107. stage: testsuites
  108. script:
  109. - grep -r TODO .
  110. - grep -r FIXME .
  111. # search for HACK within source tree and ignore HACKKIT board
  112. - grep -r HACK . | grep -v HACKKIT
  113. # build HTML documentation
  114. htmldocs:
  115. stage: testsuites
  116. script:
  117. - virtualenv -p /usr/bin/python3 /tmp/venvhtml
  118. - . /tmp/venvhtml/bin/activate
  119. - pip install -r doc/sphinx/requirements.txt
  120. - make htmldocs
  121. # some statistics about the code base
  122. sloccount:
  123. stage: testsuites
  124. script:
  125. - sloccount .
  126. # ensure all configs have MAINTAINERS entries
  127. Check for configs without MAINTAINERS entry:
  128. stage: testsuites
  129. script:
  130. - if [ `./tools/genboardscfg.py -f 2>&1 | wc -l` -ne 0 ]; then exit 1; fi
  131. # Ensure host tools build
  132. Build tools-only:
  133. stage: testsuites
  134. script:
  135. - make tools-only_config tools-only -j$(nproc)
  136. # Ensure env tools build
  137. Build envtools:
  138. stage: testsuites
  139. script:
  140. - make tools-only_config envtools -j$(nproc)
  141. Run binman, buildman, dtoc, Kconfig and patman testsuites:
  142. stage: testsuites
  143. script:
  144. - git config --global user.name "GitLab CI Runner";
  145. git config --global user.email trini@konsulko.com;
  146. export USER=gitlab;
  147. virtualenv -p /usr/bin/python3 /tmp/venv;
  148. . /tmp/venv/bin/activate;
  149. pip install -r test/py/requirements.txt;
  150. export UBOOT_TRAVIS_BUILD_DIR=/tmp/sandbox_spl;
  151. export PYTHONPATH="${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc/pylibfdt";
  152. export PATH="${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc:${PATH}";
  153. ./tools/buildman/buildman -T0 -o ${UBOOT_TRAVIS_BUILD_DIR} -w
  154. --board sandbox_spl;
  155. ./tools/binman/binman --toolpath ${UBOOT_TRAVIS_BUILD_DIR}/tools test;
  156. ./tools/buildman/buildman -t;
  157. ./tools/dtoc/dtoc -t;
  158. ./tools/patman/patman test;
  159. make testconfig
  160. Run tests for Nokia RX-51 (aka N900):
  161. stage: testsuites
  162. script:
  163. - export PATH=/opt/gcc-11.1.0-nolibc/arm-linux-gnueabi/bin:$PATH;
  164. test/nokia_rx51_test.sh
  165. # Test sandbox with test.py
  166. sandbox test.py:
  167. variables:
  168. TEST_PY_BD: "sandbox"
  169. <<: *buildman_and_testpy_dfn
  170. sandbox with clang test.py:
  171. variables:
  172. TEST_PY_BD: "sandbox"
  173. OVERRIDE: "-O clang-13"
  174. <<: *buildman_and_testpy_dfn
  175. sandbox_spl test.py:
  176. variables:
  177. TEST_PY_BD: "sandbox_spl"
  178. TEST_PY_TEST_SPEC: "test_ofplatdata or test_handoff or test_spl"
  179. <<: *buildman_and_testpy_dfn
  180. sandbox_noinst_test.py:
  181. variables:
  182. TEST_PY_BD: "sandbox_noinst"
  183. TEST_PY_TEST_SPEC: "test_ofplatdata or test_handoff or test_spl"
  184. <<: *buildman_and_testpy_dfn
  185. evb-ast2500 test.py:
  186. variables:
  187. TEST_PY_BD: "evb-ast2500"
  188. TEST_PY_ID: "--id qemu"
  189. <<: *buildman_and_testpy_dfn
  190. sandbox_flattree test.py:
  191. variables:
  192. TEST_PY_BD: "sandbox_flattree"
  193. <<: *buildman_and_testpy_dfn
  194. vexpress_ca9x4 test.py:
  195. variables:
  196. TEST_PY_BD: "vexpress_ca9x4"
  197. TEST_PY_ID: "--id qemu"
  198. <<: *buildman_and_testpy_dfn
  199. integratorcp_cm926ejs test.py:
  200. variables:
  201. TEST_PY_BD: "integratorcp_cm926ejs"
  202. TEST_PY_TEST_SPEC: "not sleep"
  203. TEST_PY_ID: "--id qemu"
  204. <<: *buildman_and_testpy_dfn
  205. qemu_arm test.py:
  206. variables:
  207. TEST_PY_BD: "qemu_arm"
  208. TEST_PY_TEST_SPEC: "not sleep"
  209. <<: *buildman_and_testpy_dfn
  210. qemu_arm64 test.py:
  211. variables:
  212. TEST_PY_BD: "qemu_arm64"
  213. TEST_PY_TEST_SPEC: "not sleep"
  214. <<: *buildman_and_testpy_dfn
  215. qemu_malta test.py:
  216. variables:
  217. TEST_PY_BD: "malta"
  218. TEST_PY_TEST_SPEC: "not sleep and not efi"
  219. TEST_PY_ID: "--id qemu"
  220. <<: *buildman_and_testpy_dfn
  221. qemu_maltael test.py:
  222. variables:
  223. TEST_PY_BD: "maltael"
  224. TEST_PY_TEST_SPEC: "not sleep and not efi"
  225. TEST_PY_ID: "--id qemu"
  226. <<: *buildman_and_testpy_dfn
  227. qemu_malta64 test.py:
  228. variables:
  229. TEST_PY_BD: "malta64"
  230. TEST_PY_TEST_SPEC: "not sleep and not efi"
  231. TEST_PY_ID: "--id qemu"
  232. <<: *buildman_and_testpy_dfn
  233. qemu_malta64el test.py:
  234. variables:
  235. TEST_PY_BD: "malta64el"
  236. TEST_PY_TEST_SPEC: "not sleep and not efi"
  237. TEST_PY_ID: "--id qemu"
  238. <<: *buildman_and_testpy_dfn
  239. qemu-ppce500 test.py:
  240. variables:
  241. TEST_PY_BD: "qemu-ppce500"
  242. TEST_PY_TEST_SPEC: "not sleep"
  243. <<: *buildman_and_testpy_dfn
  244. qemu-riscv32 test.py:
  245. variables:
  246. TEST_PY_BD: "qemu-riscv32"
  247. TEST_PY_TEST_SPEC: "not sleep"
  248. <<: *buildman_and_testpy_dfn
  249. qemu-riscv64 test.py:
  250. variables:
  251. TEST_PY_BD: "qemu-riscv64"
  252. TEST_PY_TEST_SPEC: "not sleep"
  253. <<: *buildman_and_testpy_dfn
  254. qemu-riscv32_spl test.py:
  255. variables:
  256. TEST_PY_BD: "qemu-riscv32_spl"
  257. TEST_PY_TEST_SPEC: "not sleep"
  258. <<: *buildman_and_testpy_dfn
  259. qemu-riscv64_spl test.py:
  260. variables:
  261. TEST_PY_BD: "qemu-riscv64_spl"
  262. TEST_PY_TEST_SPEC: "not sleep"
  263. <<: *buildman_and_testpy_dfn
  264. qemu-x86 test.py:
  265. variables:
  266. TEST_PY_BD: "qemu-x86"
  267. TEST_PY_TEST_SPEC: "not sleep"
  268. <<: *buildman_and_testpy_dfn
  269. qemu-x86_64 test.py:
  270. variables:
  271. TEST_PY_BD: "qemu-x86_64"
  272. TEST_PY_TEST_SPEC: "not sleep"
  273. <<: *buildman_and_testpy_dfn
  274. r2dplus_i82557c test.py:
  275. variables:
  276. TEST_PY_BD: "r2dplus"
  277. TEST_PY_ID: "--id i82557c_qemu"
  278. <<: *buildman_and_testpy_dfn
  279. r2dplus_pcnet test.py:
  280. variables:
  281. TEST_PY_BD: "r2dplus"
  282. TEST_PY_ID: "--id pcnet_qemu"
  283. <<: *buildman_and_testpy_dfn
  284. r2dplus_rtl8139 test.py:
  285. variables:
  286. TEST_PY_BD: "r2dplus"
  287. TEST_PY_ID: "--id rtl8139_qemu"
  288. <<: *buildman_and_testpy_dfn
  289. r2dplus_tulip test.py:
  290. variables:
  291. TEST_PY_BD: "r2dplus"
  292. TEST_PY_ID: "--id tulip_qemu"
  293. <<: *buildman_and_testpy_dfn
  294. sifive_unleashed_sdcard test.py:
  295. variables:
  296. TEST_PY_BD: "sifive_unleashed"
  297. TEST_PY_ID: "--id sdcard_qemu"
  298. <<: *buildman_and_testpy_dfn
  299. sifive_unleashed_spi-nor test.py:
  300. variables:
  301. TEST_PY_BD: "sifive_unleashed"
  302. TEST_PY_ID: "--id spi-nor_qemu"
  303. <<: *buildman_and_testpy_dfn
  304. xilinx_zynq_virt test.py:
  305. variables:
  306. TEST_PY_BD: "xilinx_zynq_virt"
  307. TEST_PY_TEST_SPEC: "not sleep"
  308. TEST_PY_ID: "--id qemu"
  309. <<: *buildman_and_testpy_dfn
  310. xilinx_versal_virt test.py:
  311. variables:
  312. TEST_PY_BD: "xilinx_versal_virt"
  313. TEST_PY_TEST_SPEC: "not sleep"
  314. TEST_PY_ID: "--id qemu"
  315. <<: *buildman_and_testpy_dfn
  316. xtfpga test.py:
  317. variables:
  318. TEST_PY_BD: "xtfpga"
  319. TEST_PY_TEST_SPEC: "not sleep"
  320. TEST_PY_ID: "--id qemu"
  321. <<: *buildman_and_testpy_dfn