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