xref: /openbmc/u-boot/.travis.yml (revision 8d773c4a)
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_2017.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
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
67before_script:
68  # install toolchains based on TOOLCHAIN} variable
69  - if [[ "${TOOLCHAIN}" == *m68k* ]]; then ./tools/buildman/buildman --fetch-arch m68k ; fi
70  - if [[ "${TOOLCHAIN}" == *microblaze* ]]; then ./tools/buildman/buildman --fetch-arch microblaze ; fi
71  - if [[ "${TOOLCHAIN}" == *mips* ]]; then ./tools/buildman/buildman --fetch-arch mips ; fi
72  - if [[ "${TOOLCHAIN}" == *sh* ]]; then ./tools/buildman/buildman --fetch-arch sh2 ; fi
73  - if [[ "${TOOLCHAIN}" == *i386* ]]; then
74      ./tools/buildman/buildman --fetch-arch i386;
75      echo -e "\n[toolchain-alias]\nx86 = i386" >> ~/.buildman;
76    fi
77  - if [[ "${TOOLCHAIN}" == arc ]]; then
78       wget https://github.com/foss-for-synopsys-dwc-arc-processors/toolchain/releases/download/arc-2017.09-release/arc_gnu_2017.09_prebuilt_uclibc_le_archs_linux_install.tar.gz &&
79       tar -C /tmp -xf arc_gnu_2017.09_prebuilt_uclibc_le_archs_linux_install.tar.gz;
80    fi
81  - if [[ "${TOOLCHAIN}" == *xtensa* ]]; then
82       wget https://github.com/foss-xtensa/toolchain/releases/download/2018.02/x86_64-2018.02-${TOOLCHAIN}.tar.gz &&
83       tar -C /tmp -xf x86_64-2018.02-${TOOLCHAIN}.tar.gz &&
84       echo -e "\n[toolchain-prefix]\nxtensa = /tmp/2018.02/${TOOLCHAIN}/bin/${TOOLCHAIN}-" >> ~/.buildman;
85    fi
86  # If TOOLCHAIN is unset, we're on some flavour of ARM.
87  - if [[ "${TOOLCHAIN}" == "" ]]; then
88       ./tools/buildman/buildman --fetch-arch arm &&
89       ./tools/buildman/buildman --fetch-arch aarch64;
90    fi
91  - if [[ "${TOOLCHAIN}" == "powerpc" ]]; then ./tools/buildman/buildman --fetch-arch powerpc; fi
92  - if [[ "${TOOLCHAIN}" == "riscv" ]]; then
93       ./tools/buildman/buildman --fetch-arch riscv64;
94       echo -e "\n[toolchain-alias]\nriscv = riscv64" >> ~/.buildman;
95    fi
96  - if [[ "${QEMU_TARGET}" != "" ]]; then
97       git clone git://git.qemu.org/qemu.git /tmp/qemu;
98       pushd /tmp/qemu;
99       git submodule update --init dtc &&
100       git checkout v3.0.0 &&
101       ./configure --prefix=/tmp/qemu-install --target-list=${QEMU_TARGET} &&
102       make -j4 all install;
103       popd;
104    fi
105
106script:
107 # Comments must be outside the command strings below, or the Travis parser
108 # will get confused.
109 #
110 # From buildman, exit code 129 means warnings only.  If we've been asked to
111 # use clang only do one configuration.
112 - if [[ "${TOOLCHAIN}" == "clang" ]]; then
113     ret=0;
114     make O=../.bm-work/${TEST_PY_BD} HOSTCC=clang-7 CC=clang-7 -j$(nproc)
115       KCFLAGS=-Werror sandbox_config all || ret=$?;
116     if [[ $ret -ne 0 ]]; then
117       exit $ret;
118     fi;
119   elif [[ "${BUILDMAN}" != "" ]]; then
120     ret=0;
121     tools/buildman/buildman -P -E ${BUILDMAN} || 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
156matrix:
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-freescale,siemens,atmel,kirkwood,spear)"
168      env:
169        - JOB="arm926ejs"
170          BUILDMAN="arm926ejs -x freescale,siemens,atmel,kirkwood,spear"
171    - name: "buildman atmel"
172      env:
173        - BUILDMAN="atmel"
174    - name: "buildman boundary engicam toradex"
175      env:
176        - BUILDMAN="boundary engicam toradex"
177    - name: "buildman Freescale ARM32"
178      env:
179        - BUILDMAN="freescale -x powerpc,m68k,aarch64"
180    - name: "buildman Freescale AArch64 LS10xx"
181      env:
182        - BUILDMAN="freescale&aarch64&&ls1"
183    - name: "buildman Freescale AArch64 LS20xx"
184      env:
185        - BUILDMAN="freescale&aarch64&&ls2"
186    - name: "buildman i.MX6 (non-Freescale)"
187      env:
188        - BUILDMAN="mx6 -x freescale,toradex,boundary,engicam"
189    - name: "buildman i.MX (non-Freescale,i.MX6,toradex)"
190      env:
191        - BUILDMAN="mx -x freescale,mx6,toradex"
192    - name: "buildman k2"
193      env:
194        - BUILDMAN="k2"
195    - name: "buildman samsung socfpga"
196      env:
197        - BUILDMAN="samsung socfpga"
198    - name: "buildman spear"
199      env:
200        - BUILDMAN="spear"
201    - name: "buildman sun4i"
202      env:
203        - BUILDMAN="sun4i"
204    - name: "buildman sun5i"
205      env:
206        - BUILDMAN="sun5i"
207    - name: "buildman sun6i"
208      env:
209        - BUILDMAN="sun6i"
210    - name: "buildman sun7i"
211      env:
212        - BUILDMAN="sun7i"
213    - name: "buildman sun8i"
214      env:
215        - BUILDMAN="sun8i"
216    - name: "buildman sun9i"
217      env:
218        - BUILDMAN="sun9i"
219    - name: "buildman sun50i"
220      env:
221        - BUILDMAN="sun50i"
222    - name: "buildman catch-all ARM"
223      env:
224        - 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"
225    - name: "buildman sandbox x86"
226      env:
227        - BUILDMAN="sandbox x86"
228          TOOLCHAIN="i386"
229    - name: "buildman kirkwood (excluding openrd)"
230      env:
231        - BUILDMAN="kirkwood -x openrd"
232    - name: "buildman mvebu"
233      env:
234        - BUILDMAN="mvebu"
235    - name: "buildman PXA (non-toradex)"
236      env:
237        - BUILDMAN="pxa -x toradex"
238    - name: "buildman m68k"
239      env:
240        - BUILDMAN="m68k"
241          TOOLCHAIN="m68k"
242    - name: "buildman microblaze"
243      env:
244        - BUILDMAN="microblaze"
245          TOOLCHAIN="microblaze"
246    - name: "buildman mips"
247      env:
248        - BUILDMAN="mips"
249          TOOLCHAIN="mips"
250    - name: "buildman non-Freescale PowerPC"
251      env:
252        - BUILDMAN="powerpc -x freescale"
253          TOOLCHAIN="powerpc"
254    - name: "buildman mpc85xx&freescale (excluding many)"
255      env:
256        - BUILDMAN="mpc85xx&freescale -x t208xrdb -x t4qds -x t102* -x p1_p2_rdb_pc -x p1010rdb -x corenet_ds -x b4860qds -x bsc91*"
257          TOOLCHAIN="powerpc"
258    - name: "buildman t208xrdb corenet_ds"
259      env:
260        - BUILDMAN="t208xrdb corenet_ds"
261          TOOLCHAIN="powerpc"
262    - name: "buildman Freescale PowerPC"
263      env:
264        - BUILDMAN="t4qds b4860qds mpc83xx&freescale mpc86xx&freescale"
265          TOOLCHAIN="powerpc"
266    - name: "buildman t102*"
267      env:
268        - BUILDMAN="t102*"
269          TOOLCHAIN="powerpc"
270    - name: "buildman p1_p2_rdb_pc"
271      env:
272        - BUILDMAN="p1_p2_rdb_pc"
273          TOOLCHAIN="powerpc"
274    - name: "buildman p1010rdb bsc91"
275      env:
276        - BUILDMAN="p1010rdb bsc91"
277          TOOLCHAIN="powerpc"
278    - name: "buildman siemens"
279      env:
280        - BUILDMAN="siemens"
281    - name: "buildman tegra"
282      env:
283        - BUILDMAN="tegra -x toradex"
284    - name: "buildman am33xx (no siemens)"
285      env:
286        - BUILDMAN="am33xx -x siemens"
287    - name: "buildman omap"
288      env:
289        - BUILDMAN="omap"
290    - name: "buildman uniphier"
291      env:
292        - BUILDMAN="uniphier"
293    - name: "buildman catch-all AArch64"
294      env:
295        - BUILDMAN="aarch64 -x tegra,ls1,ls2,mvebu,uniphier,sunxi,samsung,rockchip,xilinx"
296    - name: "buildman rockchip"
297      env:
298        - BUILDMAN="rockchip"
299    - name: "buildman sh"
300      env:
301        - BUILDMAN="sh -x arm"
302          TOOLCHAIN="sh"
303    - name: "buildman Xilinx (ARM)"
304      env:
305        - BUILDMAN="xilinx -x microblaze"
306    - name: "buildman xtensa"
307      env:
308        - BUILDMAN="xtensa"
309          TOOLCHAIN="xtensa-dc233c-elf"
310    - name: "buildman riscv"
311      env:
312        - BUILDMAN="riscv"
313          TOOLCHAIN="riscv"
314
315    # QA jobs for code analytics
316    # static code analysis with cppcheck (we can add --enable=all later)
317    - name: "cppcheck"
318      script:
319        - cppcheck --force --quiet --inline-suppr .
320    # search for TODO within source tree
321    - name: "grep TODO"
322      script:
323        - grep -r TODO .
324    # search for FIXME within source tree
325    - name: "grep FIXME HACK"
326      script:
327        - grep -r FIXME .
328    # search for HACK within source tree and ignore HACKKIT board
329      script:
330        - grep -r HACK . | grep -v HACKKIT
331    # some statistics about the code base
332    - name: "sloccount"
333      script:
334        - sloccount .
335
336    # test/py
337    - name: "test/py sandbox"
338      env:
339        - TEST_PY_BD="sandbox"
340          BUILDMAN="^sandbox$"
341          TOOLCHAIN="i386"
342    - name: "test/py sandbox with clang"
343      env:
344        - TEST_PY_BD="sandbox"
345          BUILDMAN="^sandbox$"
346          TOOLCHAIN="clang"
347    - name: "test/py sandbox_spl"
348      env:
349        - TEST_PY_BD="sandbox_spl"
350          TEST_PY_TEST_SPEC="test_ofplatdata"
351          BUILDMAN="^sandbox$"
352          TOOLCHAIN="i386"
353          TEST_PY_TOOLS="yes"
354    - name: "test/py sandbox_flattree"
355      env:
356        - TEST_PY_BD="sandbox_flattree"
357          BUILDMAN="^sandbox_flattree$"
358          TOOLCHAIN="i386"
359    - name: "test/py vexpress_ca15_tc2"
360      env:
361        - TEST_PY_BD="vexpress_ca15_tc2"
362          TEST_PY_ID="--id qemu"
363          QEMU_TARGET="arm-softmmu"
364          BUILDMAN="^vexpress_ca15_tc2$"
365    - name: "test/py vexpress_ca9x4"
366      env:
367        - TEST_PY_BD="vexpress_ca9x4"
368          TEST_PY_ID="--id qemu"
369          QEMU_TARGET="arm-softmmu"
370          BUILDMAN="^vexpress_ca9x4$"
371    - name: "test/py integratorcp_cm926ejs"
372      env:
373        - TEST_PY_BD="integratorcp_cm926ejs"
374          TEST_PY_TEST_SPEC="not sleep"
375          TEST_PY_ID="--id qemu"
376          QEMU_TARGET="arm-softmmu"
377          BUILDMAN="^integratorcp_cm926ejs$"
378    - name: "test/py qemu_arm"
379      env:
380        - TEST_PY_BD="qemu_arm"
381          TEST_PY_TEST_SPEC="not sleep"
382          QEMU_TARGET="arm-softmmu"
383          BUILDMAN="^qemu_arm$"
384    - name: "test/py qemu_arm64"
385      env:
386        - TEST_PY_BD="qemu_arm64"
387          TEST_PY_TEST_SPEC="not sleep"
388          QEMU_TARGET="aarch64-softmmu"
389          BUILDMAN="^qemu_arm64$"
390    - name: "test/py qemu_mips"
391      env:
392        - TEST_PY_BD="qemu_mips"
393          TEST_PY_TEST_SPEC="not sleep"
394          QEMU_TARGET="mips-softmmu"
395          BUILDMAN="^qemu_mips$"
396          TOOLCHAIN="mips"
397    - name: "test/py qemu_mipsel"
398      env:
399        - TEST_PY_BD="qemu_mipsel"
400          TEST_PY_TEST_SPEC="not sleep"
401          QEMU_TARGET="mipsel-softmmu"
402          BUILDMAN="^qemu_mipsel$"
403          TOOLCHAIN="mips"
404    - name: "test/py qemu_mips64"
405      env:
406        - TEST_PY_BD="qemu_mips64"
407          TEST_PY_TEST_SPEC="not sleep"
408          QEMU_TARGET="mips64-softmmu"
409          BUILDMAN="^qemu_mips64$"
410          TOOLCHAIN="mips"
411    - name: "test/py qemu_mips64el"
412      env:
413        - TEST_PY_BD="qemu_mips64el"
414          TEST_PY_TEST_SPEC="not sleep"
415          QEMU_TARGET="mips64el-softmmu"
416          BUILDMAN="^qemu_mips64el$"
417          TOOLCHAIN="mips"
418    - name: "test/py qemu-ppce500"
419      env:
420        - TEST_PY_BD="qemu-ppce500"
421          TEST_PY_TEST_SPEC="not sleep"
422          QEMU_TARGET="ppc-softmmu"
423          BUILDMAN="^qemu-ppce500$"
424          TOOLCHAIN="powerpc"
425    - name: "test/py qemu-x86"
426      env:
427        - TEST_PY_BD="qemu-x86"
428          TEST_PY_TEST_SPEC="not sleep"
429          QEMU_TARGET="i386-softmmu"
430          BUILDMAN="^qemu-x86$"
431          TOOLCHAIN="i386"
432          BUILD_ROM="yes"
433    - name: "test/py qemu-x86_64"
434      env:
435        - TEST_PY_BD="qemu-x86_64"
436          TEST_PY_TEST_SPEC="not sleep"
437          QEMU_TARGET="x86_64-softmmu"
438          BUILDMAN="^qemu-x86_64$"
439          TOOLCHAIN="i386"
440          BUILD_ROM="yes"
441    - name: "test/py zynq_zc702"
442      env:
443        - TEST_PY_BD="zynq_zc702"
444          TEST_PY_TEST_SPEC="not sleep"
445          QEMU_TARGET="arm-softmmu"
446          TEST_PY_ID="--id qemu"
447          BUILDMAN="^zynq_zc702$"
448    - name: "test/py xtfpga"
449      env:
450        - TEST_PY_BD="xtfpga"
451          TEST_PY_TEST_SPEC="not sleep"
452          QEMU_TARGET="xtensa-softmmu"
453          TEST_PY_ID="--id qemu"
454          BUILDMAN="^xtfpga$"
455          TOOLCHAIN="xtensa-dc233c-elf"
456
457# TODO make it perfect ;-r
458