parent
ee04809540
commit
b3d497f6a5
3 changed files with 68 additions and 0 deletions
@ -0,0 +1,21 @@ |
||||
#!/bin/bash |
||||
# |
||||
# Builds protobuf C++ with aarch64 crosscompiler and runs a basic set of tests under an emulator. |
||||
# NOTE: This script is expected to run under the dockcross/linux-arm64 docker image. |
||||
|
||||
set -ex |
||||
|
||||
mkdir -p cmake/crossbuild_aarch64 |
||||
cd cmake/crossbuild_aarch64 |
||||
|
||||
# the build commands are expected to run under dockcross docker image |
||||
# where the CC, CXX and other toolchain variables already point to the crosscompiler |
||||
cmake .. |
||||
make -j8 |
||||
|
||||
# check that the resulting test binary is indeed an aarch64 ELF |
||||
(file ./tests | grep -q "ELF 64-bit LSB executable, ARM aarch64") || (echo "Test binary in not an aarch64 binary"; exit 1) |
||||
|
||||
# run the basic set of C++ tests under QEMU |
||||
# there are other tests we could run (e.g. ./lite-test), but this is sufficient as a smoketest |
||||
qemu-aarch64 ./tests |
@ -0,0 +1,33 @@ |
||||
#!/bin/bash |
||||
|
||||
set -e |
||||
|
||||
# go to the repo root |
||||
cd $(dirname $0)/../../../.. |
||||
|
||||
if [[ -t 0 ]]; then |
||||
DOCKER_TTY_ARGS="-it" |
||||
else |
||||
# The input device on kokoro is not a TTY, so -it does not work. |
||||
DOCKER_TTY_ARGS= |
||||
fi |
||||
|
||||
# running dockcross image without any arguments generates a wrapper |
||||
# scripts that can be used to run commands under the dockcross image |
||||
# easily. |
||||
# See https://github.com/dockcross/dockcross#usage for details |
||||
docker run $DOCKER_TTY_ARGS --rm dockcross/linux-arm64 >dockcross-linux-arm64.sh |
||||
chmod +x dockcross-linux-arm64.sh |
||||
|
||||
# the wrapper script has CRLF line endings and bash doesn't like that |
||||
# so we change CRLF line endings into LF. |
||||
sed -i 's/\r//g' dockcross-linux-arm64.sh |
||||
|
||||
# The dockcross wrapper script runs arbitrary commands under the selected dockcross |
||||
# image with the following properties which make its use very convenient: |
||||
# * the current working directory is mounted under /work so the container can easily |
||||
# access the current workspace |
||||
# * the processes in the container run under the same UID and GID as the host process so unlike |
||||
# vanilla "docker run" invocations, the workspace doesn't get polluted with files |
||||
# owned by root. |
||||
./dockcross-linux-arm64.sh "$@" |
@ -0,0 +1,14 @@ |
||||
#!/bin/bash |
||||
# |
||||
# Crosscompiles protobuf C++ under dockcross docker image and runs the tests under an emulator. |
||||
|
||||
set -e |
||||
|
||||
# go to the repo root |
||||
cd $(dirname $0)/../../.. |
||||
|
||||
# Initialize any submodules. |
||||
git submodule update --init --recursive |
||||
|
||||
# run the C++ build and test script under dockcross/linux-arm64 image |
||||
kokoro/linux/aarch64/dockcross_helpers/run_dockcross_linux_aarch64.sh kokoro/linux/aarch64/cpp_crosscompile_and_run_tests_with_qemu_aarch64.sh |
Loading…
Reference in new issue