xref: /openbmc/u-boot/.travis.yml (revision 74389c13)
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,atmel,kirkwood,spear)"
167      env:
168        - JOB="arm926ejs"
169          BUILDMAN="arm926ejs -x freescale,siemens,atmel,kirkwood,spear,omap"
170    - name: "buildman atmel"
171      env:
172        - BUILDMAN="atmel"
173    - name: "buildman boundary engicam toradex"
174      env:
175        - BUILDMAN="boundary engicam toradex"
176    - name: "buildman NXP ARM32"
177      env:
178        - BUILDMAN="freescale -x powerpc,m68k,aarch64"
179    - name: "buildman NXP AArch64 LS101x"
180      env:
181        - BUILDMAN="freescale&aarch64&ls101"
182    - name: "buildman NXP AArch64 LS104x"
183      env:
184        - BUILDMAN="freescale&aarch64&ls104"
185    - name: "buildman NXP AArch64 LS108x"
186      env:
187        - BUILDMAN="freescale&aarch64&ls108"
188    - name: "buildman NXP AArch64 LS20xx"
189      env:
190        - BUILDMAN="freescale&aarch64&&ls20"
191    - name: "buildman i.MX6 (non-NXP)"
192      env:
193        - BUILDMAN="mx6 -x freescale,toradex,boundary,engicam"
194    - name: "buildman i.MX (non-NXP,i.MX6,toradex)"
195      env:
196        - BUILDMAN="mx -x freescale,mx6,toradex"
197    - name: "buildman k2"
198      env:
199        - BUILDMAN="k2"
200    - name: "buildman samsung socfpga"
201      env:
202        - BUILDMAN="samsung socfpga"
203    - name: "buildman spear"
204      env:
205        - BUILDMAN="spear"
206    - name: "buildman sun4i"
207      env:
208        - BUILDMAN="sun4i"
209    - name: "buildman sun5i"
210      env:
211        - BUILDMAN="sun5i"
212    - name: "buildman sun6i"
213      env:
214        - BUILDMAN="sun6i"
215    - name: "buildman sun7i"
216      env:
217        - BUILDMAN="sun7i"
218    - name: "buildman sun8i"
219      env:
220        - BUILDMAN="sun8i"
221    - name: "buildman sun9i"
222      env:
223        - BUILDMAN="sun9i"
224    - name: "buildman sun50i"
225      env:
226        - BUILDMAN="sun50i"
227    - name: "buildman catch-all ARM"
228      env:
229        - BUILDMAN="arm -x arm11,arm7,arm9,aarch64,atmel,freescale,kirkwood,mvebu,siemens,tegra,uniphier,mx,samsung,sunxi,am33xx,omap,pxa,rockchip,toradex,socfpga,k2,xilinx"
230    - name: "buildman sandbox x86"
231      env:
232        - BUILDMAN="sandbox x86"
233          TOOLCHAIN="i386"
234    - name: "buildman kirkwood (excluding openrd)"
235      env:
236        - BUILDMAN="kirkwood -x openrd"
237    - name: "buildman mvebu"
238      env:
239        - BUILDMAN="mvebu"
240    - name: "buildman PXA (non-toradex)"
241      env:
242        - BUILDMAN="pxa -x toradex"
243    - name: "buildman m68k"
244      env:
245        - BUILDMAN="m68k"
246          TOOLCHAIN="m68k"
247    - name: "buildman microblaze"
248      env:
249        - BUILDMAN="microblaze"
250          TOOLCHAIN="microblaze"
251    - name: "buildman mips"
252      env:
253        - BUILDMAN="mips"
254          TOOLCHAIN="mips"
255    - name: "buildman non-Freescale PowerPC"
256      env:
257        - BUILDMAN="powerpc -x freescale"
258          TOOLCHAIN="powerpc"
259    - name: "buildman mpc85xx&freescale (excluding many)"
260      env:
261        - BUILDMAN="mpc85xx&freescale -x t208xrdb -x t4qds -x t102* -x p1_p2_rdb_pc -x p1010rdb -x corenet_ds -x b4860qds -x bsc91*"
262          TOOLCHAIN="powerpc"
263    - name: "buildman t208xrdb corenet_ds"
264      env:
265        - BUILDMAN="t208xrdb corenet_ds"
266          TOOLCHAIN="powerpc"
267    - name: "buildman Freescale PowerPC"
268      env:
269        - BUILDMAN="t4qds b4860qds mpc83xx&freescale mpc86xx&freescale"
270          TOOLCHAIN="powerpc"
271    - name: "buildman t102*"
272      env:
273        - BUILDMAN="t102*"
274          TOOLCHAIN="powerpc"
275    - name: "buildman p1_p2_rdb_pc"
276      env:
277        - BUILDMAN="p1_p2_rdb_pc"
278          TOOLCHAIN="powerpc"
279    - name: "buildman p1010rdb bsc91"
280      env:
281        - BUILDMAN="p1010rdb bsc91"
282          TOOLCHAIN="powerpc"
283    - name: "buildman siemens"
284      env:
285        - BUILDMAN="siemens"
286    - name: "buildman tegra"
287      env:
288        - BUILDMAN="tegra -x toradex"
289    - name: "buildman am33xx (no siemens)"
290      env:
291        - BUILDMAN="am33xx -x siemens"
292    - name: "buildman omap"
293      env:
294        - BUILDMAN="omap"
295    - name: "buildman uniphier"
296      env:
297        - BUILDMAN="uniphier"
298    - name: "buildman catch-all AArch64"
299      env:
300        - BUILDMAN="aarch64 -x tegra,ls1,ls2,mvebu,uniphier,sunxi,samsung,rockchip,xilinx"
301    - name: "buildman rockchip"
302      env:
303        - BUILDMAN="rockchip"
304    - name: "buildman sh"
305      env:
306        - BUILDMAN="sh -x arm"
307          TOOLCHAIN="sh"
308    - name: "buildman Xilinx (ARM)"
309      env:
310        - BUILDMAN="xilinx -x microblaze"
311    - name: "buildman xtensa"
312      env:
313        - BUILDMAN="xtensa"
314          TOOLCHAIN="xtensa-dc233c-elf"
315    - name: "buildman riscv"
316      env:
317        - BUILDMAN="riscv"
318          TOOLCHAIN="riscv"
319    - name: "buildman nds32"
320      env:
321        - BUILDMAN="nds32"
322          TOOLCHAIN="nds32"
323
324    # QA jobs for code analytics
325    # static code analysis with cppcheck (we can add --enable=all later)
326    - name: "cppcheck"
327      script:
328        - cppcheck --force --quiet --inline-suppr .
329    # search for TODO within source tree
330    - name: "grep TODO"
331      script:
332        - grep -r TODO .
333    # search for FIXME within source tree
334    - name: "grep FIXME HACK"
335      script:
336        - grep -r FIXME .
337    # search for HACK within source tree and ignore HACKKIT board
338      script:
339        - grep -r HACK . | grep -v HACKKIT
340    # some statistics about the code base
341    - name: "sloccount"
342      script:
343        - sloccount .
344    # ensure all configs have MAINTAINERS entries
345    - name: "Check for configs without MAINTAINERS entry"
346      script:
347        - if [ `./tools/genboardscfg.py -f 2>&1 | wc -l` -ne 0 ]; then exit 1; fi
348    # Ensure host tools build
349    - name: "Build tools-only"
350      script:
351        - make tools-only_config tools-only -j$(nproc)
352
353    # test/py
354    - name: "test/py sandbox"
355      env:
356        - TEST_PY_BD="sandbox"
357          BUILDMAN="^sandbox$"
358          TOOLCHAIN="i386"
359    - name: "test/py sandbox with clang"
360      env:
361        - TEST_PY_BD="sandbox"
362          BUILDMAN="^sandbox$"
363          OVERRIDE="clang-7"
364    - name: "test/py sandbox_spl"
365      env:
366        - TEST_PY_BD="sandbox_spl"
367          TEST_PY_TEST_SPEC="test_ofplatdata"
368          BUILDMAN="^sandbox$"
369          TOOLCHAIN="i386"
370          TEST_PY_TOOLS="yes"
371    - name: "test/py sandbox_flattree"
372      env:
373        - TEST_PY_BD="sandbox_flattree"
374          BUILDMAN="^sandbox_flattree$"
375          TOOLCHAIN="i386"
376    - name: "test/py vexpress_ca15_tc2"
377      env:
378        - TEST_PY_BD="vexpress_ca15_tc2"
379          TEST_PY_ID="--id qemu"
380          QEMU_TARGET="arm-softmmu"
381          QEMU_VERSION="v3.0.0"
382          BUILDMAN="^vexpress_ca15_tc2$"
383    - name: "test/py vexpress_ca9x4"
384      env:
385        - TEST_PY_BD="vexpress_ca9x4"
386          TEST_PY_ID="--id qemu"
387          QEMU_TARGET="arm-softmmu"
388          BUILDMAN="^vexpress_ca9x4$"
389    - name: "test/py integratorcp_cm926ejs"
390      env:
391        - TEST_PY_BD="integratorcp_cm926ejs"
392          TEST_PY_TEST_SPEC="not sleep"
393          TEST_PY_ID="--id qemu"
394          QEMU_TARGET="arm-softmmu"
395          BUILDMAN="^integratorcp_cm926ejs$"
396    - name: "test/py qemu_arm"
397      env:
398        - TEST_PY_BD="qemu_arm"
399          TEST_PY_TEST_SPEC="not sleep"
400          QEMU_TARGET="arm-softmmu"
401          BUILDMAN="^qemu_arm$"
402    - name: "test/py qemu_arm64"
403      env:
404        - TEST_PY_BD="qemu_arm64"
405          TEST_PY_TEST_SPEC="not sleep"
406          QEMU_TARGET="aarch64-softmmu"
407          BUILDMAN="^qemu_arm64$"
408    - name: "test/py qemu_mips"
409      env:
410        - TEST_PY_BD="qemu_mips"
411          TEST_PY_TEST_SPEC="not sleep"
412          QEMU_TARGET="mips-softmmu"
413          BUILDMAN="^qemu_mips$"
414          TOOLCHAIN="mips"
415    - name: "test/py qemu_mipsel"
416      env:
417        - TEST_PY_BD="qemu_mipsel"
418          TEST_PY_TEST_SPEC="not sleep"
419          QEMU_TARGET="mipsel-softmmu"
420          BUILDMAN="^qemu_mipsel$"
421          TOOLCHAIN="mips"
422    - name: "test/py qemu_mips64"
423      env:
424        - TEST_PY_BD="qemu_mips64"
425          TEST_PY_TEST_SPEC="not sleep"
426          QEMU_TARGET="mips64-softmmu"
427          BUILDMAN="^qemu_mips64$"
428          TOOLCHAIN="mips"
429    - name: "test/py qemu_mips64el"
430      env:
431        - TEST_PY_BD="qemu_mips64el"
432          TEST_PY_TEST_SPEC="not sleep"
433          QEMU_TARGET="mips64el-softmmu"
434          BUILDMAN="^qemu_mips64el$"
435          TOOLCHAIN="mips"
436    - name: "test/py qemu-ppce500"
437      env:
438        - TEST_PY_BD="qemu-ppce500"
439          TEST_PY_TEST_SPEC="not sleep"
440          QEMU_TARGET="ppc-softmmu"
441          BUILDMAN="^qemu-ppce500$"
442          TOOLCHAIN="powerpc"
443    - name: "test/py qemu-x86"
444      env:
445        - TEST_PY_BD="qemu-x86"
446          TEST_PY_TEST_SPEC="not sleep"
447          QEMU_TARGET="i386-softmmu"
448          BUILDMAN="^qemu-x86$"
449          TOOLCHAIN="i386"
450          BUILD_ROM="yes"
451    - name: "test/py qemu-x86_64"
452      env:
453        - TEST_PY_BD="qemu-x86_64"
454          TEST_PY_TEST_SPEC="not sleep"
455          QEMU_TARGET="x86_64-softmmu"
456          BUILDMAN="^qemu-x86_64$"
457          TOOLCHAIN="i386"
458          BUILD_ROM="yes"
459    - name: "test/py zynq_zc702"
460      env:
461        - TEST_PY_BD="zynq_zc702"
462          TEST_PY_TEST_SPEC="not sleep"
463          QEMU_TARGET="arm-softmmu"
464          TEST_PY_ID="--id qemu"
465          BUILDMAN="^zynq_zc702$"
466    - name: "test/py xilinx_versal_virt"
467      env:
468        - TEST_PY_BD="xilinx_versal_virt"
469          TEST_PY_TEST_SPEC="not sleep"
470          QEMU_TARGET="aarch64-softmmu"
471          TEST_PY_ID="--id qemu"
472          BUILDMAN="^xilinx_versal_virt$"
473    - name: "test/py xtfpga"
474      env:
475        - TEST_PY_BD="xtfpga"
476          TEST_PY_TEST_SPEC="not sleep"
477          QEMU_TARGET="xtensa-softmmu"
478          TEST_PY_ID="--id qemu"
479          BUILDMAN="^xtfpga$"
480          TOOLCHAIN="xtensa-dc233c-elf"
481
482# TODO make it perfect ;-r
483