xref: /openbmc/u-boot/.travis.yml (revision 2c78a79e)
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    - rpm2cpio
30    - wget
31    - device-tree-compiler
32    - lzop
33    - liblz4-tool
34    - libisl15
35    - clang-7
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 - pip install python-subunit
51 - grub-mkimage -o ~/grub_x86.efi -O i386-efi normal  echo lsefimmap lsefi lsefisystab efinet tftp minicmd
52 - mkdir ~/grub2-arm
53 - ( 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 )
54 - mkdir ~/grub2-arm64
55 - ( 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 )
56
57env:
58  global:
59    - PATH=/tmp/qemu-install/bin:/tmp/uboot-test-hooks/bin:/usr/bin:/bin
60    - PYTHONPATH=/tmp/uboot-test-hooks/py/travis-ci
61    - BUILD_DIR=build
62    - HOSTCC="cc"
63    - HOSTCXX="c++"
64
65before_script:
66  # install toolchains based on TOOLCHAIN} variable
67  - if [[ "${TOOLCHAIN}" == *m68k* ]]; then ./tools/buildman/buildman --fetch-arch m68k ; fi
68  - if [[ "${TOOLCHAIN}" == *microblaze* ]]; then ./tools/buildman/buildman --fetch-arch microblaze ; fi
69  - if [[ "${TOOLCHAIN}" == *mips* ]]; then ./tools/buildman/buildman --fetch-arch mips ; fi
70  - if [[ "${TOOLCHAIN}" == *sh* ]]; then ./tools/buildman/buildman --fetch-arch sh2 ; fi
71  - if [[ "${TOOLCHAIN}" == *i386* ]]; then
72      ./tools/buildman/buildman --fetch-arch i386;
73      echo -e "\n[toolchain-alias]\nx86 = i386" >> ~/.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 # From buildman, exit code 129 means warnings only.  If we've been asked to
109 # use clang only do one configuration.
110 - if [[ "${TOOLCHAIN}" == "clang" ]]; then
111     ret=0;
112     make O=../.bm-work/${TEST_PY_BD} HOSTCC=clang-7 CC=clang-7 -j$(nproc)
113       KCFLAGS=-Werror sandbox_config all || ret=$?;
114     if [[ $ret -ne 0 ]]; then
115       exit $ret;
116     fi;
117   elif [[ "${BUILDMAN}" != "" ]]; then
118     ret=0;
119     tools/buildman/buildman -P -E ${BUILDMAN} || ret=$?;
120     if [[ $ret -ne 0 && $ret -ne 129 ]]; then
121       tools/buildman/buildman -sdeP ${BUILDMAN};
122       exit $ret;
123     fi;
124   fi
125 # "not a_test_which_does_not_exist" is a dummy -k parameter which will
126 # never prevent any test from running. That way, we can always pass
127 # "-k something" even when $TEST_PY_TEST_SPEC doesnt need a custom
128 # value.
129 - export UBOOT_TRAVIS_BUILD_DIR=`cd .. && pwd`/.bm-work/${TEST_PY_BD};
130   cp ~/grub_x86.efi $UBOOT_TRAVIS_BUILD_DIR/;
131   cp ~/grub2-arm/usr/lib/grub2/arm-efi/grub.efi $UBOOT_TRAVIS_BUILD_DIR/grub_arm.efi;
132   cp ~/grub2-arm64/usr/lib/grub2/arm64-efi/grub.efi $UBOOT_TRAVIS_BUILD_DIR/grub_arm64.efi;
133   if [[ "${TEST_PY_BD}" != "" ]]; then
134     ./test/py/test.py --bd ${TEST_PY_BD} ${TEST_PY_ID}
135       -k "${TEST_PY_TEST_SPEC:-not a_test_which_does_not_exist}"
136       --build-dir "$UBOOT_TRAVIS_BUILD_DIR";
137     ret=$?;
138     if [[ $ret -ne 0 ]]; then
139       exit $ret;
140     fi;
141   fi;
142   if [[ -n "${TEST_PY_TOOLS}" ]]; then
143     PYTHONPATH="${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc/pylibfdt"
144     PATH="${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc:${PATH}"
145     ./tools/binman/binman -t &&
146     ./tools/patman/patman --test &&
147     ./tools/buildman/buildman -t &&
148     PYTHONPATH="${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc/pylibfdt"
149     PATH="${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc:${PATH}"
150     ./tools/dtoc/dtoc -t;
151   fi
152
153matrix:
154  include:
155  # we need to build by vendor due to 50min time limit for builds
156  # each env setting here is a dedicated build
157    - name: "buildman arc"
158      env:
159        - BUILDMAN="arc"
160          TOOLCHAIN="arc"
161    - name: "buildman arm11 arm7 arm920t arm946es"
162      env:
163        - BUILDMAN="arm11 arm7 arm920t arm946es"
164    - name: "buildman arm926ejs (non-mx,siemens,atmel,kirkwood)"
165      env:
166        - JOB="arm926ejs"
167          BUILDMAN="arm926ejs -x mx,siemens,atmel,kirkwood"
168    - name: "buildman atmel"
169      env:
170        - BUILDMAN="atmel"
171    - name: "buildman boundary engicam toradex"
172      env:
173        - BUILDMAN="boundary engicam toradex"
174    - name: "buildman Freescale ARM32"
175      env:
176        - BUILDMAN="freescale -x powerpc,m68k,aarch64"
177    - name: "buildman Freescale AArch64"
178      env:
179        - BUILDMAN="freescale&aarch64"
180    - name: "buildman i.MX6 (non-Freescale)"
181      env:
182        - BUILDMAN="mx6 -x freescale,toradex,boundary,engicam"
183    - name: "buildman i.MX (non-Freescale,i.MX6,toradex)"
184      env:
185        - BUILDMAN="mx -x freescale,mx6,toradex"
186    - name: "buildman k2"
187      env:
188        - BUILDMAN="k2"
189    - name: "buildman samsung socfpga"
190      env:
191        - BUILDMAN="samsung socfpga"
192    - name: "buildman sun4i"
193      env:
194        - BUILDMAN="sun4i"
195    - name: "buildman sun5i"
196      env:
197        - BUILDMAN="sun5i"
198    - name: "buildman sun6i"
199      env:
200        - BUILDMAN="sun6i"
201    - name: "buildman sun7i"
202      env:
203        - BUILDMAN="sun7i"
204    - name: "buildman sun8i"
205      env:
206        - BUILDMAN="sun8i"
207    - name: "buildman sun9i"
208      env:
209        - BUILDMAN="sun9i"
210    - name: "buildman sun50i"
211      env:
212        - BUILDMAN="sun50i"
213    - name: "buildman catch-all ARM"
214      env:
215        - 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"
216    - name: "buildman sandbox x86"
217      env:
218        - BUILDMAN="sandbox x86"
219          TOOLCHAIN="i386"
220    - name: "buildman kirkwood (excluding openrd)"
221      env:
222        - BUILDMAN="kirkwood -x openrd"
223    - name: "buildman mvebu"
224      env:
225        - BUILDMAN="mvebu"
226    - name: "buildman PXA (non-toradex)"
227      env:
228        - BUILDMAN="pxa -x toradex"
229    - name: "buildman m68k"
230      env:
231        - BUILDMAN="m68k"
232          TOOLCHAIN="m68k"
233    - name: "buildman microblaze"
234      env:
235        - BUILDMAN="microblaze"
236          TOOLCHAIN="microblaze"
237    - name: "buildman mips"
238      env:
239        - BUILDMAN="mips"
240          TOOLCHAIN="mips"
241    - name: "buildman non-Freescale PowerPC"
242      env:
243        - BUILDMAN="powerpc -x freescale"
244          TOOLCHAIN="powerpc"
245    - name: "buildman mpc85xx&freescale (excluding many)"
246      env:
247        - BUILDMAN="mpc85xx&freescale -x t208xrdb -x t4qds -x t102* -x p1_p2_rdb_pc -x p1010rdb -x corenet_ds -x b4860qds -x bsc91*"
248          TOOLCHAIN="powerpc"
249    - name: "buildman t208xrdb corenet_ds"
250      env:
251        - BUILDMAN="t208xrdb corenet_ds"
252          TOOLCHAIN="powerpc"
253    - name: "buildman Freescale PowerPC"
254      env:
255        - BUILDMAN="t4qds b4860qds mpc83xx&freescale mpc86xx&freescale"
256          TOOLCHAIN="powerpc"
257    - name: "buildman t102*"
258      env:
259        - BUILDMAN="t102*"
260          TOOLCHAIN="powerpc"
261    - name: "buildman p1_p2_rdb_pc"
262      env:
263        - BUILDMAN="p1_p2_rdb_pc"
264          TOOLCHAIN="powerpc"
265    - name: "buildman p1010rdb bsc91"
266      env:
267        - BUILDMAN="p1010rdb bsc91"
268          TOOLCHAIN="powerpc"
269    - name: "buildman siemens"
270      env:
271        - BUILDMAN="siemens"
272    - name: "buildman tegra"
273      env:
274        - BUILDMAN="tegra -x toradex"
275    - name: "buildman am33xx (no siemens)"
276      env:
277        - BUILDMAN="am33xx -x siemens"
278    - name: "buildman omap"
279      env:
280        - BUILDMAN="omap"
281    - name: "buildman uniphier"
282      env:
283        - BUILDMAN="uniphier"
284    - name: "buildman catch-all AArch64"
285      env:
286        - BUILDMAN="aarch64 -x tegra,freescale,mvebu,uniphier,sunxi,samsung,rockchip,xilinx"
287    - name: "buildman rockchip"
288      env:
289        - BUILDMAN="rockchip"
290    - name: "buildman sh"
291      env:
292        - BUILDMAN="sh -x arm"
293          TOOLCHAIN="sh"
294    - name: "buildman Xilinx (ARM)"
295      env:
296        - BUILDMAN="xilinx -x microblaze"
297    - name: "buildman xtensa"
298      env:
299        - BUILDMAN="xtensa"
300          TOOLCHAIN="xtensa-dc233c-elf"
301    - name: "buildman riscv"
302      env:
303        - BUILDMAN="riscv"
304          TOOLCHAIN="riscv"
305
306    # QA jobs for code analytics
307    # static code analysis with cppcheck (we can add --enable=all later)
308    - name: "cppcheck"
309      script:
310        - cppcheck --force --quiet --inline-suppr .
311    # search for TODO within source tree
312    - name: "grep TODO"
313      script:
314        - grep -r TODO .
315    # search for FIXME within source tree
316    - name: "grep FIXME HACK"
317      script:
318        - grep -r FIXME .
319    # search for HACK within source tree and ignore HACKKIT board
320      script:
321        - grep -r HACK . | grep -v HACKKIT
322    # some statistics about the code base
323    - name: "sloccount"
324      script:
325        - sloccount .
326
327    # test/py
328    - name: "test/py sandbox"
329      env:
330        - TEST_PY_BD="sandbox"
331          BUILDMAN="^sandbox$"
332          TOOLCHAIN="i386"
333    - name: "test/py sandbox with clang"
334      env:
335        - TEST_PY_BD="sandbox"
336          BUILDMAN="^sandbox$"
337          TOOLCHAIN="clang"
338    - name: "test/py sandbox_spl"
339      env:
340        - TEST_PY_BD="sandbox_spl"
341          TEST_PY_TEST_SPEC="test_ofplatdata"
342          BUILDMAN="^sandbox$"
343          TOOLCHAIN="i386"
344          TEST_PY_TOOLS="yes"
345    - name: "test/py sandbox_flattree"
346      env:
347        - TEST_PY_BD="sandbox_flattree"
348          BUILDMAN="^sandbox_flattree$"
349          TOOLCHAIN="i386"
350    - name: "test/py vexpress_ca15_tc2"
351      env:
352        - TEST_PY_BD="vexpress_ca15_tc2"
353          TEST_PY_ID="--id qemu"
354          QEMU_TARGET="arm-softmmu"
355          BUILDMAN="^vexpress_ca15_tc2$"
356    - name: "test/py vexpress_ca9x4"
357      env:
358        - TEST_PY_BD="vexpress_ca9x4"
359          TEST_PY_ID="--id qemu"
360          QEMU_TARGET="arm-softmmu"
361          BUILDMAN="^vexpress_ca9x4$"
362    - name: "test/py integratorcp_cm926ejs"
363      env:
364        - TEST_PY_BD="integratorcp_cm926ejs"
365          TEST_PY_TEST_SPEC="not sleep"
366          TEST_PY_ID="--id qemu"
367          QEMU_TARGET="arm-softmmu"
368          BUILDMAN="^integratorcp_cm926ejs$"
369    - name: "test/py qemu_arm"
370      env:
371        - TEST_PY_BD="qemu_arm"
372          TEST_PY_TEST_SPEC="not sleep"
373          QEMU_TARGET="arm-softmmu"
374          BUILDMAN="^qemu_arm$"
375    - name: "test/py qemu_arm64"
376      env:
377        - TEST_PY_BD="qemu_arm64"
378          TEST_PY_TEST_SPEC="not sleep"
379          QEMU_TARGET="aarch64-softmmu"
380          BUILDMAN="^qemu_arm64$"
381    - name: "test/py qemu_mips"
382      env:
383        - TEST_PY_BD="qemu_mips"
384          TEST_PY_TEST_SPEC="not sleep"
385          QEMU_TARGET="mips-softmmu"
386          BUILDMAN="^qemu_mips$"
387          TOOLCHAIN="mips"
388    - name: "test/py qemu_mipsel"
389      env:
390        - TEST_PY_BD="qemu_mipsel"
391          TEST_PY_TEST_SPEC="not sleep"
392          QEMU_TARGET="mipsel-softmmu"
393          BUILDMAN="^qemu_mipsel$"
394          TOOLCHAIN="mips"
395    - name: "test/py qemu_mips64"
396      env:
397        - TEST_PY_BD="qemu_mips64"
398          TEST_PY_TEST_SPEC="not sleep"
399          QEMU_TARGET="mips64-softmmu"
400          BUILDMAN="^qemu_mips64$"
401          TOOLCHAIN="mips"
402    - name: "test/py qemu_mips64el"
403      env:
404        - TEST_PY_BD="qemu_mips64el"
405          TEST_PY_TEST_SPEC="not sleep"
406          QEMU_TARGET="mips64el-softmmu"
407          BUILDMAN="^qemu_mips64el$"
408          TOOLCHAIN="mips"
409    - name: "test/py qemu-ppce500"
410      env:
411        - TEST_PY_BD="qemu-ppce500"
412          TEST_PY_TEST_SPEC="not sleep"
413          QEMU_TARGET="ppc-softmmu"
414          BUILDMAN="^qemu-ppce500$"
415          TOOLCHAIN="powerpc"
416    - name: "test/py qemu-x86"
417      env:
418        - TEST_PY_BD="qemu-x86"
419          TEST_PY_TEST_SPEC="not sleep"
420          QEMU_TARGET="i386-softmmu"
421          BUILDMAN="^qemu-x86$"
422          TOOLCHAIN="i386"
423          BUILD_ROM="yes"
424    - name: "test/py zynq_zc702"
425      env:
426        - TEST_PY_BD="zynq_zc702"
427          TEST_PY_TEST_SPEC="not sleep"
428          QEMU_TARGET="arm-softmmu"
429          TEST_PY_ID="--id qemu"
430          BUILDMAN="^zynq_zc702$"
431    - name: "test/py xtfpga"
432      env:
433        - TEST_PY_BD="xtfpga"
434          TEST_PY_TEST_SPEC="not sleep"
435          QEMU_TARGET="xtensa-softmmu"
436          TEST_PY_ID="--id qemu"
437          BUILDMAN="^xtfpga$"
438          TOOLCHAIN="xtensa-dc233c-elf"
439
440# TODO make it perfect ;-r
441