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