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