.gitlab-ci.yml 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484
  1. # SPDX-License-Identifier: GPL-2.0+
  2. variables:
  3. DEFAULT_TAG: ""
  4. MIRROR_DOCKER: docker.io
  5. default:
  6. tags:
  7. - ${DEFAULT_TAG}
  8. # Grab our configured image. The source for this is found
  9. # in the u-boot tree at tools/docker/Dockerfile
  10. image: ${MIRROR_DOCKER}/trini/u-boot-gitlab-ci-runner:jammy-20240227-14Mar2024
  11. # We run some tests in different order, to catch some failures quicker.
  12. stages:
  13. - testsuites
  14. - test.py
  15. - world build
  16. .buildman_and_testpy_template: &buildman_and_testpy_dfn
  17. stage: test.py
  18. retry: 2 # QEMU may be too slow, etc.
  19. rules:
  20. - when: always
  21. before_script:
  22. # Clone uboot-test-hooks
  23. - git config --global --add safe.directory "${CI_PROJECT_DIR}"
  24. - git clone --depth=1 https://source.denx.de/u-boot/u-boot-test-hooks /tmp/uboot-test-hooks
  25. - ln -s travis-ci /tmp/uboot-test-hooks/bin/`hostname`
  26. - ln -s travis-ci /tmp/uboot-test-hooks/py/`hostname`
  27. - grub-mkimage --prefix="" -o ~/grub_x86.efi -O i386-efi normal echo lsefimmap lsefi lsefisystab efinet tftp minicmd
  28. - grub-mkimage --prefix="" -o ~/grub_x64.efi -O x86_64-efi normal echo lsefimmap lsefi lsefisystab efinet tftp minicmd
  29. - if [[ "${TEST_PY_BD}" == "qemu-riscv32_spl" ]]; then
  30. wget -O - https://github.com/riscv-software-src/opensbi/releases/download/v1.3.1/opensbi-1.3.1-rv-bin.tar.xz | tar -C /tmp -xJ;
  31. export OPENSBI=/tmp/opensbi-1.3.1-rv-bin/share/opensbi/ilp32/generic/firmware/fw_dynamic.bin;
  32. fi
  33. - if [[ "${TEST_PY_BD}" == "qemu-riscv64_spl" ]] || [[ "${TEST_PY_BD}" == "sifive_unleashed" ]]; then
  34. wget -O - https://github.com/riscv-software-src/opensbi/releases/download/v1.3.1/opensbi-1.3.1-rv-bin.tar.xz | tar -C /tmp -xJ;
  35. export OPENSBI=/tmp/opensbi-1.3.1-rv-bin/share/opensbi/lp64/generic/firmware/fw_dynamic.bin;
  36. fi
  37. after_script:
  38. - cp -v /tmp/${TEST_PY_BD}/*.{html,css} .
  39. - rm -rf /tmp/uboot-test-hooks /tmp/venv
  40. script:
  41. # If we've been asked to use clang only do one configuration.
  42. - export UBOOT_TRAVIS_BUILD_DIR=/tmp/${TEST_PY_BD}
  43. - echo BUILD_ENV ${BUILD_ENV}
  44. - if [ -n "${BUILD_ENV}" ]; then
  45. export ${BUILD_ENV};
  46. fi
  47. - tools/buildman/buildman -o ${UBOOT_TRAVIS_BUILD_DIR} -w -E -W -e
  48. --board ${TEST_PY_BD} ${OVERRIDE}
  49. - cp ~/grub_x86.efi $UBOOT_TRAVIS_BUILD_DIR/
  50. - cp ~/grub_x64.efi $UBOOT_TRAVIS_BUILD_DIR/
  51. - cp /opt/grub/grubriscv64.efi $UBOOT_TRAVIS_BUILD_DIR/grub_riscv64.efi
  52. - cp /opt/grub/grubaa64.efi $UBOOT_TRAVIS_BUILD_DIR/grub_arm64.efi
  53. - cp /opt/grub/grubarm.efi $UBOOT_TRAVIS_BUILD_DIR/grub_arm.efi
  54. # create sdcard / spi-nor images for sifive unleashed using genimage
  55. - if [[ "${TEST_PY_BD}" == "sifive_unleashed" ]]; then
  56. mkdir -p root;
  57. cp ${UBOOT_TRAVIS_BUILD_DIR}/spl/u-boot-spl.bin .;
  58. cp ${UBOOT_TRAVIS_BUILD_DIR}/u-boot.itb .;
  59. rm -rf tmp;
  60. genimage --inputpath . --config board/sifive/unleashed/genimage_sdcard.cfg;
  61. cp images/sdcard.img ${UBOOT_TRAVIS_BUILD_DIR}/;
  62. rm -rf tmp;
  63. genimage --inputpath . --config board/sifive/unleashed/genimage_spi-nor.cfg;
  64. cp images/spi-nor.img ${UBOOT_TRAVIS_BUILD_DIR}/;
  65. fi
  66. - if [[ "${TEST_PY_BD}" == "coreboot" ]]; then
  67. cp /opt/coreboot/coreboot.rom ${UBOOT_TRAVIS_BUILD_DIR}/coreboot.rom;
  68. /opt/coreboot/cbfstool ${UBOOT_TRAVIS_BUILD_DIR}/coreboot.rom remove -n fallback/payload;
  69. /opt/coreboot/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;
  70. fi
  71. - virtualenv -p /usr/bin/python3 /tmp/venv
  72. - . /tmp/venv/bin/activate
  73. - pip install -r test/py/requirements.txt
  74. # "${var:+"-k $var"}" expands to "" if $var is empty, "-k $var" if not
  75. - export PATH=/opt/qemu/bin:/tmp/uboot-test-hooks/bin:${PATH};
  76. export PYTHONPATH=/tmp/uboot-test-hooks/py/travis-ci;
  77. ./test/py/test.py -ra --bd ${TEST_PY_BD} ${TEST_PY_ID}
  78. ${TEST_PY_TEST_SPEC:+"-k ${TEST_PY_TEST_SPEC}"}
  79. --build-dir "$UBOOT_TRAVIS_BUILD_DIR"
  80. artifacts:
  81. when: always
  82. paths:
  83. - "*.html"
  84. - "*.css"
  85. expire_in: 1 week
  86. .world_build:
  87. stage: world build
  88. rules:
  89. - when: always
  90. build all 32bit ARM platforms:
  91. extends: .world_build
  92. script:
  93. - ret=0;
  94. git config --global --add safe.directory "${CI_PROJECT_DIR}";
  95. pip install -r tools/buildman/requirements.txt;
  96. ./tools/buildman/buildman -o /tmp -PEWM arm -x aarch64 || ret=$?;
  97. if [[ $ret -ne 0 ]]; then
  98. ./tools/buildman/buildman -o /tmp -seP;
  99. exit $ret;
  100. fi;
  101. build all 64bit ARM platforms:
  102. extends: .world_build
  103. script:
  104. - virtualenv -p /usr/bin/python3 /tmp/venv
  105. - . /tmp/venv/bin/activate
  106. - ret=0;
  107. git config --global --add safe.directory "${CI_PROJECT_DIR}";
  108. pip install -r tools/buildman/requirements.txt;
  109. ./tools/buildman/buildman -o /tmp -PEWM aarch64 || ret=$?;
  110. if [[ $ret -ne 0 ]]; then
  111. ./tools/buildman/buildman -o /tmp -seP;
  112. exit $ret;
  113. fi;
  114. build all PowerPC platforms:
  115. extends: .world_build
  116. script:
  117. - ret=0;
  118. git config --global --add safe.directory "${CI_PROJECT_DIR}";
  119. ./tools/buildman/buildman -o /tmp -P -E -W powerpc || ret=$?;
  120. if [[ $ret -ne 0 ]]; then
  121. ./tools/buildman/buildman -o /tmp -seP;
  122. exit $ret;
  123. fi;
  124. build all other platforms:
  125. extends: .world_build
  126. script:
  127. - ret=0;
  128. git config --global --add safe.directory "${CI_PROJECT_DIR}";
  129. ./tools/buildman/buildman -o /tmp -PEWM -x arm,powerpc || ret=$?;
  130. if [[ $ret -ne 0 ]]; then
  131. ./tools/buildman/buildman -o /tmp -seP;
  132. exit $ret;
  133. fi;
  134. .testsuites:
  135. stage: testsuites
  136. rules:
  137. - when: always
  138. check for new CONFIG symbols outside Kconfig:
  139. extends: .testsuites
  140. script:
  141. - git config --global --add safe.directory "${CI_PROJECT_DIR}"
  142. # If grep succeeds and finds a match the test fails as we should
  143. # have no matches.
  144. - git grep -E '^#[[:blank:]]*(define|undef)[[:blank:]]*CONFIG_'
  145. :^doc/ :^arch/arm/dts/ :^scripts/kconfig/lkc.h
  146. :^include/linux/kconfig.h :^tools/ :^dts/upstream/ &&
  147. exit 1 || exit 0
  148. # build documentation
  149. docs:
  150. extends: .testsuites
  151. script:
  152. - virtualenv -p /usr/bin/python3 /tmp/venvhtml
  153. - . /tmp/venvhtml/bin/activate
  154. - pip install -r doc/sphinx/requirements.txt
  155. - make htmldocs KDOC_WERROR=1
  156. - make infodocs
  157. # ensure all configs have MAINTAINERS entries
  158. Check for configs without MAINTAINERS entry:
  159. extends: .testsuites
  160. script:
  161. - ./tools/buildman/buildman --maintainer-check
  162. # Ensure host tools build
  163. Build tools-only and envtools:
  164. extends: .testsuites
  165. script:
  166. - make tools-only_config tools-only -j$(nproc);
  167. make mrproper;
  168. make tools-only_config envtools -j$(nproc)
  169. Run binman, buildman, dtoc, Kconfig and patman testsuites:
  170. extends: .testsuites
  171. script:
  172. - git config --global user.name "GitLab CI Runner";
  173. git config --global user.email trini@konsulko.com;
  174. git config --global --add safe.directory "${CI_PROJECT_DIR}";
  175. export USER=gitlab;
  176. virtualenv -p /usr/bin/python3 /tmp/venv;
  177. . /tmp/venv/bin/activate;
  178. pip install -r test/py/requirements.txt;
  179. pip install -r tools/buildman/requirements.txt;
  180. export UBOOT_TRAVIS_BUILD_DIR=/tmp/tools-only;
  181. export PYTHONPATH="${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc/pylibfdt";
  182. export PATH="${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc:${PATH}";
  183. set +e;
  184. ./tools/buildman/buildman -T0 -o ${UBOOT_TRAVIS_BUILD_DIR} -w
  185. --board tools-only;
  186. set -e;
  187. ./tools/binman/binman --toolpath ${UBOOT_TRAVIS_BUILD_DIR}/tools test;
  188. ./tools/buildman/buildman -t;
  189. ./tools/dtoc/dtoc -t;
  190. ./tools/patman/patman test;
  191. make testconfig
  192. # Check for any pylint regressions
  193. Run pylint:
  194. extends: .testsuites
  195. script:
  196. - git config --global --add safe.directory "${CI_PROJECT_DIR}"
  197. - pip install -r test/py/requirements.txt
  198. - pip install -r tools/buildman/requirements.txt
  199. - pip install asteval pylint==2.12.2 pyopenssl
  200. - export PATH=${PATH}:~/.local/bin
  201. - echo "[MASTER]" >> .pylintrc
  202. - echo "load-plugins=pylint.extensions.docparams" >> .pylintrc
  203. - export UBOOT_TRAVIS_BUILD_DIR=/tmp/tools-only
  204. - set +e
  205. - ./tools/buildman/buildman -T0 -o ${UBOOT_TRAVIS_BUILD_DIR} -w
  206. --board tools-only
  207. - set -e
  208. - pylint --version
  209. - export PYTHONPATH="${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc/pylibfdt"
  210. - make pylint_err
  211. # Check for pre-schema driver model tags
  212. Check for pre-schema tags:
  213. extends: .testsuites
  214. script:
  215. - git config --global --add safe.directory "${CI_PROJECT_DIR}";
  216. # If grep succeeds and finds a match the test fails as we should
  217. # have no matches.
  218. - git grep u-boot,dm- -- '*.dts*' && exit 1 || exit 0
  219. # Check we can package the Python tools
  220. Check packing of Python tools:
  221. extends: .testsuites
  222. script:
  223. - make pip
  224. # Test sandbox with test.py
  225. sandbox test.py:
  226. variables:
  227. TEST_PY_BD: "sandbox"
  228. <<: *buildman_and_testpy_dfn
  229. sandbox with clang test.py:
  230. variables:
  231. TEST_PY_BD: "sandbox"
  232. OVERRIDE: "-O clang-17"
  233. <<: *buildman_and_testpy_dfn
  234. sandbox64 test.py:
  235. variables:
  236. TEST_PY_BD: "sandbox64"
  237. <<: *buildman_and_testpy_dfn
  238. sandbox64 with clang test.py:
  239. variables:
  240. TEST_PY_BD: "sandbox64"
  241. OVERRIDE: "-O clang-17"
  242. <<: *buildman_and_testpy_dfn
  243. sandbox_spl test.py:
  244. variables:
  245. TEST_PY_BD: "sandbox_spl"
  246. TEST_PY_TEST_SPEC: "test_ofplatdata or test_handoff or test_spl"
  247. <<: *buildman_and_testpy_dfn
  248. sandbox_noinst_test.py:
  249. variables:
  250. TEST_PY_BD: "sandbox_noinst"
  251. TEST_PY_TEST_SPEC: "test_ofplatdata or test_handoff or test_spl"
  252. <<: *buildman_and_testpy_dfn
  253. sandbox_noinst with LOAD_FIT_FULL test.py:
  254. variables:
  255. TEST_PY_BD: "sandbox_noinst"
  256. TEST_PY_TEST_SPEC: "test_ofplatdata or test_handoff or test_spl"
  257. OVERRIDE: "-a CONFIG_SPL_LOAD_FIT_FULL=y"
  258. <<: *buildman_and_testpy_dfn
  259. sandbox_vpl test.py:
  260. variables:
  261. TEST_PY_BD: "sandbox_vpl"
  262. TEST_PY_TEST_SPEC: "vpl or test_spl"
  263. <<: *buildman_and_testpy_dfn
  264. # Enable tracing and disable LTO, to ensure functions are not elided
  265. sandbox trace_test.py:
  266. variables:
  267. TEST_PY_BD: "sandbox"
  268. BUILD_ENV: "FTRACE=1 NO_LTO=1"
  269. TEST_PY_TEST_SPEC: "trace"
  270. OVERRIDE: "-a CONFIG_TRACE=y -a CONFIG_TRACE_EARLY=y -a CONFIG_TRACE_EARLY_SIZE=0x01000000 -a CONFIG_TRACE_BUFFER_SIZE=0x02000000"
  271. <<: *buildman_and_testpy_dfn
  272. evb-ast2500 test.py:
  273. variables:
  274. TEST_PY_BD: "evb-ast2500"
  275. TEST_PY_ID: "--id qemu"
  276. <<: *buildman_and_testpy_dfn
  277. evb-ast2600 test.py:
  278. variables:
  279. TEST_PY_BD: "evb-ast2600"
  280. TEST_PY_ID: "--id qemu"
  281. <<: *buildman_and_testpy_dfn
  282. sandbox_flattree test.py:
  283. variables:
  284. TEST_PY_BD: "sandbox_flattree"
  285. <<: *buildman_and_testpy_dfn
  286. vexpress_ca9x4 test.py:
  287. variables:
  288. TEST_PY_BD: "vexpress_ca9x4"
  289. TEST_PY_ID: "--id qemu"
  290. <<: *buildman_and_testpy_dfn
  291. integratorcp_cm926ejs test.py:
  292. variables:
  293. TEST_PY_BD: "integratorcp_cm926ejs"
  294. TEST_PY_TEST_SPEC: "not sleep"
  295. TEST_PY_ID: "--id qemu"
  296. <<: *buildman_and_testpy_dfn
  297. qemu_arm test.py:
  298. variables:
  299. TEST_PY_BD: "qemu_arm"
  300. TEST_PY_TEST_SPEC: "not sleep"
  301. <<: *buildman_and_testpy_dfn
  302. qemu_arm64 test.py:
  303. variables:
  304. TEST_PY_BD: "qemu_arm64"
  305. TEST_PY_TEST_SPEC: "not sleep"
  306. <<: *buildman_and_testpy_dfn
  307. qemu_m68k test.py:
  308. variables:
  309. TEST_PY_BD: "M5208EVBE"
  310. TEST_PY_ID: "--id qemu"
  311. TEST_PY_TEST_SPEC: "not sleep and not efi"
  312. OVERRIDE: "-a CONFIG_M68K_QEMU=y -a ~CONFIG_MCFTMR"
  313. <<: *buildman_and_testpy_dfn
  314. qemu_malta test.py:
  315. variables:
  316. TEST_PY_BD: "malta"
  317. TEST_PY_TEST_SPEC: "not sleep and not efi"
  318. TEST_PY_ID: "--id qemu"
  319. <<: *buildman_and_testpy_dfn
  320. qemu_maltael test.py:
  321. variables:
  322. TEST_PY_BD: "maltael"
  323. TEST_PY_TEST_SPEC: "not sleep and not efi"
  324. TEST_PY_ID: "--id qemu"
  325. <<: *buildman_and_testpy_dfn
  326. qemu_malta64 test.py:
  327. variables:
  328. TEST_PY_BD: "malta64"
  329. TEST_PY_TEST_SPEC: "not sleep and not efi"
  330. TEST_PY_ID: "--id qemu"
  331. <<: *buildman_and_testpy_dfn
  332. qemu_malta64el test.py:
  333. variables:
  334. TEST_PY_BD: "malta64el"
  335. TEST_PY_TEST_SPEC: "not sleep and not efi"
  336. TEST_PY_ID: "--id qemu"
  337. <<: *buildman_and_testpy_dfn
  338. qemu-ppce500 test.py:
  339. variables:
  340. TEST_PY_BD: "qemu-ppce500"
  341. TEST_PY_TEST_SPEC: "not sleep"
  342. <<: *buildman_and_testpy_dfn
  343. qemu-riscv32 test.py:
  344. variables:
  345. TEST_PY_BD: "qemu-riscv32"
  346. TEST_PY_TEST_SPEC: "not sleep"
  347. <<: *buildman_and_testpy_dfn
  348. qemu-riscv64 test.py:
  349. variables:
  350. TEST_PY_BD: "qemu-riscv64"
  351. TEST_PY_TEST_SPEC: "not sleep"
  352. <<: *buildman_and_testpy_dfn
  353. qemu-riscv32_spl test.py:
  354. variables:
  355. TEST_PY_BD: "qemu-riscv32_spl"
  356. TEST_PY_TEST_SPEC: "not sleep"
  357. <<: *buildman_and_testpy_dfn
  358. qemu-riscv64_spl test.py:
  359. variables:
  360. TEST_PY_BD: "qemu-riscv64_spl"
  361. TEST_PY_TEST_SPEC: "not sleep"
  362. <<: *buildman_and_testpy_dfn
  363. qemu-x86 test.py:
  364. variables:
  365. TEST_PY_BD: "qemu-x86"
  366. TEST_PY_TEST_SPEC: "not sleep"
  367. <<: *buildman_and_testpy_dfn
  368. qemu-x86_64 test.py:
  369. variables:
  370. TEST_PY_BD: "qemu-x86_64"
  371. TEST_PY_TEST_SPEC: "not sleep"
  372. <<: *buildman_and_testpy_dfn
  373. r2dplus_i82557c test.py:
  374. variables:
  375. TEST_PY_BD: "r2dplus"
  376. TEST_PY_ID: "--id i82557c_qemu"
  377. <<: *buildman_and_testpy_dfn
  378. r2dplus_pcnet test.py:
  379. variables:
  380. TEST_PY_BD: "r2dplus"
  381. TEST_PY_ID: "--id pcnet_qemu"
  382. <<: *buildman_and_testpy_dfn
  383. r2dplus_rtl8139 test.py:
  384. variables:
  385. TEST_PY_BD: "r2dplus"
  386. TEST_PY_ID: "--id rtl8139_qemu"
  387. <<: *buildman_and_testpy_dfn
  388. r2dplus_tulip test.py:
  389. variables:
  390. TEST_PY_BD: "r2dplus"
  391. TEST_PY_ID: "--id tulip_qemu"
  392. <<: *buildman_and_testpy_dfn
  393. sifive_unleashed_sdcard test.py:
  394. variables:
  395. TEST_PY_BD: "sifive_unleashed"
  396. TEST_PY_ID: "--id sdcard_qemu"
  397. <<: *buildman_and_testpy_dfn
  398. sifive_unleashed_spi-nor test.py:
  399. variables:
  400. TEST_PY_BD: "sifive_unleashed"
  401. TEST_PY_ID: "--id spi-nor_qemu"
  402. <<: *buildman_and_testpy_dfn
  403. xilinx_zynq_virt test.py:
  404. variables:
  405. TEST_PY_BD: "xilinx_zynq_virt"
  406. TEST_PY_TEST_SPEC: "not sleep"
  407. TEST_PY_ID: "--id qemu"
  408. <<: *buildman_and_testpy_dfn
  409. xilinx_versal_virt test.py:
  410. variables:
  411. TEST_PY_BD: "xilinx_versal_virt"
  412. TEST_PY_TEST_SPEC: "not sleep"
  413. TEST_PY_ID: "--id qemu"
  414. <<: *buildman_and_testpy_dfn
  415. xtfpga test.py:
  416. variables:
  417. TEST_PY_BD: "xtfpga"
  418. TEST_PY_TEST_SPEC: "not sleep"
  419. TEST_PY_ID: "--id qemu"
  420. <<: *buildman_and_testpy_dfn
  421. coreboot test.py:
  422. variables:
  423. TEST_PY_BD: "coreboot"
  424. TEST_PY_TEST_SPEC: "not sleep"
  425. TEST_PY_ID: "--id qemu"
  426. <<: *buildman_and_testpy_dfn