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