From 93e705ffc3d81951829fcf9823c40d4d98af2443 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Svensson?= Date: Thu, 10 Oct 2024 09:53:18 +0200 Subject: [PATCH] CI: add cross compilation test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Björn Svensson --- .github/workflows/test.yml | 41 ++++++++++++++++++++++++++++++++++++++ include/valkey/cluster.h | 6 ++++++ src/cluster.c | 4 ++++ 3 files changed, 51 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a975f62..80bc4ec 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -69,3 +69,44 @@ jobs: REDIS_DOCKER: redis:alpine TEST_PREFIX: ${{matrix.emulator}} -L /usr/${{matrix.toolset}}/ run: make check + + build-cross: + name: Cross-compile ${{ matrix.config.target }} + runs-on: ubuntu-22.04 + strategy: + fail-fast: false + matrix: + config: + # - {target: arm, host: arm-linux-gnueabi, qemu: arm, gccver: 12 } + # - {target: armhf, host: arm-linux-gnueabihf, qemu: arm, gccver: 12 } + - {target: aarch64, host: aarch64-linux-gnu, qemu: aarch64, gccver: 12 } + # - {target: riscv64, host: riscv64-linux-gnu, qemu: riscv64, gccver: 12 } + - {target: ppc, host: powerpc-linux-gnu, qemu: ppc, gccver: 12 } + # - {target: ppc64, host: powerpc64-linux-gnu, qemu: ppc64, gccver: 12 } + # - {target: ppc64le, host: powerpc64le-linux-gnu, qemu: ppc64le, gccver: 12 } + # - {target: s390x, host: s390x-linux-gnu, qemu: s390x, gccver: 12 } + - {target: mips, host: mips-linux-gnu, qemu: mips, gccver: 10 } + # - {target: mips64, host: mips64-linux-gnuabi64, qemu: mips64, gccver: 10 } + - {target: mipsel, host: mipsel-linux-gnu, qemu: mipsel, gccver: 10 } + # - {target: mips64el, host: mips64el-linux-gnuabi64, qemu: mips64el, gccver: 10 } + + steps: + - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 + # # CHECK IF QEMU is to old !!!!!!!!!!!!!!!!!!! + # - name: Install QEMU + # run: | + # sudo apt update && sudo apt install -y qemu-user + - name: Install platform toolset + run: | + sudo apt install -y g++-${{ matrix.config.gccver }}-${{ matrix.config.host }} + - name: ENV + env: + CC: ${{ matrix.config.host }}-gcc-${{ matrix.config.gccver }} + run: | + echo | $CC -v -E - + echo | $CC -dM -E - + - name: Run make + env: + CC: ${{ matrix.config.host }}-gcc-${{ matrix.config.gccver }} + run: | + make diff --git a/include/valkey/cluster.h b/include/valkey/cluster.h index 7a9bd84..9f639ce 100644 --- a/include/valkey/cluster.h +++ b/include/valkey/cluster.h @@ -148,6 +148,12 @@ typedef struct valkeyClusterAsyncContext { } valkeyClusterAsyncContext; + +// TODO: +// ppc: 40 +// mips: 40 +// mipsel: 40 + #if UINTPTR_MAX == UINT64_MAX #define VALKEY_NODE_ITERATOR_SIZE 56 #elif defined(__arm__) diff --git a/src/cluster.c b/src/cluster.c index 3facef1..f132540 100644 --- a/src/cluster.c +++ b/src/cluster.c @@ -3547,6 +3547,10 @@ struct nodeIterator { int retries_left; dictIterator di; }; + +char checker(int); +char checkSizeOfInt[sizeof(struct nodeIterator)]={checker(&checkSizeOfInt)}; + /* Make sure VALKEY_NODE_ITERATOR_SIZE is correct. */ vk_static_assert(sizeof(struct nodeIterator) == VALKEY_NODE_ITERATOR_SIZE);