Skip to content

Commit

Permalink
Modify the nodeIterator layout and update CI (#114)
Browse files Browse the repository at this point in the history
Modify the `nodeIterator` layout to get a common size in 32bit
architectures, which fixes the alignment for 32bit (arm, ppc and mips).

- Add additional targets for cross-compilations to make sure future
  changes in opaque structures works.
- Move 32bit CI job and remove redundant job.

Signed-off-by: Björn Svensson <bjorn.a.svensson@est.tech>
  • Loading branch information
bjosv authored Oct 11, 2024
1 parent 21b0827 commit daf8537
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 75 deletions.
36 changes: 35 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: Build and test
name: Other targets

on: [push, pull_request]

jobs:
Expand Down Expand Up @@ -77,3 +78,36 @@ jobs:
run: |
gmake
mkdir build && cd build && cmake .. && gmake
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
- name: Prepare
uses: awalsh128/cache-apt-pkgs-action@a6c3917cc929dd0345bfb2d3feaf9101823370ad # v1.4.2
with:
packages: gcc-${{ matrix.config.gccver }}-${{ matrix.config.host }}
version: ${{ matrix.config.target }}-1.0
- name: Build
env:
CC: ${{ matrix.config.host }}-gcc-${{ matrix.config.gccver }}
AR: ${{ matrix.config.host }}-ar
run: |
make
22 changes: 22 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,28 @@ jobs:
TEST_PREFIX: valgrind --error-exitcode=99 --track-origins=yes --leak-check=full
run: ./test.sh

ubuntu-32bit:
name: Build for 32-bit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- name: Prepare
uses: awalsh128/cache-apt-pkgs-action@a6c3917cc929dd0345bfb2d3feaf9101823370ad # v1.4.2
with:
packages: gcc-multilib
version: 1.0
- name: Install Valkey
run: |
git clone --depth 1 --branch 7.2.5 https://github.com/valkey-io/valkey.git
cd valkey && sudo BUILD_TLS=yes make install
- name: Build
run: |
make 32bit
- name: Run tests
working-directory: tests
run: |
./test.sh
install:
name: Installation tests
runs-on: ubuntu-latest
Expand Down
71 changes: 0 additions & 71 deletions .github/workflows/test.yml

This file was deleted.

2 changes: 0 additions & 2 deletions include/valkey/cluster.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,6 @@ typedef struct valkeyClusterAsyncContext {

#if UINTPTR_MAX == UINT64_MAX
#define VALKEY_NODE_ITERATOR_SIZE 56
#elif defined(__arm__)
#define VALKEY_NODE_ITERATOR_SIZE 40
#else
#define VALKEY_NODE_ITERATOR_SIZE 32
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/cluster.c
Original file line number Diff line number Diff line change
Expand Up @@ -3542,8 +3542,8 @@ void valkeyClusterAsyncFree(valkeyClusterAsyncContext *acc) {
}

struct nodeIterator {
valkeyClusterContext *cc;
uint64_t route_version;
valkeyClusterContext *cc;
int retries_left;
dictIterator di;
};
Expand Down

0 comments on commit daf8537

Please sign in to comment.