From 2ae56db9d5c06c9eb0ded79e3de0a5a3745146ba Mon Sep 17 00:00:00 2001 From: "Earle F. Philhower, III" Date: Sun, 23 Aug 2020 16:09:52 -0700 Subject: [PATCH 1/4] Add CI test for eboot build Check that building the eboot.c block generates the same binary as the verison checked into the repo. Catches the case where a library or eboot.c file is changed, but an updated eboot.elf isn't included in a PR. Can't do simple binary diff of the ELFs because paths and compile times will change, so dump the two sections we care about. --- .github/workflows/pull-request.yml | 7 +++++++ tests/ci/eboot_test.sh | 21 +++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 tests/ci/eboot_test.sh diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 926cb65d89..72b03a091b 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -251,9 +251,16 @@ jobs: - uses: actions/setup-python@v2 with: python-version: '3.x' + - name: Cache Linux toolchain + id: cache-linux + uses: actions/cache@v2 + with: + path: ./tools/dist + key: key-linux-toolchain - name: Boards.txt diff env: TRAVIS_BUILD_DIR: ${{ github.workspace }} TRAVIS_TAG: ${{ github.ref }} run: | bash ./tests/ci/build_boards.sh + bash ./tests/ci/eboot_test.sh diff --git a/tests/ci/eboot_test.sh b/tests/ci/eboot_test.sh new file mode 100644 index 0000000000..f7f5ddd469 --- /dev/null +++ b/tests/ci/eboot_test.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +READELF="$TRAVIS_BUILD_DIR/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-readelf" + +set -ev + +cd $TRAVIS_BUILD_DIR/tools +python3 get.py -q + +cd $TRAVIS_BUILD_DIR/bootloaders/eboot + +"$READELF" -x .data -x .text eboot.elf > git.txt +make clean +make +"$READELF" -x .data -x .text eboot.elf > build.txt +diff git.txt build.txt +if [ $? -ne 0 ]; then + echo ERROR: eboot.elf in repo does not match output from compile. + echo ERROR: Need to rebuild and check in updated eboot from repo. + exit 1 +fi From 8780070ffba62d67efb3bdd47df5ddf7b02e628f Mon Sep 17 00:00:00 2001 From: "Earle F. Philhower, III" Date: Sun, 23 Aug 2020 16:22:43 -0700 Subject: [PATCH 2/4] Test changes to .c w/o .elf fail Test that CI fails when eboot.c is changed w/o an updated eboot.elf. --- bootloaders/eboot/eboot.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootloaders/eboot/eboot.c b/bootloaders/eboot/eboot.c index 6b3b316341..7ceb49516e 100644 --- a/bootloaders/eboot/eboot.c +++ b/bootloaders/eboot/eboot.c @@ -28,7 +28,7 @@ int print_version(const uint32_t flash_addr) return 1; } char fmt[7]; - fmt[0] = 'v'; + fmt[0] = 'V'; fmt[1] = '%'; fmt[2] = '0'; fmt[3] = '8'; From fd2f4ac5833575bbacd90c80dfc2c9876a653892 Mon Sep 17 00:00:00 2001 From: "Earle F. Philhower, III" Date: Sun, 23 Aug 2020 16:25:49 -0700 Subject: [PATCH 3/4] Undo eboot.c change, should pass CI --- bootloaders/eboot/eboot.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootloaders/eboot/eboot.c b/bootloaders/eboot/eboot.c index 7ceb49516e..6b3b316341 100644 --- a/bootloaders/eboot/eboot.c +++ b/bootloaders/eboot/eboot.c @@ -28,7 +28,7 @@ int print_version(const uint32_t flash_addr) return 1; } char fmt[7]; - fmt[0] = 'V'; + fmt[0] = 'v'; fmt[1] = '%'; fmt[2] = '0'; fmt[3] = '8'; From e3070c2f81f56d1647720d24a04efc14f47c2e57 Mon Sep 17 00:00:00 2001 From: "Earle F. Philhower, III" Date: Sun, 23 Aug 2020 16:28:01 -0700 Subject: [PATCH 4/4] Update eboot_test.sh Clean up error message --- tests/ci/eboot_test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/ci/eboot_test.sh b/tests/ci/eboot_test.sh index f7f5ddd469..0450b03353 100644 --- a/tests/ci/eboot_test.sh +++ b/tests/ci/eboot_test.sh @@ -16,6 +16,6 @@ make diff git.txt build.txt if [ $? -ne 0 ]; then echo ERROR: eboot.elf in repo does not match output from compile. - echo ERROR: Need to rebuild and check in updated eboot from repo. + echo ERROR: Need to rebuild and check in updated eboot. exit 1 fi