Skip to content

Commit

Permalink
Merge pull request #355 from hug-dev/cross-compil-tests
Browse files Browse the repository at this point in the history
Add some cross-compilation tests
  • Loading branch information
hug-dev authored Mar 10, 2021
2 parents 6c33db5 + 7f4bb18 commit 98103d9
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Cargo seems to expect the -gcc variant instead of -ld

[target.armv7-unknown-linux-gnueabihf]
linker = "arm-linux-gnueabihf-gcc"

[target.aarch64-unknown-linux-gnu]
linker = "aarch64-linux-gnu-gcc"
7 changes: 7 additions & 0 deletions ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,13 @@ fi
echo "Build test"
RUST_BACKTRACE=1 cargo build $FEATURES

echo "Cross-compilation test"
# Make sure the the provider install the correct targets via rustup in its Dockerfile.
if [ "$PROVIDER_NAME" = "pkcs11" ] || [ "$PROVIDER_NAME" = "mbed-crypto" ]; then
RUST_BACKTRACE=1 cargo build $FEATURES --target armv7-unknown-linux-gnueabihf
RUST_BACKTRACE=1 cargo build $FEATURES --target aarch64-unknown-linux-gnu
fi

echo "Static checks"
# On native target clippy or fmt might not be available.
if rustup component list | grep -q fmt; then
Expand Down
8 changes: 8 additions & 0 deletions e2e_tests/provider_cfg/mbed-crypto/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,16 @@ RUN apt-get update && \
# Needed for Open SSL
apt-get install -y pkg-config libssl-dev

RUN apt -y install gcc-multilib
RUN apt -y install gcc-arm-linux-gnueabihf
RUN apt -y install gcc-aarch64-linux-gnu

WORKDIR /tmp

# Install Rust toolchain
RUN curl https://sh.rustup.rs -sSf | bash -s -- -y
ENV PATH="/root/.cargo/bin:${PATH}"

# Adding the targets for the cross-compilation test
RUN rustup target add armv7-unknown-linux-gnueabihf
RUN rustup target add aarch64-unknown-linux-gnu
8 changes: 8 additions & 0 deletions e2e_tests/provider_cfg/pkcs11/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ RUN apt-get update && \
# Needed for Open SSL
apt-get install -y pkg-config libssl-dev

RUN apt -y install gcc-multilib
RUN apt -y install gcc-arm-linux-gnueabihf
RUN apt -y install gcc-aarch64-linux-gnu

WORKDIR /tmp
RUN git clone https://github.com/opendnssec/SoftHSMv2.git \
&& cd SoftHSMv2 \
Expand All @@ -28,6 +32,10 @@ RUN cd SoftHSMv2 \
RUN curl https://sh.rustup.rs -sSf | bash -s -- -y
ENV PATH="/root/.cargo/bin:${PATH}"

# Adding the targets for the cross-compilation test
RUN rustup target add armv7-unknown-linux-gnueabihf
RUN rustup target add aarch64-unknown-linux-gnu

# Create a new token in a new slot. The slot number assigned will be random
# and is found with the find_slot_number script.
RUN softhsm2-util --init-token --slot 0 --label "Parsec Tests" --pin 123456 --so-pin 123456

0 comments on commit 98103d9

Please sign in to comment.