xref: /openbmc/u-boot/.travis.yml (revision e3963c09)
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_2018.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==2.8.7
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-2018.09-release/arc_gnu_2018.09_prebuilt_uclibc_le_archs_linux_install.tar.gz &&
79       tar -C /tmp -xf arc_gnu_2018.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    # ensure all configs have MAINTAINERS entries
336    - name: "Check for configs without MAINTAINERS entry"
337      script:
338        - if [ `./tools/genboardscfg.py -f 2>&1 | wc -l` -ne 0 ]; then exit 1; fi
339
340    # test/py
341    - name: "test/py sandbox"
342      env:
343        - TEST_PY_BD="sandbox"
344          BUILDMAN="^sandbox$"
345          TOOLCHAIN="i386"
346    - name: "test/py sandbox with clang"
347      env:
348        - TEST_PY_BD="sandbox"
349          BUILDMAN="^sandbox$"
350          TOOLCHAIN="clang"
351    - name: "test/py sandbox_spl"
352      env:
353        - TEST_PY_BD="sandbox_spl"
354          TEST_PY_TEST_SPEC="test_ofplatdata"
355          BUILDMAN="^sandbox$"
356          TOOLCHAIN="i386"
357          TEST_PY_TOOLS="yes"
358    - name: "test/py sandbox_flattree"
359      env:
360        - TEST_PY_BD="sandbox_flattree"
361          BUILDMAN="^sandbox_flattree$"
362          TOOLCHAIN="i386"
363    - name: "test/py vexpress_ca15_tc2"
364      env:
365        - TEST_PY_BD="vexpress_ca15_tc2"
366          TEST_PY_ID="--id qemu"
367          QEMU_TARGET="arm-softmmu"
368          BUILDMAN="^vexpress_ca15_tc2$"
369    - name: "test/py vexpress_ca9x4"
370      env:
371        - TEST_PY_BD="vexpress_ca9x4"
372          TEST_PY_ID="--id qemu"
373          QEMU_TARGET="arm-softmmu"
374          BUILDMAN="^vexpress_ca9x4$"
375    - name: "test/py integratorcp_cm926ejs"
376      env:
377        - TEST_PY_BD="integratorcp_cm926ejs"
378          TEST_PY_TEST_SPEC="not sleep"
379          TEST_PY_ID="--id qemu"
380          QEMU_TARGET="arm-softmmu"
381          BUILDMAN="^integratorcp_cm926ejs$"
382    - name: "test/py qemu_arm"
383      env:
384        - TEST_PY_BD="qemu_arm"
385          TEST_PY_TEST_SPEC="not sleep"
386          QEMU_TARGET="arm-softmmu"
387          BUILDMAN="^qemu_arm$"
388    - name: "test/py qemu_arm64"
389      env:
390        - TEST_PY_BD="qemu_arm64"
391          TEST_PY_TEST_SPEC="not sleep"
392          QEMU_TARGET="aarch64-softmmu"
393          BUILDMAN="^qemu_arm64$"
394    - name: "test/py qemu_mips"
395      env:
396        - TEST_PY_BD="qemu_mips"
397          TEST_PY_TEST_SPEC="not sleep"
398          QEMU_TARGET="mips-softmmu"
399          BUILDMAN="^qemu_mips$"
400          TOOLCHAIN="mips"
401    - name: "test/py qemu_mipsel"
402      env:
403        - TEST_PY_BD="qemu_mipsel"
404          TEST_PY_TEST_SPEC="not sleep"
405          QEMU_TARGET="mipsel-softmmu"
406          BUILDMAN="^qemu_mipsel$"
407          TOOLCHAIN="mips"
408    - name: "test/py qemu_mips64"
409      env:
410        - TEST_PY_BD="qemu_mips64"
411          TEST_PY_TEST_SPEC="not sleep"
412          QEMU_TARGET="mips64-softmmu"
413          BUILDMAN="^qemu_mips64$"
414          TOOLCHAIN="mips"
415    - name: "test/py qemu_mips64el"
416      env:
417        - TEST_PY_BD="qemu_mips64el"
418          TEST_PY_TEST_SPEC="not sleep"
419          QEMU_TARGET="mips64el-softmmu"
420          BUILDMAN="^qemu_mips64el$"
421          TOOLCHAIN="mips"
422    - name: "test/py qemu-ppce500"
423      env:
424        - TEST_PY_BD="qemu-ppce500"
425          TEST_PY_TEST_SPEC="not sleep"
426          QEMU_TARGET="ppc-softmmu"
427          BUILDMAN="^qemu-ppce500$"
428          TOOLCHAIN="powerpc"
429    - name: "test/py qemu-x86"
430      env:
431        - TEST_PY_BD="qemu-x86"
432          TEST_PY_TEST_SPEC="not sleep"
433          QEMU_TARGET="i386-softmmu"
434          BUILDMAN="^qemu-x86$"
435          TOOLCHAIN="i386"
436          BUILD_ROM="yes"
437    - name: "test/py qemu-x86_64"
438      env:
439        - TEST_PY_BD="qemu-x86_64"
440          TEST_PY_TEST_SPEC="not sleep"
441          QEMU_TARGET="x86_64-softmmu"
442          BUILDMAN="^qemu-x86_64$"
443          TOOLCHAIN="i386"
444          BUILD_ROM="yes"
445    - name: "test/py zynq_zc702"
446      env:
447        - TEST_PY_BD="zynq_zc702"
448          TEST_PY_TEST_SPEC="not sleep"
449          QEMU_TARGET="arm-softmmu"
450          TEST_PY_ID="--id qemu"
451          BUILDMAN="^zynq_zc702$"
452    - name: "test/py xtfpga"
453      env:
454        - TEST_PY_BD="xtfpga"
455          TEST_PY_TEST_SPEC="not sleep"
456          QEMU_TARGET="xtensa-softmmu"
457          TEST_PY_ID="--id qemu"
458          BUILDMAN="^xtfpga$"
459          TOOLCHAIN="xtensa-dc233c-elf"
460
461# TODO make it perfect ;-r
462