[v3,11/23] travis: Split the building into two parts

Message ID 20200318154302.16389-9-sjg@chromium.org
State New
Headers show
Series
  • gitlab: Simplify the test script
Related show

Commit Message

Simon Glass March 18, 2020, 3:42 p.m.
Buildman is used in two ways:

- to build a selection of boards (with no testing)
- to build a single board (and run pytest)

The gitlab and azure scrips do this in separate places, but travis does
not. To aid the refactoring process and keep the following patches in sync
across all three environments, split the code out in travis as well.

Use the buildman -w option for the single board. It is easier to
understand since it specifies the output directory directly. Also it
avoids needing to look at the internal .bm-work directory.

This initially creates some duplicate code, but by the end of the series
we have two completely different build paths with different arguments.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

Changes in v3: None
Changes in v2:
- Add a new patch to split travis building into two parts

 .travis.yml | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

Comments

Tom Rini March 23, 2020, 1:13 p.m. | #1
On Wed, Mar 18, 2020 at 09:42:49AM -0600, Simon Glass wrote:

> Buildman is used in two ways:
> 
> - to build a selection of boards (with no testing)
> - to build a single board (and run pytest)
> 
> The gitlab and azure scrips do this in separate places, but travis does
> not. To aid the refactoring process and keep the following patches in sync
> across all three environments, split the code out in travis as well.
> 
> Use the buildman -w option for the single board. It is easier to
> understand since it specifies the output directory directly. Also it
> avoids needing to look at the internal .bm-work directory.
> 
> This initially creates some duplicate code, but by the end of the series
> we have two completely different build paths with different arguments.
> 
> Signed-off-by: Simon Glass <sjg at chromium.org>

Reviewed-by: Tom Rini <trini at konsulko.com>

Patch

diff --git a/.travis.yml b/.travis.yml
index f6e3a5d3af..f3703085ba 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -118,7 +118,8 @@  script:
  #
  # From buildman, exit code 129 means warnings only.  If we've been asked to
  # use clang only do one configuration.
- - if [[ "${BUILDMAN}" != "" ]]; then
+ # Build a selection of boards if TEST_PY_BD is empty
+ - if [[ "${BUILDMAN}" != "" ]] && [[ "${TEST_PY_BD}" == "" ]]; then
      ret=0;
      tools/buildman/buildman -P -E ${BUILDMAN} ${OVERRIDE}|| ret=$?;
      if [[ $ret -ne 0 && $ret -ne 129 ]]; then
@@ -130,12 +131,20 @@  script:
  # never prevent any test from running. That way, we can always pass
  # "-k something" even when $TEST_PY_TEST_SPEC doesnt need a custom
  # value.
+ # Build just the one board needed for testing, if TEST_PY_BD is non-empty
  - if [[ "${TEST_PY_BD}" != "" ]]; then
-     export UBOOT_TRAVIS_BUILD_DIR=`cd .. && pwd`/.bm-work/${TEST_PY_BD};
+     export UBOOT_TRAVIS_BUILD_DIR=`cd .. && pwd`/${TEST_PY_BD};
      cp ~/grub_x86.efi $UBOOT_TRAVIS_BUILD_DIR/;
      cp ~/grub_x64.efi $UBOOT_TRAVIS_BUILD_DIR/;
      cp ~/grub2-arm/usr/lib/grub2/arm-efi/grub.efi $UBOOT_TRAVIS_BUILD_DIR/grub_arm.efi;
      cp ~/grub2-arm64/usr/lib/grub2/arm64-efi/grub.efi $UBOOT_TRAVIS_BUILD_DIR/grub_arm64.efi;
+     ret=0;
+     tools/buildman/buildman -o ${UBOOT_TRAVIS_BUILD_DIR} -w -E ${BUILDMAN}
+       ${OVERRIDE}|| ret=$?;
+     if [[ $ret -ne 0 && $ret -ne 129 ]]; then
+       tools/buildman/buildman -sde -o ${UBOOT_TRAVIS_BUILD_DIR} -w ${BUILDMAN};
+       exit $ret;
+     fi;
      virtualenv -p /usr/bin/python3 /tmp/venv;
      . /tmp/venv/bin/activate;
      pip install -r test/py/requirements.txt;