test_javascript_aarch64.sh 1.7 KB

1234567891011121314151617181920212223242526272829
  1. #!/bin/bash
  2. set -ex
  3. # go to the repo root
  4. cd $(dirname $0)/../../..
  5. if [[ -t 0 ]]; then
  6. DOCKER_TTY_ARGS="-it"
  7. else
  8. # The input device on kokoro is not a TTY, so -it does not work.
  9. DOCKER_TTY_ARGS=
  10. fi
  11. # crosscompile protoc as we will later need it for the javascript build.
  12. # we build it under the dockcross/manylinux2014-aarch64 image so that the resulting protoc binary is compatible
  13. # with a wide range of linux distros (including any docker images we will use later to build and test javascript)
  14. kokoro/linux/aarch64/dockcross_helpers/run_dockcross_manylinux2014_aarch64.sh kokoro/linux/aarch64/protoc_crosscompile_aarch64.sh
  15. # use an actual aarch64 docker image (with a real aarch64 nodejs) to run build & test protobuf javascript under an emulator
  16. # * mount the protobuf root as /work to be able to access the crosscompiled files
  17. # * to avoid running the process inside docker as root (which can pollute the workspace with files owned by root), we force
  18. # running under current user's UID and GID. To be able to do that, we need to provide a home directory for the user
  19. # otherwise the UID would be homeless under the docker container and pip install wouldn't work. For simplicity,
  20. # we just run map the user's home to a throwaway temporary directory
  21. # Note that the docker image used for running the tests is arm64v8/openjdk, not arm64v8/node
  22. # This is because some of the node tests require java to be available and adding node
  23. # binary distribution into a java image is easier than vice versa.
  24. docker run $DOCKER_TTY_ARGS --rm --user "$(id -u):$(id -g)" -e "HOME=/home/fake-user" -v "$(mktemp -d):/home/fake-user" -v "$(pwd)":/work -w /work arm64v8/openjdk:11-jdk-buster kokoro/linux/aarch64/javascript_build_and_run_tests_with_qemu_aarch64.sh