[Tests] Fix build scripts for windows portability (#36211)

Fixes windows portability CI test - https://fusion2.corp.google.com/invocations/41fdd087-9cdc-4b6b-bf47-c4f70b978830/targets

Changes -
* Install files in a `cmake/install` directory instead of system directory.
* Remove unnecessary targets built and installed from opentelemetry (benchmarking and etw exporter).

Ref b/332425005

Closes #36211

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36211 from yashykt:OTelPluginTestCIFixes be703db302
PiperOrigin-RevId: 621243515
pull/36234/head
Yash Tibrewal 8 months ago committed by Copybara-Service
parent 952a2421f9
commit 4d570c29ee
  1. 17
      tools/run_tests/helper_scripts/build_cxx.bat
  2. 2
      tools/run_tests/helper_scripts/build_cxx.sh

@ -15,6 +15,11 @@
setlocal
cd /d %~dp0\..\..\..
mkdir cmake
cd cmake
mkdir install
cd ..
set "INSTALL_PATH=%~dp0\cmake\install"
If "%GRPC_BUILD_ACTIVATE_VS_TOOLS%" == "2019" (
@rem set cl.exe build environment to build with VS2019 tooling
@ -51,7 +56,7 @@ If "%GRPC_CMAKE_GENERATOR%" == "Ninja" (
cd third_party/abseil-cpp
mkdir build
cd build
cmake -G "%GRPC_CMAKE_GENERATOR%" -DCMAKE_C_COMPILER="cl.exe" -DCMAKE_CXX_COMPILER="cl.exe" -DABSL_BUILD_TESTING=OFF -DCMAKE_BUILD_TYPE="%MSBUILD_CONFIG%" %* .. || goto :error
cmake -G "%GRPC_CMAKE_GENERATOR%" -DCMAKE_C_COMPILER="cl.exe" -DCMAKE_CXX_COMPILER="cl.exe" -DABSL_BUILD_TESTING=OFF -DCMAKE_BUILD_TYPE="%MSBUILD_CONFIG%" -DCMAKE_INSTALL_PREFIX="%INSTALL_PATH%" %* .. || goto :error
ninja -j%GRPC_RUN_TESTS_JOBS% install || goto :error
@rem Install opentelemetry-cpp since we only support "package" mode for opentelemetry at present.
@ -59,7 +64,7 @@ If "%GRPC_CMAKE_GENERATOR%" == "Ninja" (
cd third_party/opentelemetry-cpp
mkdir build
cd build
cmake -G "%GRPC_CMAKE_GENERATOR%" -DCMAKE_C_COMPILER="cl.exe" -DCMAKE_CXX_COMPILER="cl.exe" -DWITH_ABSEIL=ON -DBUILD_TESTING=OFF -DCMAKE_BUILD_TYPE="%MSBUILD_CONFIG%" %* .. || goto :error
cmake -G "%GRPC_CMAKE_GENERATOR%" -DCMAKE_C_COMPILER="cl.exe" -DCMAKE_CXX_COMPILER="cl.exe" -DWITH_ABSEIL=ON -DBUILD_TESTING=OFF -DWITH_BENCHMARK=OFF -DWITH_ETW=OFF -DCMAKE_BUILD_TYPE="%MSBUILD_CONFIG%" -DCMAKE_INSTALL_PREFIX="%INSTALL_PATH%" %* .. || goto :error
ninja -j%GRPC_RUN_TESTS_JOBS% install || goto :error
cd ../../..
@ -69,7 +74,7 @@ If "%GRPC_CMAKE_GENERATOR%" == "Ninja" (
mkdir build
cd build
cmake -G "%GRPC_CMAKE_GENERATOR%" -DCMAKE_C_COMPILER="cl.exe" -DCMAKE_CXX_COMPILER="cl.exe" -DgRPC_BUILD_GRPCPP_OTEL_PLUGIN=ON -DgRPC_ABSL_PROVIDER=package -DgRPC_BUILD_TESTS=ON -DCMAKE_BUILD_TYPE="%MSBUILD_CONFIG%" %* ../.. || goto :error
cmake -G "%GRPC_CMAKE_GENERATOR%" -DCMAKE_C_COMPILER="cl.exe" -DCMAKE_CXX_COMPILER="cl.exe" -DgRPC_BUILD_GRPCPP_OTEL_PLUGIN=ON -DgRPC_ABSL_PROVIDER=package -DgRPC_BUILD_TESTS=ON -DCMAKE_BUILD_TYPE="%MSBUILD_CONFIG%" -DCMAKE_INSTALL_PREFIX="%INSTALL_PATH%" %* ../.. || goto :error
ninja -j%GRPC_RUN_TESTS_JOBS% buildtests_%GRPC_RUN_TESTS_CXX_LANGUAGE_SUFFIX% || goto :error
@ -80,7 +85,7 @@ If "%GRPC_CMAKE_GENERATOR%" == "Ninja" (
cd third_party/abseil-cpp
mkdir build
cd build
cmake -G "%GRPC_CMAKE_GENERATOR%" -A "%GRPC_CMAKE_ARCHITECTURE%" %CMAKE_SYSTEM_VERSION_ARG% -DCMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE=x64 -DABSL_BUILD_TESTING=OFF .. || goto :error
cmake -G "%GRPC_CMAKE_GENERATOR%" -A "%GRPC_CMAKE_ARCHITECTURE%" %CMAKE_SYSTEM_VERSION_ARG% -DCMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE=x64 -DABSL_BUILD_TESTING=OFF -DCMAKE_INSTALL_PREFIX="%INSTALL_PATH%" %* .. || goto :error
cmake --build . --target install || goto :error
@rem Install opentelemetry-cpp since we only support "package" mode for opentelemetry at present.
@ -88,7 +93,7 @@ If "%GRPC_CMAKE_GENERATOR%" == "Ninja" (
cd third_party/opentelemetry-cpp
mkdir build
cd build
cmake -G "%GRPC_CMAKE_GENERATOR%" -A "%GRPC_CMAKE_ARCHITECTURE%" %CMAKE_SYSTEM_VERSION_ARG% -DCMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE=x64 -DWITH_ABSEIL=ON -DBUILD_TESTING=OFF .. || goto :error
cmake -G "%GRPC_CMAKE_GENERATOR%" -A "%GRPC_CMAKE_ARCHITECTURE%" %CMAKE_SYSTEM_VERSION_ARG% -DCMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE=x64 -DWITH_ABSEIL=ON -DBUILD_TESTING=OFF -DWITH_BENCHMARK=OFF -DWITH_ETW=OFF -DCMAKE_INSTALL_PREFIX="%INSTALL_PATH%" %* .. || goto :error
cmake --build . --target install -j%GRPC_RUN_TESTS_JOBS% || goto :error
cd ../../..
@ -97,7 +102,7 @@ If "%GRPC_CMAKE_GENERATOR%" == "Ninja" (
mkdir build
cd build
cmake -G "%GRPC_CMAKE_GENERATOR%" -A "%GRPC_CMAKE_ARCHITECTURE%" %CMAKE_SYSTEM_VERSION_ARG% -DCMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE=x64 -DgRPC_BUILD_GRPCPP_OTEL_PLUGIN=ON -DgRPC_ABSL_PROVIDER=package -DgRPC_BUILD_TESTS=ON -DgRPC_BUILD_MSVC_MP_COUNT=%GRPC_RUN_TESTS_JOBS% %* ../.. || goto :error
cmake -G "%GRPC_CMAKE_GENERATOR%" -A "%GRPC_CMAKE_ARCHITECTURE%" %CMAKE_SYSTEM_VERSION_ARG% -DCMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE=x64 -DgRPC_BUILD_GRPCPP_OTEL_PLUGIN=ON -DgRPC_ABSL_PROVIDER=package -DgRPC_BUILD_TESTS=ON -DgRPC_BUILD_MSVC_MP_COUNT=%GRPC_RUN_TESTS_JOBS% -DCMAKE_INSTALL_PREFIX="%INSTALL_PATH%" %* ../.. || goto :error
@rem GRPC_RUN_TESTS_CXX_LANGUAGE_SUFFIX will be set to either "c" or "cxx"
cmake --build . --target buildtests_%GRPC_RUN_TESTS_CXX_LANGUAGE_SUFFIX% --config %MSBUILD_CONFIG% -j%GRPC_RUN_TESTS_JOBS% || goto :error

@ -32,7 +32,7 @@ cd ../../..
cd third_party/opentelemetry-cpp
mkdir build
cd build
cmake -DCMAKE_CXX_STANDARD=14 -DWITH_ABSEIL=ON -DBUILD_TESTING=OFF -DCMAKE_BUILD_TYPE="${MSBUILD_CONFIG}" -DCMAKE_INSTALL_PREFIX="${INSTALL_PATH}" "$@" ..
cmake -DCMAKE_CXX_STANDARD=14 -DWITH_ABSEIL=ON -DBUILD_TESTING=OFF -DWITH_BENCHMARK=OFF -DCMAKE_BUILD_TYPE="${MSBUILD_CONFIG}" -DCMAKE_INSTALL_PREFIX="${INSTALL_PATH}" "$@" ..
make -j"${GRPC_RUN_TESTS_JOBS}" install
cd ../../..

Loading…
Cancel
Save