diff --git a/Dockerfile b/Dockerfile index 168d8999..7767ad1c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -50,12 +50,13 @@ RUN mkdir -p /usr/src/criu \ # setup a playground for us to spawn containers in ENV ROOTFS /busybox -RUN mkdir -p ${ROOTFS} \ - && curl -o- -sSL 'https://github.com/docker-library/busybox/raw/a0558a9006ce0dd6f6ec5d56cfd3f32ebeeb815f/glibc/busybox.tar.xz' | tar xfJC - ${ROOTFS} - +RUN mkdir -p ${ROOTFS} COPY script/tmpmount / WORKDIR /go/src/github.com/opencontainers/runc ENTRYPOINT ["/tmpmount"] ADD . /go/src/github.com/opencontainers/runc + +RUN . tests/integration/multi-arch.bash \ + && curl -o- -sSL `get_busybox` | tar xfJC - ${ROOTFS} diff --git a/tests/integration/helpers.bash b/tests/integration/helpers.bash index 66dd622a..99d48b7b 100644 --- a/tests/integration/helpers.bash +++ b/tests/integration/helpers.bash @@ -2,6 +2,9 @@ # Root directory of integration tests. INTEGRATION_ROOT=$(dirname "$(readlink -f "$BASH_SOURCE")") + +. ${INTEGRATION_ROOT}/multi-arch.bash + RUNC="${INTEGRATION_ROOT}/../../runc" RECVTTY="${INTEGRATION_ROOT}/../../contrib/cmd/recvtty/recvtty" GOPATH="$(mktemp -d --tmpdir runc-integration-gopath.XXXXXX)" @@ -14,7 +17,8 @@ BUSYBOX_IMAGE="$BATS_TMPDIR/busybox.tar" BUSYBOX_BUNDLE="$BATS_TMPDIR/busyboxtest" # hello-world in tar format -HELLO_IMAGE="$TESTDATA/hello-world.tar" +HELLO_FILE=`get_hello` +HELLO_IMAGE="$TESTDATA/$HELLO_FILE" HELLO_BUNDLE="$BATS_TMPDIR/hello-world" # CRIU PATH @@ -270,7 +274,7 @@ function setup_busybox() { BUSYBOX_IMAGE="/testdata/busybox.tar" fi if [ ! -e $BUSYBOX_IMAGE ]; then - curl -o $BUSYBOX_IMAGE -sSL 'https://github.com/docker-library/busybox/raw/a0558a9006ce0dd6f6ec5d56cfd3f32ebeeb815f/glibc/busybox.tar.xz' + curl -o $BUSYBOX_IMAGE -sSL `get_busybox` fi tar --exclude './dev/*' -C "$BUSYBOX_BUNDLE"/rootfs -xf "$BUSYBOX_IMAGE" cd "$BUSYBOX_BUNDLE" diff --git a/tests/integration/multi-arch.bash b/tests/integration/multi-arch.bash new file mode 100644 index 00000000..52c59bf7 --- /dev/null +++ b/tests/integration/multi-arch.bash @@ -0,0 +1,22 @@ +#!/bin/bash +get_busybox(){ + case $(go env GOARCH) in + arm64) + echo 'https://github.com/docker-library/busybox/raw/23fbd9c43e0f4bec7605091bfba23db278c367ac/glibc/busybox.tar.xz' + ;; + *) + echo 'https://github.com/docker-library/busybox/raw/a0558a9006ce0dd6f6ec5d56cfd3f32ebeeb815f/glibc/busybox.tar.xz' + ;; + esac +} + +get_hello(){ + case $(go env GOARCH) in + arm64) + echo 'hello-world-aarch64.tar' + ;; + *) + echo 'hello-world.tar' + ;; + esac +} diff --git a/tests/integration/testdata/hello-world-aarch64.tar b/tests/integration/testdata/hello-world-aarch64.tar new file mode 100644 index 00000000..186c8aef Binary files /dev/null and b/tests/integration/testdata/hello-world-aarch64.tar differ