xref: /openbmc/u-boot/.travis.yml (revision 22c793e6)
1# Copyright Roger Meier <r.meier@siemens.com>
2# SPDX-License-Identifier:	GPL-2.0+
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    - gcc-powerpc-linux-gnu
25    - iasl
26    - grub-efi-ia32-bin
27    - rpm2cpio
28    - wget
29    - device-tree-compiler
30    - lzop
31
32install:
33 # Clone uboot-test-hooks
34 - git clone --depth=1 git://github.com/swarren/uboot-test-hooks.git /tmp/uboot-test-hooks
35 - ln -s travis-ci /tmp/uboot-test-hooks/bin/`hostname`
36 - ln -s travis-ci /tmp/uboot-test-hooks/py/`hostname`
37 # prepare buildman environment
38 - echo -e "[toolchain]\nroot = /usr" > ~/.buildman
39 - echo -e "aarch64 = /tmp/gcc-linaro-6.3.1-2017.02-x86_64_aarch64-linux-gnu" >> ~/.buildman
40 - echo -e "arm = /tmp/gcc-linaro-6.3.1-2017.02-x86_64_arm-linux-gnueabihf" >> ~/.buildman
41 - echo -e "arc = /tmp/arc_gnu_2016.09_prebuilt_uclibc_le_archs_linux_install" >> ~/.buildman
42 - echo -e "\n[toolchain-alias]\nsh = sh4\nopenrisc = or32" >> ~/.buildman
43 - cat ~/.buildman
44 - virtualenv /tmp/venv
45 - . /tmp/venv/bin/activate
46 - pip install pytest
47 - grub-mkimage -o ~/grub_x86.efi -O i386-efi normal  echo lsefimmap lsefi lsefisystab efinet tftp minicmd
48 - mkdir ~/grub2-arm
49 - ( 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 )
50 - mkdir ~/grub2-arm64
51 - ( 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 )
52
53env:
54  global:
55    - PATH=/tmp/qemu-install/bin:/tmp/uboot-test-hooks/bin:/usr/bin:/bin
56    - PYTHONPATH=/tmp/uboot-test-hooks/py/travis-ci
57    - BUILD_DIR=build
58    - HOSTCC="cc"
59    - HOSTCXX="c++"
60
61before_script:
62  # install toolchains based on TOOLCHAIN} variable
63  - if [[ "${TOOLCHAIN}" == *m68k* ]]; then ./tools/buildman/buildman --fetch-arch m68k ; fi
64  - if [[ "${TOOLCHAIN}" == *microblaze* ]]; then ./tools/buildman/buildman --fetch-arch microblaze ; fi
65  - if [[ "${TOOLCHAIN}" == *mips* ]]; then ./tools/buildman/buildman --fetch-arch mips ; fi
66  - if [[ "${TOOLCHAIN}" == *or32* ]]; then ./tools/buildman/buildman --fetch-arch or32 ; fi
67  - if [[ "${TOOLCHAIN}" == *sh4* ]]; then ./tools/buildman/buildman --fetch-arch sh4 ; fi
68  - if [[ "${TOOLCHAIN}" == *x86_64* ]]; then
69      ./tools/buildman/buildman --fetch-arch x86_64;
70      echo -e "\n[toolchain-prefix]\nx86 = ${HOME}/.buildman-toolchains/gcc-4.9.0-nolibc/x86_64-linux/bin/x86_64-linux-" >> ~/.buildman;
71    fi
72  - if [[ "${TOOLCHAIN}" == arc ]]; then
73       wget https://github.com/foss-for-synopsys-dwc-arc-processors/toolchain/releases/download/arc-2016.09-release/arc_gnu_2016.09_prebuilt_uclibc_le_archs_linux_install.tar.gz &&
74       tar -C /tmp -xf arc_gnu_2016.09_prebuilt_uclibc_le_archs_linux_install.tar.gz;
75    fi
76  - if [[ "${TOOLCHAIN}" == *xtensa* ]]; then
77       wget https://github.com/foss-xtensa/toolchain/releases/download/2018.02/x86_64-2018.02-${TOOLCHAIN}.tar.gz &&
78       tar -C /tmp -xf x86_64-2018.02-${TOOLCHAIN}.tar.gz &&
79       echo -e "\n[toolchain-prefix]\nxtensa = /tmp/2018.02/${TOOLCHAIN}/bin/${TOOLCHAIN}-" >> ~/.buildman;
80    fi
81  # If TOOLCHAIN is unset, we're on some flavour of ARM.
82  - if [[ "${TOOLCHAIN}" == "" ]]; then
83       wget http://releases.linaro.org/components/toolchain/binaries/6.3-2017.02/aarch64-linux-gnu/gcc-linaro-6.3.1-2017.02-x86_64_aarch64-linux-gnu.tar.xz &&
84       wget http://releases.linaro.org/components/toolchain/binaries/6.3-2017.02/arm-linux-gnueabihf/gcc-linaro-6.3.1-2017.02-x86_64_arm-linux-gnueabihf.tar.xz &&
85       tar -C /tmp -xf gcc-linaro-6.3.1-2017.02-x86_64_aarch64-linux-gnu.tar.xz &&
86       tar -C /tmp -xf gcc-linaro-6.3.1-2017.02-x86_64_arm-linux-gnueabihf.tar.xz;
87    fi
88  - if [[ "${TOOLCHAIN}" == "riscv" ]]; then
89        wget https://github.com/PkmX/riscv-prebuilt-toolchains/releases/download/20180111/riscv32-unknown-elf-toolchain.tar.gz &&
90        tar -C /tmp -xf riscv32-unknown-elf-toolchain.tar.gz &&
91        echo -e "\n[toolchain-prefix]\nriscv = /tmp/riscv32-unknown-elf/bin/riscv32-unknown-elf-" >> ~/.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    - env:
149        - BUILDMAN="arc"
150          TOOLCHAIN="arc"
151    - env:
152        - BUILDMAN="arm11"
153    - env:
154        - BUILDMAN="arm7"
155    - env:
156        - BUILDMAN="arm920t"
157    - env:
158        - JOB="arm926ejs"
159          BUILDMAN="arm926ejs -x mx,siemens,atmel"
160    - env:
161        - BUILDMAN="arm946es"
162    - env:
163        - BUILDMAN="atmel"
164    - env:
165        - BUILDMAN="aries"
166    - env:
167        - JOB="Boundary Devices"
168          BUILDMAN="boundary"
169    - env:
170        - JOB="engicam"
171          BUILDMAN="engicam"
172    - env:
173        - JOB="Freescale ARM32"
174          BUILDMAN="freescale -x powerpc,m68k,aarch64"
175    - env:
176        - JOB="Freescale AArch64"
177          BUILDMAN="freescale&aarch64"
178    - env:
179        - JOB="i.MX6 (non-Freescale)"
180          BUILDMAN="mx6 -x freescale,toradex,boundary,engicam"
181    - env:
182        - JOB="i.MX (non-Freescale, non-i.MX6)"
183          BUILDMAN="mx -x freescale,mx6,toradex"
184    - env:
185        - BUILDMAN="k2"
186    - env:
187        - BUILDMAN="samsung"
188    - env:
189        - BUILDMAN="socfpga"
190    - env:
191        - BUILDMAN="sun4i"
192    - env:
193        - BUILDMAN="sun5i"
194    - env:
195        - BUILDMAN="sun6i"
196    - env:
197        - BUILDMAN="sun7i"
198    - env:
199        - BUILDMAN="sun8i"
200    - env:
201        - BUILDMAN="sun9i"
202    - env:
203        - BUILDMAN="sun50i"
204    - env:
205        - JOB="Catch-all ARM"
206          BUILDMAN="arm -x arm11,arm7,arm9,aarch64,atmel,aries,freescale,kirkwood,mvebu,siemens,tegra,uniphier,mx,samsung,sunxi,am33xx,omap3,omap4,omap5,pxa,rockchip,toradex,socfpga,k2,xilinx"
207    - env:
208        - BUILDMAN="sandbox x86"
209          TOOLCHAIN="x86_64"
210    - env:
211        - BUILDMAN="toradex"
212    - env:
213        - BUILDMAN="kirkwood"
214    - env:
215        - BUILDMAN="mvebu"
216    - env:
217        - JOB="PXA"
218        - BUILDMAN="pxa -x toradex"
219    - env:
220        - BUILDMAN="m68k"
221          TOOLCHAIN="m68k"
222    - env:
223        - BUILDMAN="microblaze"
224          TOOLCHAIN="microblaze"
225    - env:
226        - BUILDMAN="mips"
227          TOOLCHAIN="mips"
228    - env:
229        - BUILDMAN="mpc83xx"
230    - env:
231        - BUILDMAN="mpc85xx -x freescale"
232    - env:
233        - BUILDMAN="mpc85xx -x t208xrdb -x t4qds -x t102* -x p1_p2_rdb_pc -x p1010rdb -x corenet_ds -x b4860qds -x sbc8548 -x bsc91*"
234    - env:
235        - BUILDMAN="t208xrdb"
236    - env:
237        - BUILDMAN="t4qds"
238    - env:
239        - BUILDMAN="t102*"
240    - env:
241        - BUILDMAN="p1_p2_rdb_pc"
242    - env:
243        - BUILDMAN="p1010rdb"
244    - env:
245        - BUILDMAN="corenet_ds b4860qds sbc8548 bsc91*"
246    - env:
247        - BUILDMAN="mpc86xx"
248    - env:
249        - BUILDMAN="mpc8xx"
250    - env:
251        - BUILDMAN="siemens"
252    - env:
253        - JOB="tegra"
254          BUILDMAN="tegra -x toradex"
255    - env:
256        - JOB="am33xx"
257          BUILDMAN="am33xx -x siemens"
258    - env:
259        - BUILDMAN="omap3"
260    - env:
261        - BUILDMAN="omap4"
262    - env:
263        - BUILDMAN="omap5"
264    - env:
265        - BUILDMAN="uniphier"
266    - env:
267        - JOB="aarch64"
268          BUILDMAN="aarch64 -x tegra,freescale,mvebu,uniphier,sunxi,samsung,rockchip"
269    - env:
270        - BUILDMAN="rockchip"
271    - env:
272        - BUILDMAN="sh4"
273          TOOLCHAIN="sh4"
274    - env:
275        - JOB="Xilinx (ARM)"
276          BUILDMAN="xilinx -x microblaze"
277    - env:
278        - BUILDMAN="xtensa"
279          TOOLCHAIN="xtensa-dc233c-elf"
280    - env:
281        - BUILDMAN="riscv"
282          TOOLCHAIN="riscv"
283
284    # QA jobs for code analytics
285    # static code analysis with cppcheck (we can add --enable=all later)
286    - env:
287        - JOB="cppcheck"
288      script:
289        - cppcheck --force --quiet --inline-suppr .
290    # search for TODO within source tree
291    - env:
292        - JOB="grep TODO"
293      script:
294        - grep -r TODO .
295    # search for FIXME within source tree
296    - env:
297        - JOB="grep FIXME HACK"
298      script:
299        - grep -r FIXME .
300    # search for HACK within source tree and ignore HACKKIT board
301      script:
302        - grep -r HACK . | grep -v HACKKIT
303    # some statistics about the code base
304    - env:
305        - JOB="sloccount"
306      script:
307        - sloccount .
308
309    # test/py
310    - env:
311        - TEST_PY_BD="sandbox"
312          BUILDMAN="^sandbox$"
313          TOOLCHAIN="x86_64"
314    - env:
315        - TEST_PY_BD="sandbox_spl"
316          TEST_PY_TEST_SPEC="test_ofplatdata"
317          BUILDMAN="^sandbox$"
318          TOOLCHAIN="x86_64"
319          TEST_PY_TOOLS="yes"
320    - env:
321        - TEST_PY_BD="sandbox_flattree"
322          BUILDMAN="^sandbox_flattree$"
323          TOOLCHAIN="x86_64"
324    - env:
325        - TEST_PY_BD="vexpress_ca15_tc2"
326          TEST_PY_ID="--id qemu"
327          QEMU_TARGET="arm-softmmu"
328          BUILDMAN="^vexpress_ca15_tc2$"
329    - env:
330        - TEST_PY_BD="vexpress_ca9x4"
331          TEST_PY_ID="--id qemu"
332          QEMU_TARGET="arm-softmmu"
333          BUILDMAN="^vexpress_ca9x4$"
334    - env:
335        - TEST_PY_BD="integratorcp_cm926ejs"
336          TEST_PY_TEST_SPEC="not sleep"
337          TEST_PY_ID="--id qemu"
338          QEMU_TARGET="arm-softmmu"
339          BUILDMAN="^integratorcp_cm926ejs$"
340    - env:
341        - TEST_PY_BD="qemu_arm"
342          TEST_PY_TEST_SPEC="not sleep"
343          QEMU_TARGET="arm-softmmu"
344          BUILDMAN="^qemu_arm$"
345    - env:
346        - TEST_PY_BD="qemu_arm64"
347          TEST_PY_TEST_SPEC="not sleep"
348          QEMU_TARGET="aarch64-softmmu"
349          BUILDMAN="^qemu_arm64$"
350    - env:
351        - TEST_PY_BD="qemu_mips"
352          TEST_PY_TEST_SPEC="not sleep"
353          QEMU_TARGET="mips-softmmu"
354          BUILDMAN="^qemu_mips$"
355          TOOLCHAIN="mips"
356    - env:
357        - TEST_PY_BD="qemu_mipsel"
358          TEST_PY_TEST_SPEC="not sleep"
359          QEMU_TARGET="mipsel-softmmu"
360          BUILDMAN="^qemu_mipsel$"
361          TOOLCHAIN="mips"
362    - env:
363        - TEST_PY_BD="qemu_mips64"
364          TEST_PY_TEST_SPEC="not sleep"
365          QEMU_TARGET="mips64-softmmu"
366          BUILDMAN="^qemu_mips64$"
367          TOOLCHAIN="mips"
368    - env:
369        - TEST_PY_BD="qemu_mips64el"
370          TEST_PY_TEST_SPEC="not sleep"
371          QEMU_TARGET="mips64el-softmmu"
372          BUILDMAN="^qemu_mips64el$"
373          TOOLCHAIN="mips"
374    - env:
375        - TEST_PY_BD="qemu-ppce500"
376          TEST_PY_TEST_SPEC="not sleep"
377          QEMU_TARGET="ppc-softmmu"
378          BUILDMAN="^qemu-ppce500$"
379    - env:
380        - TEST_PY_BD="qemu-x86"
381          TEST_PY_TEST_SPEC="not sleep"
382          QEMU_TARGET="i386-softmmu"
383          BUILDMAN="^qemu-x86$"
384          TOOLCHAIN="x86_64"
385          BUILD_ROM="yes"
386    - env:
387        - TEST_PY_BD="zynq_zc702"
388          TEST_PY_TEST_SPEC="not sleep"
389          QEMU_TARGET="arm-softmmu"
390          TEST_PY_ID="--id qemu"
391          BUILDMAN="^zynq_zc702$"
392    - env:
393        - TEST_PY_BD="xtfpga"
394          TEST_PY_TEST_SPEC="not sleep"
395          QEMU_TARGET="xtensa-softmmu"
396          TEST_PY_ID="--id qemu"
397          BUILDMAN="^xtfpga$"
398          TOOLCHAIN="xtensa-dc233c-elf"
399
400# TODO make it perfect ;-r
401