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