ci: add envtools support
[platform/kernel/u-boot.git] / .travis.yml
1 # SPDX-License-Identifier: GPL-2.0+
2 # Copyright Roger Meier <r.meier@siemens.com>
3
4 # build U-Boot on Travis CI - https://travis-ci.org/
5
6 sudo: required
7 dist: xenial
8
9 language: c
10
11 addons:
12   apt:
13     sources:
14     - ubuntu-toolchain-r-test
15     - llvm-toolchain-xenial-7
16     packages:
17     - cppcheck
18     - sloccount
19     - sparse
20     - bc
21     - build-essential
22     - libsdl1.2-dev
23     - python
24     - python-virtualenv
25     - swig
26     - libpython-dev
27     - iasl
28     - grub-efi-ia32-bin
29     - grub-efi-amd64-bin
30     - rpm2cpio
31     - wget
32     - device-tree-compiler
33     - lzop
34     - liblz4-tool
35     - lzma-alone
36     - libisl15
37     - clang-7
38     - srecord
39
40 install:
41  # Clone uboot-test-hooks
42  - git clone --depth=1 git://github.com/swarren/uboot-test-hooks.git /tmp/uboot-test-hooks
43  - ln -s travis-ci /tmp/uboot-test-hooks/bin/`hostname`
44  - ln -s travis-ci /tmp/uboot-test-hooks/py/`hostname`
45  # prepare buildman environment
46  - echo -e "[toolchain]\nroot = /usr" > ~/.buildman
47  - echo -e "arc = /tmp/arc_gnu_2018.09_prebuilt_uclibc_le_archs_linux_install" >> ~/.buildman
48  - echo -e "\n[toolchain-alias]\nsh = sh2\n" >> ~/.buildman
49  - cat ~/.buildman
50  - virtualenv /tmp/venv
51  - . /tmp/venv/bin/activate
52  - pip install pytest==2.8.7
53  - pip install python-subunit
54  - pip install pyelftools
55  - grub-mkimage -o ~/grub_x86.efi -O i386-efi normal  echo lsefimmap lsefi lsefisystab efinet tftp minicmd
56  - grub-mkimage -o ~/grub_x64.efi -O x86_64-efi normal  echo lsefimmap lsefi lsefisystab efinet tftp minicmd
57  - mkdir ~/grub2-arm
58  - ( cd ~/grub2-arm; wget -O - http://download.opensuse.org/ports/armv7hl/distribution/leap/42.2/repo/oss/suse/armv7hl/grub2-arm-efi-2.02~beta2-87.1.armv7hl.rpm | rpm2cpio | cpio -di )
59  - mkdir ~/grub2-arm64
60  - ( cd ~/grub2-arm64; wget -O - http://download.opensuse.org/ports/aarch64/distribution/leap/42.2/repo/oss/suse/aarch64/grub2-arm64-efi-2.02~beta2-87.1.aarch64.rpm | rpm2cpio | cpio -di )
61
62 env:
63   global:
64     - PATH=/tmp/qemu-install/bin:/tmp/uboot-test-hooks/bin:/usr/bin:/bin:/usr/local/bin
65     - PYTHONPATH=/tmp/uboot-test-hooks/py/travis-ci
66     - BUILD_DIR=build
67     - HOSTCC="cc"
68     - HOSTCXX="c++"
69     - QEMU_VERSION="v3.1.0"
70
71 before_script:
72   # install toolchains based on TOOLCHAIN} variable
73   - if [[ "${TOOLCHAIN}" == *m68k* ]]; then ./tools/buildman/buildman --fetch-arch m68k ; fi
74   - if [[ "${TOOLCHAIN}" == *microblaze* ]]; then ./tools/buildman/buildman --fetch-arch microblaze ; fi
75   - if [[ "${TOOLCHAIN}" == *mips* ]]; then ./tools/buildman/buildman --fetch-arch mips ; fi
76   - if [[ "${TOOLCHAIN}" == *sh* ]]; then ./tools/buildman/buildman --fetch-arch sh2 ; fi
77   - if [[ "${TOOLCHAIN}" == *i386* ]]; then
78       ./tools/buildman/buildman --fetch-arch i386;
79       echo -e "\n[toolchain-alias]\nx86 = i386" >> ~/.buildman;
80     fi
81   - if [[ "${TOOLCHAIN}" == arc ]]; then
82        wget https://github.com/foss-for-synopsys-dwc-arc-processors/toolchain/releases/download/arc-2018.09-release/arc_gnu_2018.09_prebuilt_uclibc_le_archs_linux_install.tar.gz &&
83        tar -C /tmp -xf arc_gnu_2018.09_prebuilt_uclibc_le_archs_linux_install.tar.gz;
84     fi
85   - if [[ "${TOOLCHAIN}" == "nds32" ]]; then
86        wget https://github.com/vincentzwc/prebuilt-nds32-toolchain/releases/download/20180521/nds32le-linux-glibc-v3-upstream.tar.gz &&
87        tar -C /tmp -xf nds32le-linux-glibc-v3-upstream.tar.gz &&
88        echo -e "\n[toolchain-prefix]\nnds32 = /tmp/nds32le-linux-glibc-v3-upstream/bin/nds32le-linux-" >> ~/.buildman;
89     fi
90   - if [[ "${TOOLCHAIN}" == *xtensa* ]]; then
91        wget https://github.com/foss-xtensa/toolchain/releases/download/2018.02/x86_64-2018.02-${TOOLCHAIN}.tar.gz &&
92        tar -C /tmp -xf x86_64-2018.02-${TOOLCHAIN}.tar.gz &&
93        echo -e "\n[toolchain-prefix]\nxtensa = /tmp/2018.02/${TOOLCHAIN}/bin/${TOOLCHAIN}-" >> ~/.buildman;
94     fi
95   # If TOOLCHAIN is unset, we're on some flavour of ARM.
96   - if [[ "${TOOLCHAIN}" == "" ]]; then
97        ./tools/buildman/buildman --fetch-arch arm &&
98        ./tools/buildman/buildman --fetch-arch aarch64;
99     fi
100   - if [[ "${TOOLCHAIN}" == "powerpc" ]]; then ./tools/buildman/buildman --fetch-arch powerpc; fi
101   - if [[ "${TOOLCHAIN}" == "riscv" ]]; then
102        ./tools/buildman/buildman --fetch-arch riscv64;
103        echo -e "\n[toolchain-alias]\nriscv = riscv64" >> ~/.buildman;
104     fi
105   - if [[ "${QEMU_TARGET}" != "" ]]; then
106        git clone git://git.qemu.org/qemu.git /tmp/qemu;
107        pushd /tmp/qemu;
108        git submodule update --init dtc &&
109        git checkout ${QEMU_VERSION} &&
110        ./configure --prefix=/tmp/qemu-install --target-list=${QEMU_TARGET} &&
111        make -j4 all install;
112        popd;
113     fi
114
115 script:
116  # Comments must be outside the command strings below, or the Travis parser
117  # will get confused.
118  #
119  # From buildman, exit code 129 means warnings only.  If we've been asked to
120  # use clang only do one configuration.
121  - if [[ "${BUILDMAN}" != "" ]]; then
122      ret=0;
123      tools/buildman/buildman -P -E ${BUILDMAN} ${OVERRIDE}|| ret=$?;
124      if [[ $ret -ne 0 && $ret -ne 129 ]]; then
125        tools/buildman/buildman -sdeP ${BUILDMAN};
126        exit $ret;
127      fi;
128    fi
129  # "not a_test_which_does_not_exist" is a dummy -k parameter which will
130  # never prevent any test from running. That way, we can always pass
131  # "-k something" even when $TEST_PY_TEST_SPEC doesnt need a custom
132  # value.
133  - export UBOOT_TRAVIS_BUILD_DIR=`cd .. && pwd`/.bm-work/${TEST_PY_BD};
134    cp ~/grub_x86.efi $UBOOT_TRAVIS_BUILD_DIR/;
135    cp ~/grub_x64.efi $UBOOT_TRAVIS_BUILD_DIR/;
136    cp ~/grub2-arm/usr/lib/grub2/arm-efi/grub.efi $UBOOT_TRAVIS_BUILD_DIR/grub_arm.efi;
137    cp ~/grub2-arm64/usr/lib/grub2/arm64-efi/grub.efi $UBOOT_TRAVIS_BUILD_DIR/grub_arm64.efi;
138    if [[ "${TEST_PY_BD}" != "" ]]; then
139      ./test/py/test.py --bd ${TEST_PY_BD} ${TEST_PY_ID}
140        -k "${TEST_PY_TEST_SPEC:-not a_test_which_does_not_exist}"
141        --build-dir "$UBOOT_TRAVIS_BUILD_DIR";
142      ret=$?;
143      if [[ $ret -ne 0 ]]; then
144        exit $ret;
145      fi;
146    fi;
147    if [[ -n "${TEST_PY_TOOLS}" ]]; then
148      PYTHONPATH="${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc/pylibfdt"
149      PATH="${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc:${PATH}"
150      ./tools/binman/binman --toolpath ${UBOOT_TRAVIS_BUILD_DIR}/tools test &&
151      ./tools/patman/patman --test &&
152      ./tools/buildman/buildman -t &&
153      PYTHONPATH="${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc/pylibfdt"
154      PATH="${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc:${PATH}"
155      ./tools/dtoc/dtoc -t;
156    fi
157
158 matrix:
159   include:
160   # we need to build by vendor due to 50min time limit for builds
161   # each env setting here is a dedicated build
162     - name: "buildman arc"
163       env:
164         - BUILDMAN="arc"
165           TOOLCHAIN="arc"
166     - name: "buildman arm11 arm7 arm920t arm946es"
167       env:
168         - BUILDMAN="arm11 arm7 arm920t arm946es"
169     - name: "buildman arm926ejs (non-NXP,siemens,at91,kirkwood,spear)"
170       env:
171         - JOB="arm926ejs"
172           BUILDMAN="arm926ejs -x freescale,siemens,at91,kirkwood,spear,omap"
173     - name: "buildman at91 (non arm v7)"
174       env:
175         - BUILDMAN="at91 -x armv7"
176     - name: "buildman at91 (non arm926ejs)"
177       env:
178         - BUILDMAN="at91 -x arm926ejs"
179     - name: "buildman boundary engicam toradex"
180       env:
181         - BUILDMAN="boundary engicam toradex"
182     - name: "buildman NXP ARM32"
183       env:
184         - BUILDMAN="freescale -x powerpc,m68k,aarch64"
185     - name: "buildman NXP AArch64 LS101x"
186       env:
187         - BUILDMAN="freescale&aarch64&ls101"
188     - name: "buildman NXP AArch64 LS102x"
189       env:
190         - BUILDMAN="freescale&aarch64&ls102"
191     - name: "buildman NXP AArch64 LS104x"
192       env:
193         - BUILDMAN="freescale&aarch64&ls104"
194     - name: "buildman NXP AArch64 LS108x"
195       env:
196         - BUILDMAN="freescale&aarch64&ls108"
197     - name: "buildman NXP AArch64 LS20xx"
198       env:
199         - BUILDMAN="freescale&aarch64&&ls20"
200     - name: "buildman NXP AArch64 LX216x"
201       env:
202         - BUILDMAN="freescale&aarch64&lx216"
203     - name: "buildman i.MX6 (non-NXP)"
204       env:
205         - BUILDMAN="mx6 -x freescale,toradex,boundary,engicam"
206     - name: "buildman i.MX (non-NXP,i.MX6,toradex)"
207       env:
208         - BUILDMAN="mx -x freescale,mx6,toradex"
209     - name: "buildman k2"
210       env:
211         - BUILDMAN="k2"
212     - name: "buildman samsung socfpga"
213       env:
214         - BUILDMAN="samsung socfpga"
215     - name: "buildman spear"
216       env:
217         - BUILDMAN="spear"
218     - name: "buildman sun4i"
219       env:
220         - BUILDMAN="sun4i"
221     - name: "buildman sun5i"
222       env:
223         - BUILDMAN="sun5i"
224     - name: "buildman sun6i"
225       env:
226         - BUILDMAN="sun6i"
227     - name: "buildman sun7i"
228       env:
229         - BUILDMAN="sun7i"
230     - name: "buildman sun8i"
231       env:
232         - BUILDMAN="sun8i"
233     - name: "buildman sun9i"
234       env:
235         - BUILDMAN="sun9i"
236     - name: "buildman sun50i"
237       env:
238         - BUILDMAN="sun50i"
239     - name: "buildman catch-all ARM"
240       env:
241         - BUILDMAN="arm -x arm11,arm7,arm9,aarch64,at91,freescale,kirkwood,mvebu,siemens,tegra,uniphier,mx,samsung,sunxi,am33xx,omap,pxa,rockchip,toradex,socfpga,k2,xilinx"
242     - name: "buildman sandbox x86"
243       env:
244         - BUILDMAN="sandbox x86"
245           TOOLCHAIN="i386"
246     - name: "buildman kirkwood"
247       env:
248         - BUILDMAN="kirkwood"
249     - name: "buildman mvebu"
250       env:
251         - BUILDMAN="mvebu"
252     - name: "buildman PXA (non-toradex)"
253       env:
254         - BUILDMAN="pxa -x toradex"
255     - name: "buildman m68k"
256       env:
257         - BUILDMAN="m68k"
258           TOOLCHAIN="m68k"
259     - name: "buildman microblaze"
260       env:
261         - BUILDMAN="microblaze"
262           TOOLCHAIN="microblaze"
263     - name: "buildman mips"
264       env:
265         - BUILDMAN="mips"
266           TOOLCHAIN="mips"
267     - name: "buildman non-Freescale PowerPC"
268       env:
269         - BUILDMAN="powerpc -x freescale"
270           TOOLCHAIN="powerpc"
271     - name: "buildman mpc85xx&freescale (excluding many)"
272       env:
273         - BUILDMAN="mpc85xx&freescale -x t208xrdb -x t4qds -x t102* -x p1_p2_rdb_pc -x p1010rdb -x corenet_ds -x b4860qds -x bsc91*"
274           TOOLCHAIN="powerpc"
275     - name: "buildman t208xrdb corenet_ds"
276       env:
277         - BUILDMAN="t208xrdb corenet_ds"
278           TOOLCHAIN="powerpc"
279     - name: "buildman Freescale PowerPC"
280       env:
281         - BUILDMAN="t4qds b4860qds mpc83xx&freescale mpc86xx&freescale"
282           TOOLCHAIN="powerpc"
283     - name: "buildman t102*"
284       env:
285         - BUILDMAN="t102*"
286           TOOLCHAIN="powerpc"
287     - name: "buildman p1_p2_rdb_pc"
288       env:
289         - BUILDMAN="p1_p2_rdb_pc"
290           TOOLCHAIN="powerpc"
291     - name: "buildman p1010rdb bsc91"
292       env:
293         - BUILDMAN="p1010rdb bsc91"
294           TOOLCHAIN="powerpc"
295     - name: "buildman siemens"
296       env:
297         - BUILDMAN="siemens"
298     - name: "buildman tegra"
299       env:
300         - BUILDMAN="tegra -x toradex"
301     - name: "buildman am33xx (no siemens)"
302       env:
303         - BUILDMAN="am33xx -x siemens"
304     - name: "buildman omap"
305       env:
306         - BUILDMAN="omap"
307     - name: "buildman uniphier"
308       env:
309         - BUILDMAN="uniphier"
310     - name: "buildman catch-all AArch64"
311       env:
312         - BUILDMAN="aarch64 -x tegra,ls1,ls2,mvebu,uniphier,sunxi,samsung,rockchip,xilinx"
313     - name: "buildman rockchip"
314       env:
315         - BUILDMAN="rockchip"
316     - name: "buildman sh"
317       env:
318         - BUILDMAN="sh -x arm"
319           TOOLCHAIN="sh"
320     - name: "buildman Xilinx (ARM)"
321       env:
322         - BUILDMAN="xilinx -x microblaze"
323     - name: "buildman xtensa"
324       env:
325         - BUILDMAN="xtensa"
326           TOOLCHAIN="xtensa-dc233c-elf"
327     - name: "buildman riscv"
328       env:
329         - BUILDMAN="riscv"
330           TOOLCHAIN="riscv"
331     - name: "buildman nds32"
332       env:
333         - BUILDMAN="nds32"
334           TOOLCHAIN="nds32"
335
336     # QA jobs for code analytics
337     # static code analysis with cppcheck (we can add --enable=all later)
338     - name: "cppcheck"
339       script:
340         - cppcheck --force --quiet --inline-suppr .
341     # search for TODO within source tree
342     - name: "grep TODO"
343       script:
344         - grep -r TODO .
345     # search for FIXME within source tree
346     - name: "grep FIXME HACK"
347       script:
348         - grep -r FIXME .
349     # search for HACK within source tree and ignore HACKKIT board
350       script:
351         - grep -r HACK . | grep -v HACKKIT
352     # some statistics about the code base
353     - name: "sloccount"
354       script:
355         - sloccount .
356     # ensure all configs have MAINTAINERS entries
357     - name: "Check for configs without MAINTAINERS entry"
358       script:
359         - if [ `./tools/genboardscfg.py -f 2>&1 | wc -l` -ne 0 ]; then exit 1; fi
360     # Ensure host tools build
361     - name: "Build tools-only"
362       script:
363         - make tools-only_config tools-only -j$(nproc)
364     # Ensure env tools build
365     - name: "Build envtools"
366       script:
367         - make tools-only_config envtools -j$(nproc)
368
369     # test/py
370     - name: "test/py sandbox"
371       env:
372         - TEST_PY_BD="sandbox"
373           BUILDMAN="^sandbox$"
374           TOOLCHAIN="i386"
375     - name: "test/py sandbox with clang"
376       env:
377         - TEST_PY_BD="sandbox"
378           BUILDMAN="^sandbox$"
379           OVERRIDE="clang-7"
380     - name: "test/py sandbox_spl"
381       env:
382         - TEST_PY_BD="sandbox_spl"
383           TEST_PY_TEST_SPEC="test_ofplatdata"
384           BUILDMAN="^sandbox$"
385           TOOLCHAIN="i386"
386           TEST_PY_TOOLS="yes"
387     - name: "test/py sandbox_flattree"
388       env:
389         - TEST_PY_BD="sandbox_flattree"
390           BUILDMAN="^sandbox_flattree$"
391           TOOLCHAIN="i386"
392     - name: "test/py evb-ast2500"
393       env:
394         - TEST_PY_BD="evb-ast2500"
395           TEST_PY_ID="--id qemu"
396           QEMU_TARGET="arm-softmmu"
397           QEMU_VERSION="506179e42112be77bfd071f050b15762d3b2cd43"
398           BUILDMAN="^evb-ast2500$"
399     - name: "test/py vexpress_ca15_tc2"
400       env:
401         - TEST_PY_BD="vexpress_ca15_tc2"
402           TEST_PY_ID="--id qemu"
403           QEMU_TARGET="arm-softmmu"
404           QEMU_VERSION="v3.0.0"
405           BUILDMAN="^vexpress_ca15_tc2$"
406     - name: "test/py vexpress_ca9x4"
407       env:
408         - TEST_PY_BD="vexpress_ca9x4"
409           TEST_PY_ID="--id qemu"
410           QEMU_TARGET="arm-softmmu"
411           BUILDMAN="^vexpress_ca9x4$"
412     - name: "test/py integratorcp_cm926ejs"
413       env:
414         - TEST_PY_BD="integratorcp_cm926ejs"
415           TEST_PY_TEST_SPEC="not sleep"
416           TEST_PY_ID="--id qemu"
417           QEMU_TARGET="arm-softmmu"
418           BUILDMAN="^integratorcp_cm926ejs$"
419     - name: "test/py qemu_arm"
420       env:
421         - TEST_PY_BD="qemu_arm"
422           TEST_PY_TEST_SPEC="not sleep"
423           QEMU_TARGET="arm-softmmu"
424           BUILDMAN="^qemu_arm$"
425     - name: "test/py qemu_arm64"
426       env:
427         - TEST_PY_BD="qemu_arm64"
428           TEST_PY_TEST_SPEC="not sleep"
429           QEMU_TARGET="aarch64-softmmu"
430           BUILDMAN="^qemu_arm64$"
431     - name: "test/py qemu_mips"
432       env:
433         - TEST_PY_BD="qemu_mips"
434           TEST_PY_TEST_SPEC="not sleep"
435           QEMU_TARGET="mips-softmmu"
436           BUILDMAN="^qemu_mips$"
437           TOOLCHAIN="mips"
438     - name: "test/py qemu_mipsel"
439       env:
440         - TEST_PY_BD="qemu_mipsel"
441           TEST_PY_TEST_SPEC="not sleep"
442           QEMU_TARGET="mipsel-softmmu"
443           BUILDMAN="^qemu_mipsel$"
444           TOOLCHAIN="mips"
445     - name: "test/py qemu_mips64"
446       env:
447         - TEST_PY_BD="qemu_mips64"
448           TEST_PY_TEST_SPEC="not sleep"
449           QEMU_TARGET="mips64-softmmu"
450           BUILDMAN="^qemu_mips64$"
451           TOOLCHAIN="mips"
452     - name: "test/py qemu_mips64el"
453       env:
454         - TEST_PY_BD="qemu_mips64el"
455           TEST_PY_TEST_SPEC="not sleep"
456           QEMU_TARGET="mips64el-softmmu"
457           BUILDMAN="^qemu_mips64el$"
458           TOOLCHAIN="mips"
459     - name: "test/py qemu-ppce500"
460       env:
461         - TEST_PY_BD="qemu-ppce500"
462           TEST_PY_TEST_SPEC="not sleep"
463           QEMU_TARGET="ppc-softmmu"
464           BUILDMAN="^qemu-ppce500$"
465           TOOLCHAIN="powerpc"
466     - name: "test/py qemu-riscv64"
467       env:
468         - TEST_PY_BD="qemu-riscv64"
469           TEST_PY_TEST_SPEC="not sleep"
470           QEMU_TARGET="riscv64-softmmu"
471           BUILDMAN="^qemu-riscv64$"
472           TOOLCHAIN="riscv"
473     - name: "test/py qemu-x86"
474       env:
475         - TEST_PY_BD="qemu-x86"
476           TEST_PY_TEST_SPEC="not sleep"
477           QEMU_TARGET="i386-softmmu"
478           BUILDMAN="^qemu-x86$"
479           TOOLCHAIN="i386"
480           BUILD_ROM="yes"
481     - name: "test/py qemu-x86_64"
482       env:
483         - TEST_PY_BD="qemu-x86_64"
484           TEST_PY_TEST_SPEC="not sleep"
485           QEMU_TARGET="x86_64-softmmu"
486           BUILDMAN="^qemu-x86_64$"
487           TOOLCHAIN="i386"
488           BUILD_ROM="yes"
489     - name: "test/py zynq_zc702"
490       env:
491         - TEST_PY_BD="zynq_zc702"
492           TEST_PY_TEST_SPEC="not sleep"
493           QEMU_TARGET="arm-softmmu"
494           TEST_PY_ID="--id qemu"
495           BUILDMAN="^zynq_zc702$"
496     - name: "test/py xilinx_versal_virt"
497       env:
498         - TEST_PY_BD="xilinx_versal_virt"
499           TEST_PY_TEST_SPEC="not sleep"
500           QEMU_TARGET="aarch64-softmmu"
501           TEST_PY_ID="--id qemu"
502           BUILDMAN="^xilinx_versal_virt$"
503     - name: "test/py xtfpga"
504       env:
505         - TEST_PY_BD="xtfpga"
506           TEST_PY_TEST_SPEC="not sleep"
507           QEMU_TARGET="xtensa-softmmu"
508           TEST_PY_ID="--id qemu"
509           BUILDMAN="^xtfpga$"
510           TOOLCHAIN="xtensa-dc233c-elf"
511
512 # TODO make it perfect ;-r