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