.gitlab-ci.yml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415
  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-20220113-03Feb2022
  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. - if [[ "${TEST_PY_BD}" == "coreboot" ]]; then
  52. wget -O -
  53. "https://drive.google.com/uc?id=1x6nrtWIyIRPLS2cQBwYTnT2TbOI8UjmM&export=download" |
  54. xz -dc >${UBOOT_TRAVIS_BUILD_DIR}/coreboot.rom;
  55. wget -O -
  56. "https://drive.google.com/uc?id=149Cz-5SZXHNKpi9xg6R_5XITWohu348y&export=download" >
  57. cbfstool;
  58. chmod a+x cbfstool;
  59. ./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;
  60. fi
  61. - virtualenv -p /usr/bin/python3 /tmp/venv
  62. - . /tmp/venv/bin/activate
  63. - pip install -r test/py/requirements.txt
  64. # "${var:+"-k $var"}" expands to "" if $var is empty, "-k $var" if not
  65. - export PATH=/opt/qemu/bin:/tmp/uboot-test-hooks/bin:${PATH};
  66. export PYTHONPATH=/tmp/uboot-test-hooks/py/travis-ci;
  67. ./test/py/test.py -ra --bd ${TEST_PY_BD} ${TEST_PY_ID}
  68. ${TEST_PY_TEST_SPEC:+"-k ${TEST_PY_TEST_SPEC}"}
  69. --build-dir "$UBOOT_TRAVIS_BUILD_DIR"
  70. # It seems that the files in /tmp go away, so copy out what we need
  71. - if [[ "${TEST_PY_BD}" == "coreboot" ]]; then
  72. cp -v /tmp/coreboot/*.{html,css} .;
  73. fi
  74. build all 32bit ARM platforms:
  75. stage: world build
  76. script:
  77. - ret=0;
  78. ./tools/buildman/buildman -o /tmp -P -E -W arm -x aarch64 || ret=$?;
  79. if [[ $ret -ne 0 ]]; then
  80. ./tools/buildman/buildman -o /tmp -seP;
  81. exit $ret;
  82. fi;
  83. build all 64bit ARM platforms:
  84. stage: world build
  85. script:
  86. - virtualenv -p /usr/bin/python3 /tmp/venv
  87. - . /tmp/venv/bin/activate
  88. - pip install pyelftools
  89. - ret=0;
  90. ./tools/buildman/buildman -o /tmp -P -E -W aarch64 || ret=$?;
  91. if [[ $ret -ne 0 ]]; then
  92. ./tools/buildman/buildman -o /tmp -seP;
  93. exit $ret;
  94. fi;
  95. build all PowerPC platforms:
  96. stage: world build
  97. script:
  98. - ret=0;
  99. ./tools/buildman/buildman -o /tmp -P -E -W powerpc || ret=$?;
  100. if [[ $ret -ne 0 ]]; then
  101. ./tools/buildman/buildman -o /tmp -seP;
  102. exit $ret;
  103. fi;
  104. build all other platforms:
  105. stage: world build
  106. script:
  107. - ret=0;
  108. ./tools/buildman/buildman -o /tmp -P -E -W -x arm,powerpc || ret=$?;
  109. if [[ $ret -ne 0 ]]; then
  110. ./tools/buildman/buildman -o /tmp -seP;
  111. exit $ret;
  112. fi;
  113. check for migrated symbols in board header:
  114. stage: testsuites
  115. script:
  116. - KSYMLST=`mktemp`;
  117. KUSEDLST=`mktemp`;
  118. cat `find . -name "Kconfig*"` |
  119. sed -n -e 's/^\s*config *\([A-Za-z0-9_]*\).*$/CONFIG_\1/p'
  120. -e 's/^\s*menuconfig *\([A-Za-z0-9_]*\).*$/CONFIG_\1/p'
  121. | sort -u > $KSYMLST;
  122. for CFG in `find include/configs -name "*.h"`; do
  123. grep '#define[[:blank:]]CONFIG_' $CFG |
  124. sed -n 's/#define.\(CONFIG_[A-Za-z0-9_]*\).*/\1/p' |
  125. sort -u > ${KUSEDLST} || true;
  126. NUM=`comm -12 --total --output-delimiter=, ${KSYMLST} ${KUSEDLST} |
  127. cut -d , -f 3`;
  128. if [[ $NUM -ne 0 ]]; then
  129. echo "Unmigrated symbols found in $CFG";
  130. exit 1;
  131. fi;
  132. done
  133. # QA jobs for code analytics
  134. # static code analysis with cppcheck (we can add --enable=all later)
  135. cppcheck:
  136. stage: testsuites
  137. script:
  138. - cppcheck -j$(nproc) --force --quiet --inline-suppr .
  139. # search for TODO within source tree
  140. grep TODO/FIXME/HACK:
  141. stage: testsuites
  142. script:
  143. - grep -r TODO .
  144. - grep -r FIXME .
  145. # search for HACK within source tree and ignore HACKKIT board
  146. - grep -r HACK . | grep -v HACKKIT
  147. # build HTML documentation
  148. htmldocs:
  149. stage: testsuites
  150. script:
  151. - virtualenv -p /usr/bin/python3 /tmp/venvhtml
  152. - . /tmp/venvhtml/bin/activate
  153. - pip install -r doc/sphinx/requirements.txt
  154. - make htmldocs
  155. # some statistics about the code base
  156. sloccount:
  157. stage: testsuites
  158. script:
  159. - sloccount .
  160. # ensure all configs have MAINTAINERS entries
  161. Check for configs without MAINTAINERS entry:
  162. stage: testsuites
  163. script:
  164. - if [ `./tools/genboardscfg.py -f 2>&1 | wc -l` -ne 0 ]; then exit 1; fi
  165. # Ensure host tools build
  166. Build tools-only:
  167. stage: testsuites
  168. script:
  169. - make tools-only_config tools-only -j$(nproc)
  170. # Ensure env tools build
  171. Build envtools:
  172. stage: testsuites
  173. script:
  174. - make tools-only_config envtools -j$(nproc)
  175. Run binman, buildman, dtoc, Kconfig and patman testsuites:
  176. stage: testsuites
  177. script:
  178. - git config --global user.name "GitLab CI Runner";
  179. git config --global user.email trini@konsulko.com;
  180. export USER=gitlab;
  181. virtualenv -p /usr/bin/python3 /tmp/venv;
  182. . /tmp/venv/bin/activate;
  183. pip install -r test/py/requirements.txt;
  184. export UBOOT_TRAVIS_BUILD_DIR=/tmp/sandbox_spl;
  185. export PYTHONPATH="${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc/pylibfdt";
  186. export PATH="${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc:${PATH}";
  187. ./tools/buildman/buildman -T0 -o ${UBOOT_TRAVIS_BUILD_DIR} -w
  188. --board sandbox_spl;
  189. ./tools/binman/binman --toolpath ${UBOOT_TRAVIS_BUILD_DIR}/tools test;
  190. ./tools/buildman/buildman -t;
  191. ./tools/dtoc/dtoc -t;
  192. ./tools/patman/patman test;
  193. make testconfig
  194. Run tests for Nokia RX-51 (aka N900):
  195. stage: testsuites
  196. script:
  197. - export PATH=/opt/gcc-11.1.0-nolibc/arm-linux-gnueabi/bin:$PATH;
  198. test/nokia_rx51_test.sh
  199. # Test sandbox with test.py
  200. sandbox test.py:
  201. variables:
  202. TEST_PY_BD: "sandbox"
  203. <<: *buildman_and_testpy_dfn
  204. sandbox with clang test.py:
  205. variables:
  206. TEST_PY_BD: "sandbox"
  207. OVERRIDE: "-O clang-13"
  208. <<: *buildman_and_testpy_dfn
  209. sandbox_spl test.py:
  210. variables:
  211. TEST_PY_BD: "sandbox_spl"
  212. TEST_PY_TEST_SPEC: "test_ofplatdata or test_handoff or test_spl"
  213. <<: *buildman_and_testpy_dfn
  214. sandbox_noinst_test.py:
  215. variables:
  216. TEST_PY_BD: "sandbox_noinst"
  217. TEST_PY_TEST_SPEC: "test_ofplatdata or test_handoff or test_spl"
  218. <<: *buildman_and_testpy_dfn
  219. evb-ast2500 test.py:
  220. variables:
  221. TEST_PY_BD: "evb-ast2500"
  222. TEST_PY_ID: "--id qemu"
  223. <<: *buildman_and_testpy_dfn
  224. sandbox_flattree test.py:
  225. variables:
  226. TEST_PY_BD: "sandbox_flattree"
  227. <<: *buildman_and_testpy_dfn
  228. vexpress_ca9x4 test.py:
  229. variables:
  230. TEST_PY_BD: "vexpress_ca9x4"
  231. TEST_PY_ID: "--id qemu"
  232. <<: *buildman_and_testpy_dfn
  233. integratorcp_cm926ejs test.py:
  234. variables:
  235. TEST_PY_BD: "integratorcp_cm926ejs"
  236. TEST_PY_TEST_SPEC: "not sleep"
  237. TEST_PY_ID: "--id qemu"
  238. <<: *buildman_and_testpy_dfn
  239. qemu_arm test.py:
  240. variables:
  241. TEST_PY_BD: "qemu_arm"
  242. TEST_PY_TEST_SPEC: "not sleep"
  243. <<: *buildman_and_testpy_dfn
  244. qemu_arm64 test.py:
  245. variables:
  246. TEST_PY_BD: "qemu_arm64"
  247. TEST_PY_TEST_SPEC: "not sleep"
  248. <<: *buildman_and_testpy_dfn
  249. qemu_malta test.py:
  250. variables:
  251. TEST_PY_BD: "malta"
  252. TEST_PY_TEST_SPEC: "not sleep and not efi"
  253. TEST_PY_ID: "--id qemu"
  254. <<: *buildman_and_testpy_dfn
  255. qemu_maltael test.py:
  256. variables:
  257. TEST_PY_BD: "maltael"
  258. TEST_PY_TEST_SPEC: "not sleep and not efi"
  259. TEST_PY_ID: "--id qemu"
  260. <<: *buildman_and_testpy_dfn
  261. qemu_malta64 test.py:
  262. variables:
  263. TEST_PY_BD: "malta64"
  264. TEST_PY_TEST_SPEC: "not sleep and not efi"
  265. TEST_PY_ID: "--id qemu"
  266. <<: *buildman_and_testpy_dfn
  267. qemu_malta64el test.py:
  268. variables:
  269. TEST_PY_BD: "malta64el"
  270. TEST_PY_TEST_SPEC: "not sleep and not efi"
  271. TEST_PY_ID: "--id qemu"
  272. <<: *buildman_and_testpy_dfn
  273. qemu-ppce500 test.py:
  274. variables:
  275. TEST_PY_BD: "qemu-ppce500"
  276. TEST_PY_TEST_SPEC: "not sleep"
  277. <<: *buildman_and_testpy_dfn
  278. qemu-riscv32 test.py:
  279. variables:
  280. TEST_PY_BD: "qemu-riscv32"
  281. TEST_PY_TEST_SPEC: "not sleep"
  282. <<: *buildman_and_testpy_dfn
  283. qemu-riscv64 test.py:
  284. variables:
  285. TEST_PY_BD: "qemu-riscv64"
  286. TEST_PY_TEST_SPEC: "not sleep"
  287. <<: *buildman_and_testpy_dfn
  288. qemu-riscv32_spl test.py:
  289. variables:
  290. TEST_PY_BD: "qemu-riscv32_spl"
  291. TEST_PY_TEST_SPEC: "not sleep"
  292. <<: *buildman_and_testpy_dfn
  293. qemu-riscv64_spl test.py:
  294. variables:
  295. TEST_PY_BD: "qemu-riscv64_spl"
  296. TEST_PY_TEST_SPEC: "not sleep"
  297. <<: *buildman_and_testpy_dfn
  298. qemu-x86 test.py:
  299. variables:
  300. TEST_PY_BD: "qemu-x86"
  301. TEST_PY_TEST_SPEC: "not sleep"
  302. <<: *buildman_and_testpy_dfn
  303. qemu-x86_64 test.py:
  304. variables:
  305. TEST_PY_BD: "qemu-x86_64"
  306. TEST_PY_TEST_SPEC: "not sleep"
  307. <<: *buildman_and_testpy_dfn
  308. r2dplus_i82557c test.py:
  309. variables:
  310. TEST_PY_BD: "r2dplus"
  311. TEST_PY_ID: "--id i82557c_qemu"
  312. <<: *buildman_and_testpy_dfn
  313. r2dplus_pcnet test.py:
  314. variables:
  315. TEST_PY_BD: "r2dplus"
  316. TEST_PY_ID: "--id pcnet_qemu"
  317. <<: *buildman_and_testpy_dfn
  318. r2dplus_rtl8139 test.py:
  319. variables:
  320. TEST_PY_BD: "r2dplus"
  321. TEST_PY_ID: "--id rtl8139_qemu"
  322. <<: *buildman_and_testpy_dfn
  323. r2dplus_tulip test.py:
  324. variables:
  325. TEST_PY_BD: "r2dplus"
  326. TEST_PY_ID: "--id tulip_qemu"
  327. <<: *buildman_and_testpy_dfn
  328. sifive_unleashed_sdcard test.py:
  329. variables:
  330. TEST_PY_BD: "sifive_unleashed"
  331. TEST_PY_ID: "--id sdcard_qemu"
  332. <<: *buildman_and_testpy_dfn
  333. sifive_unleashed_spi-nor test.py:
  334. variables:
  335. TEST_PY_BD: "sifive_unleashed"
  336. TEST_PY_ID: "--id spi-nor_qemu"
  337. <<: *buildman_and_testpy_dfn
  338. xilinx_zynq_virt test.py:
  339. variables:
  340. TEST_PY_BD: "xilinx_zynq_virt"
  341. TEST_PY_TEST_SPEC: "not sleep"
  342. TEST_PY_ID: "--id qemu"
  343. <<: *buildman_and_testpy_dfn
  344. xilinx_versal_virt test.py:
  345. variables:
  346. TEST_PY_BD: "xilinx_versal_virt"
  347. TEST_PY_TEST_SPEC: "not sleep"
  348. TEST_PY_ID: "--id qemu"
  349. <<: *buildman_and_testpy_dfn
  350. xtfpga test.py:
  351. variables:
  352. TEST_PY_BD: "xtfpga"
  353. TEST_PY_TEST_SPEC: "not sleep"
  354. TEST_PY_ID: "--id qemu"
  355. <<: *buildman_and_testpy_dfn
  356. coreboot test.py:
  357. variables:
  358. TEST_PY_BD: "coreboot"
  359. TEST_PY_TEST_SPEC: "not sleep"
  360. TEST_PY_ID: "--id qemu"
  361. artifacts:
  362. paths:
  363. - "*.html"
  364. - "*.css"
  365. expire_in: 1 week
  366. <<: *buildman_and_testpy_dfn