From 6b2aa5f0061e8a7e82c85a4ba810e196eaf63eec Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Tue, 16 Nov 2021 11:29:34 +0100 Subject: [PATCH] simplify C# aarch64 tests (net60 can build under emulator) --- kokoro/linux/aarch64/test_csharp_aarch64.sh | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/kokoro/linux/aarch64/test_csharp_aarch64.sh b/kokoro/linux/aarch64/test_csharp_aarch64.sh index cc3bffe04d..e7fb351604 100755 --- a/kokoro/linux/aarch64/test_csharp_aarch64.sh +++ b/kokoro/linux/aarch64/test_csharp_aarch64.sh @@ -12,18 +12,13 @@ else DOCKER_TTY_ARGS= fi -# First, build protobuf C# tests under x86_64 docker image -# Tests are built "dotnet publish" because we want all the dependencies to the copied to the destination directory -# (we want to avoid references to ~/.nuget that won't be available in the subsequent docker run) -CSHARP_BUILD_COMMAND="dotnet publish -c Release -f net60 csharp/src/Google.Protobuf.Test/Google.Protobuf.Test.csproj" -docker run $DOCKER_TTY_ARGS --rm --user "$(id -u):$(id -g)" -e "HOME=/home/fake-user" -e "DOTNET_CLI_TELEMETRY_OPTOUT=true" -e "DOTNET_SKIP_FIRST_TIME_EXPERIENCE=true" -v "$(mktemp -d):/home/fake-user" -v "$(pwd)":/work -w /work mcr.microsoft.com/dotnet/sdk:6.0.100-bullseye-slim bash -c "$CSHARP_BUILD_COMMAND" - -# Use an actual aarch64 docker image to run protobuf C# tests with an emulator. "dotnet vstest" allows -# running tests from a pre-built project. +# Use an actual aarch64 docker image to build and run protobuf C# tests with an emulator. We could also pre-build +# the project under x86_64 docker image and then run the tests under an emulator, but C# build is relatively +# quick even under the emulator (and its simpler that way). # * mount the protobuf root as /work to be able to access the crosscompiled files # * to avoid running the process inside docker as root (which can pollute the workspace with files owned by root), we force # running under current user's UID and GID. To be able to do that, we need to provide a home directory for the user # otherwise the UID would be homeless under the docker container and pip install wouldn't work. For simplicity, # we just run map the user's home to a throwaway temporary directory -CSHARP_TEST_COMMAND="dotnet vstest csharp/src/Google.Protobuf.Test/bin/Release/net60/publish/Google.Protobuf.Test.dll" +CSHARP_TEST_COMMAND="dotnet test -c Release -f net60 csharp/src/Google.Protobuf.Test/Google.Protobuf.Test.csproj" docker run $DOCKER_TTY_ARGS --rm --user "$(id -u):$(id -g)" -e "HOME=/home/fake-user" -e "DOTNET_CLI_TELEMETRY_OPTOUT=true" -e "DOTNET_SKIP_FIRST_TIME_EXPERIENCE=true" -v "$(mktemp -d):/home/fake-user" -v "$(pwd)":/work -w /work mcr.microsoft.com/dotnet/sdk:6.0.100-bullseye-slim-arm64v8 bash -c "$CSHARP_TEST_COMMAND"