Skip to content

Add some cross-compilation tests #355

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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