fc4d5a1d5ccc30c78f53301ede12aa08ee73c94f
[platform/kernel/u-boot.git] / .travis.yml
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
6 sudo: required
7 dist: trusty
8
9 language: c
10
11 addons:
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
38 install:
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
59 env:
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
67 before_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
106 script:
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 [[ "${BUILDMAN}" != "" ]]; then
113      ret=0;
114      tools/buildman/buildman -P -E ${BUILDMAN} ${OVERRIDE}|| ret=$?;
115      if [[ $ret -ne 0 && $ret -ne 129 ]]; then
116        tools/buildman/buildman -sdeP ${BUILDMAN};
117        exit $ret;
118      fi;
119    fi
120  # "not a_test_which_does_not_exist" is a dummy -k parameter which will
121  # never prevent any test from running. That way, we can always pass
122  # "-k something" even when $TEST_PY_TEST_SPEC doesnt need a custom
123  # value.
124  - export UBOOT_TRAVIS_BUILD_DIR=`cd .. && pwd`/.bm-work/${TEST_PY_BD};
125    cp ~/grub_x86.efi $UBOOT_TRAVIS_BUILD_DIR/;
126    cp ~/grub_x64.efi $UBOOT_TRAVIS_BUILD_DIR/;
127    cp ~/grub2-arm/usr/lib/grub2/arm-efi/grub.efi $UBOOT_TRAVIS_BUILD_DIR/grub_arm.efi;
128    cp ~/grub2-arm64/usr/lib/grub2/arm64-efi/grub.efi $UBOOT_TRAVIS_BUILD_DIR/grub_arm64.efi;
129    if [[ "${TEST_PY_BD}" != "" ]]; then
130      ./test/py/test.py --bd ${TEST_PY_BD} ${TEST_PY_ID}
131        -k "${TEST_PY_TEST_SPEC:-not a_test_which_does_not_exist}"
132        --build-dir "$UBOOT_TRAVIS_BUILD_DIR";
133      ret=$?;
134      if [[ $ret -ne 0 ]]; then
135        exit $ret;
136      fi;
137    fi;
138    if [[ -n "${TEST_PY_TOOLS}" ]]; then
139      PYTHONPATH="${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc/pylibfdt"
140      PATH="${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc:${PATH}"
141      ./tools/binman/binman -t &&
142      ./tools/patman/patman --test &&
143      ./tools/buildman/buildman -t &&
144      PYTHONPATH="${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc/pylibfdt"
145      PATH="${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc:${PATH}"
146      ./tools/dtoc/dtoc -t;
147    fi
148
149 matrix:
150   include:
151   # we need to build by vendor due to 50min time limit for builds
152   # each env setting here is a dedicated build
153     - name: "buildman arc"
154       env:
155         - BUILDMAN="arc"
156           TOOLCHAIN="arc"
157     - name: "buildman arm11 arm7 arm920t arm946es"
158       env:
159         - BUILDMAN="arm11 arm7 arm920t arm946es"
160     - name: "buildman arm926ejs (non-freescale,siemens,atmel,kirkwood,spear)"
161       env:
162         - JOB="arm926ejs"
163           BUILDMAN="arm926ejs -x freescale,siemens,atmel,kirkwood,spear"
164     - name: "buildman atmel"
165       env:
166         - BUILDMAN="atmel"
167     - name: "buildman boundary engicam toradex"
168       env:
169         - BUILDMAN="boundary engicam toradex"
170     - name: "buildman Freescale ARM32"
171       env:
172         - BUILDMAN="freescale -x powerpc,m68k,aarch64"
173     - name: "buildman Freescale AArch64 LS10xx"
174       env:
175         - BUILDMAN="freescale&aarch64&&ls1"
176     - name: "buildman Freescale AArch64 LS20xx"
177       env:
178         - BUILDMAN="freescale&aarch64&&ls2"
179     - name: "buildman i.MX6 (non-Freescale)"
180       env:
181         - BUILDMAN="mx6 -x freescale,toradex,boundary,engicam"
182     - name: "buildman i.MX (non-Freescale,i.MX6,toradex)"
183       env:
184         - BUILDMAN="mx -x freescale,mx6,toradex"
185     - name: "buildman k2"
186       env:
187         - BUILDMAN="k2"
188     - name: "buildman samsung socfpga"
189       env:
190         - BUILDMAN="samsung socfpga"
191     - name: "buildman spear"
192       env:
193         - BUILDMAN="spear"
194     - name: "buildman sun4i"
195       env:
196         - BUILDMAN="sun4i"
197     - name: "buildman sun5i"
198       env:
199         - BUILDMAN="sun5i"
200     - name: "buildman sun6i"
201       env:
202         - BUILDMAN="sun6i"
203     - name: "buildman sun7i"
204       env:
205         - BUILDMAN="sun7i"
206     - name: "buildman sun8i"
207       env:
208         - BUILDMAN="sun8i"
209     - name: "buildman sun9i"
210       env:
211         - BUILDMAN="sun9i"
212     - name: "buildman sun50i"
213       env:
214         - BUILDMAN="sun50i"
215     - name: "buildman catch-all ARM"
216       env:
217         - 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"
218     - name: "buildman sandbox x86"
219       env:
220         - BUILDMAN="sandbox x86"
221           TOOLCHAIN="i386"
222     - name: "buildman kirkwood (excluding openrd)"
223       env:
224         - BUILDMAN="kirkwood -x openrd"
225     - name: "buildman mvebu"
226       env:
227         - BUILDMAN="mvebu"
228     - name: "buildman PXA (non-toradex)"
229       env:
230         - BUILDMAN="pxa -x toradex"
231     - name: "buildman m68k"
232       env:
233         - BUILDMAN="m68k"
234           TOOLCHAIN="m68k"
235     - name: "buildman microblaze"
236       env:
237         - BUILDMAN="microblaze"
238           TOOLCHAIN="microblaze"
239     - name: "buildman mips"
240       env:
241         - BUILDMAN="mips"
242           TOOLCHAIN="mips"
243     - name: "buildman non-Freescale PowerPC"
244       env:
245         - BUILDMAN="powerpc -x freescale"
246           TOOLCHAIN="powerpc"
247     - name: "buildman mpc85xx&freescale (excluding many)"
248       env:
249         - BUILDMAN="mpc85xx&freescale -x t208xrdb -x t4qds -x t102* -x p1_p2_rdb_pc -x p1010rdb -x corenet_ds -x b4860qds -x bsc91*"
250           TOOLCHAIN="powerpc"
251     - name: "buildman t208xrdb corenet_ds"
252       env:
253         - BUILDMAN="t208xrdb corenet_ds"
254           TOOLCHAIN="powerpc"
255     - name: "buildman Freescale PowerPC"
256       env:
257         - BUILDMAN="t4qds b4860qds mpc83xx&freescale mpc86xx&freescale"
258           TOOLCHAIN="powerpc"
259     - name: "buildman t102*"
260       env:
261         - BUILDMAN="t102*"
262           TOOLCHAIN="powerpc"
263     - name: "buildman p1_p2_rdb_pc"
264       env:
265         - BUILDMAN="p1_p2_rdb_pc"
266           TOOLCHAIN="powerpc"
267     - name: "buildman p1010rdb bsc91"
268       env:
269         - BUILDMAN="p1010rdb bsc91"
270           TOOLCHAIN="powerpc"
271     - name: "buildman siemens"
272       env:
273         - BUILDMAN="siemens"
274     - name: "buildman tegra"
275       env:
276         - BUILDMAN="tegra -x toradex"
277     - name: "buildman am33xx (no siemens)"
278       env:
279         - BUILDMAN="am33xx -x siemens"
280     - name: "buildman omap"
281       env:
282         - BUILDMAN="omap"
283     - name: "buildman uniphier"
284       env:
285         - BUILDMAN="uniphier"
286     - name: "buildman catch-all AArch64"
287       env:
288         - BUILDMAN="aarch64 -x tegra,ls1,ls2,mvebu,uniphier,sunxi,samsung,rockchip,xilinx"
289     - name: "buildman rockchip"
290       env:
291         - BUILDMAN="rockchip"
292     - name: "buildman sh"
293       env:
294         - BUILDMAN="sh -x arm"
295           TOOLCHAIN="sh"
296     - name: "buildman Xilinx (ARM)"
297       env:
298         - BUILDMAN="xilinx -x microblaze"
299     - name: "buildman xtensa"
300       env:
301         - BUILDMAN="xtensa"
302           TOOLCHAIN="xtensa-dc233c-elf"
303     - name: "buildman riscv"
304       env:
305         - BUILDMAN="riscv"
306           TOOLCHAIN="riscv"
307
308     # QA jobs for code analytics
309     # static code analysis with cppcheck (we can add --enable=all later)
310     - name: "cppcheck"
311       script:
312         - cppcheck --force --quiet --inline-suppr .
313     # search for TODO within source tree
314     - name: "grep TODO"
315       script:
316         - grep -r TODO .
317     # search for FIXME within source tree
318     - name: "grep FIXME HACK"
319       script:
320         - grep -r FIXME .
321     # search for HACK within source tree and ignore HACKKIT board
322       script:
323         - grep -r HACK . | grep -v HACKKIT
324     # some statistics about the code base
325     - name: "sloccount"
326       script:
327         - sloccount .
328     # ensure all configs have MAINTAINERS entries
329     - name: "Check for configs without MAINTAINERS entry"
330       script:
331         - if [ `./tools/genboardscfg.py -f 2>&1 | wc -l` -ne 0 ]; then exit 1; fi
332     # Ensure host tools build
333     - name: "Build tools-only"
334       script:
335         - make tools-only_config tools-only -j$(nproc)
336
337     # test/py
338     - name: "test/py sandbox"
339       env:
340         - TEST_PY_BD="sandbox"
341           BUILDMAN="^sandbox$"
342           TOOLCHAIN="i386"
343     - name: "test/py sandbox with clang"
344       env:
345         - TEST_PY_BD="sandbox"
346           BUILDMAN="^sandbox$"
347           OVERRIDE="clang-7"
348     - name: "test/py sandbox_spl"
349       env:
350         - TEST_PY_BD="sandbox_spl"
351           TEST_PY_TEST_SPEC="test_ofplatdata"
352           BUILDMAN="^sandbox$"
353           TOOLCHAIN="i386"
354           TEST_PY_TOOLS="yes"
355     - name: "test/py sandbox_flattree"
356       env:
357         - TEST_PY_BD="sandbox_flattree"
358           BUILDMAN="^sandbox_flattree$"
359           TOOLCHAIN="i386"
360     - name: "test/py vexpress_ca15_tc2"
361       env:
362         - TEST_PY_BD="vexpress_ca15_tc2"
363           TEST_PY_ID="--id qemu"
364           QEMU_TARGET="arm-softmmu"
365           BUILDMAN="^vexpress_ca15_tc2$"
366     - name: "test/py vexpress_ca9x4"
367       env:
368         - TEST_PY_BD="vexpress_ca9x4"
369           TEST_PY_ID="--id qemu"
370           QEMU_TARGET="arm-softmmu"
371           BUILDMAN="^vexpress_ca9x4$"
372     - name: "test/py integratorcp_cm926ejs"
373       env:
374         - TEST_PY_BD="integratorcp_cm926ejs"
375           TEST_PY_TEST_SPEC="not sleep"
376           TEST_PY_ID="--id qemu"
377           QEMU_TARGET="arm-softmmu"
378           BUILDMAN="^integratorcp_cm926ejs$"
379     - name: "test/py qemu_arm"
380       env:
381         - TEST_PY_BD="qemu_arm"
382           TEST_PY_TEST_SPEC="not sleep"
383           QEMU_TARGET="arm-softmmu"
384           BUILDMAN="^qemu_arm$"
385     - name: "test/py qemu_arm64"
386       env:
387         - TEST_PY_BD="qemu_arm64"
388           TEST_PY_TEST_SPEC="not sleep"
389           QEMU_TARGET="aarch64-softmmu"
390           BUILDMAN="^qemu_arm64$"
391     - name: "test/py qemu_mips"
392       env:
393         - TEST_PY_BD="qemu_mips"
394           TEST_PY_TEST_SPEC="not sleep"
395           QEMU_TARGET="mips-softmmu"
396           BUILDMAN="^qemu_mips$"
397           TOOLCHAIN="mips"
398     - name: "test/py qemu_mipsel"
399       env:
400         - TEST_PY_BD="qemu_mipsel"
401           TEST_PY_TEST_SPEC="not sleep"
402           QEMU_TARGET="mipsel-softmmu"
403           BUILDMAN="^qemu_mipsel$"
404           TOOLCHAIN="mips"
405     - name: "test/py qemu_mips64"
406       env:
407         - TEST_PY_BD="qemu_mips64"
408           TEST_PY_TEST_SPEC="not sleep"
409           QEMU_TARGET="mips64-softmmu"
410           BUILDMAN="^qemu_mips64$"
411           TOOLCHAIN="mips"
412     - name: "test/py qemu_mips64el"
413       env:
414         - TEST_PY_BD="qemu_mips64el"
415           TEST_PY_TEST_SPEC="not sleep"
416           QEMU_TARGET="mips64el-softmmu"
417           BUILDMAN="^qemu_mips64el$"
418           TOOLCHAIN="mips"
419     - name: "test/py qemu-ppce500"
420       env:
421         - TEST_PY_BD="qemu-ppce500"
422           TEST_PY_TEST_SPEC="not sleep"
423           QEMU_TARGET="ppc-softmmu"
424           BUILDMAN="^qemu-ppce500$"
425           TOOLCHAIN="powerpc"
426     - name: "test/py qemu-x86"
427       env:
428         - TEST_PY_BD="qemu-x86"
429           TEST_PY_TEST_SPEC="not sleep"
430           QEMU_TARGET="i386-softmmu"
431           BUILDMAN="^qemu-x86$"
432           TOOLCHAIN="i386"
433           BUILD_ROM="yes"
434     - name: "test/py qemu-x86_64"
435       env:
436         - TEST_PY_BD="qemu-x86_64"
437           TEST_PY_TEST_SPEC="not sleep"
438           QEMU_TARGET="x86_64-softmmu"
439           BUILDMAN="^qemu-x86_64$"
440           TOOLCHAIN="i386"
441           BUILD_ROM="yes"
442     - name: "test/py zynq_zc702"
443       env:
444         - TEST_PY_BD="zynq_zc702"
445           TEST_PY_TEST_SPEC="not sleep"
446           QEMU_TARGET="arm-softmmu"
447           TEST_PY_ID="--id qemu"
448           BUILDMAN="^zynq_zc702$"
449     - name: "test/py xtfpga"
450       env:
451         - TEST_PY_BD="xtfpga"
452           TEST_PY_TEST_SPEC="not sleep"
453           QEMU_TARGET="xtensa-softmmu"
454           TEST_PY_ID="--id qemu"
455           BUILDMAN="^xtfpga$"
456           TOOLCHAIN="xtensa-dc233c-elf"
457
458 # TODO make it perfect ;-r