diff --git a/kokoro/gcp_ubuntu/bazel/run_tests.sh b/kokoro/gcp_ubuntu/bazel/run_tests.sh index ae7539a2..09052bda 100644 --- a/kokoro/gcp_ubuntu/bazel/run_tests.sh +++ b/kokoro/gcp_ubuntu/bazel/run_tests.sh @@ -14,15 +14,20 @@ # limitations under the License. ################################################################################ -set -euo pipefail - -# By default when run locally this script runs the command below directly on the -# host. The CONTAINER_IMAGE variable can be set to run on a custom container -# image for local testing. E.g.: +# Builds and tests tink-cc and its examples using Bazel. +# +# The behavior of this script can be modified using the following optional env +# variables: +# +# - CONTAINER_IMAGE (unset by default): By default when run locally this script +# executes tests directly on the host. The CONTAINER_IMAGE variable can be set +# to execute tests in a custom container image for local testing. E.g.: # -# CONTAINER_IMAGE="us-docker.pkg.dev/tink-test-infrastructure/tink-ci-images/linux-tink-cc-base:latest" \ -# sh ./kokoro/gcp_ubuntu/bazel/run_tests.sh +# CONTAINER_IMAGE="us-docker.pkg.dev/tink-test-infrastructure/tink-ci-images/linux-tink-cc-base:latest" \ +# sh ./kokoro/gcp_ubuntu/bazel/run_tests.sh # +set -euo pipefail + RUN_COMMAND_ARGS=() if [[ -n "${KOKORO_ARTIFACTS_DIR:-}" ]]; then readonly TINK_BASE_DIR="$(echo "${KOKORO_ARTIFACTS_DIR}"/git*)" @@ -33,9 +38,13 @@ if [[ -n "${KOKORO_ARTIFACTS_DIR:-}" ]]; then fi readonly CONTAINER_IMAGE -if [[ -n "${CONTAINER_IMAGE}" ]]; then +if [[ -n "${CONTAINER_IMAGE:-}" ]]; then RUN_COMMAND_ARGS+=( -c "${CONTAINER_IMAGE}" ) fi ./kokoro/testutils/run_command.sh "${RUN_COMMAND_ARGS[@]}" \ - ./kokoro/testutils/run_bazel_tests.sh -b --enable_bzlmod -t --enable_bzlmod . + ./kokoro/testutils/run_bazel_tests.sh . + +# Build and run tests using the WORKSPACE file. +./kokoro/testutils/run_command.sh "${RUN_COMMAND_ARGS[@]}" \ + ./kokoro/testutils/run_bazel_tests.sh examples diff --git a/kokoro/gcp_ubuntu/examples/bazel/run_tests.sh b/kokoro/gcp_ubuntu/bzlmod/run_tests.sh old mode 100755 new mode 100644 similarity index 57% rename from kokoro/gcp_ubuntu/examples/bazel/run_tests.sh rename to kokoro/gcp_ubuntu/bzlmod/run_tests.sh index 54416575..74c0c87c --- a/kokoro/gcp_ubuntu/examples/bazel/run_tests.sh +++ b/kokoro/gcp_ubuntu/bzlmod/run_tests.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,37 +14,39 @@ # limitations under the License. ################################################################################ -set -euo pipefail - -# By default when run locally this script runs the command below directly on the -# host. The CONTAINER_IMAGE variable can be set to run on a custom container -# image for local testing. E.g.: +# Builds and tests tink-cc and its examples using Bazel's bzlmod. +# +# The behavior of this script can be modified using the following optional env +# variables: # -# CONTAINER_IMAGE="us-docker.pkg.dev/tink-test-infrastructure/tink-ci-images/linux-tink-cc-base:latest" \ -# sh ./kokoro/gcp_ubuntu/examples/bazel/run_tests.sh +# - CONTAINER_IMAGE (unset by default): By default when run locally this script +# executes tests directly on the host. The CONTAINER_IMAGE variable can be set +# to execute tests in a custom container image for local testing. E.g.: # +# CONTAINER_IMAGE="us-docker.pkg.dev/tink-test-infrastructure/tink-ci-images/linux-tink-cc-base:latest" \ +# sh ./kokoro/gcp_ubuntu/bzlmod/run_tests.sh +# +set -euo pipefail + RUN_COMMAND_ARGS=() if [[ -n "${KOKORO_ARTIFACTS_DIR:-}" ]]; then - TINK_BASE_DIR="$(echo "${KOKORO_ARTIFACTS_DIR}"/git*)" - source "${TINK_BASE_DIR}/tink_cc/kokoro/testutils/cc_test_container_images.sh" + readonly TINK_BASE_DIR="$(echo "${KOKORO_ARTIFACTS_DIR}"/git*)" + cd "${TINK_BASE_DIR}/tink_cc" + source kokoro/testutils/cc_test_container_images.sh CONTAINER_IMAGE="${TINK_CC_BASE_IMAGE}" RUN_COMMAND_ARGS+=( -k "${TINK_GCR_SERVICE_KEY}" ) fi -: "${TINK_BASE_DIR:=$(cd .. && pwd)}" -readonly TINK_BASE_DIR readonly CONTAINER_IMAGE -cd "${TINK_BASE_DIR}/tink_cc" - -if [[ -n "${CONTAINER_IMAGE}" ]]; then +if [[ -n "${CONTAINER_IMAGE:-}" ]]; then RUN_COMMAND_ARGS+=( -c "${CONTAINER_IMAGE}" ) fi -# Build and run tests using bzlmod. ./kokoro/testutils/run_command.sh "${RUN_COMMAND_ARGS[@]}" \ ./kokoro/testutils/run_bazel_tests.sh -b "--enable_bzlmod" \ - -t "--enable_bzlmod" examples + -t "--enable_bzlmod" . -# Build and run tests using the WORKSPACE file. +# Build and run tests using bzlmod. ./kokoro/testutils/run_command.sh "${RUN_COMMAND_ARGS[@]}" \ - ./kokoro/testutils/run_bazel_tests.sh examples + ./kokoro/testutils/run_bazel_tests.sh -b "--enable_bzlmod" \ + -t "--enable_bzlmod" examples diff --git a/kokoro/gcp_ubuntu/cmake/run_tests.sh b/kokoro/gcp_ubuntu/cmake/run_tests.sh index 1587ae37..694b98f9 100644 --- a/kokoro/gcp_ubuntu/cmake/run_tests.sh +++ b/kokoro/gcp_ubuntu/cmake/run_tests.sh @@ -14,15 +14,20 @@ # limitations under the License. ################################################################################ -set -euo pipefail - -# By default when run locally this script runs the command below directly on the -# host. The CONTAINER_IMAGE variable can be set to run on a custom container -# image for local testing. E.g.: +# Builds and tests tink-cc and its examples using CMake. +# +# The behavior of this script can be modified using the following optional env +# variables: # -# CONTAINER_IMAGE="us-docker.pkg.dev/tink-test-infrastructure/tink-ci-images/linux-tink-cc-cmake:latest" \ -# sh ./kokoro/gcp_ubuntu/cmake/run_tests.sh +# - CONTAINER_IMAGE (unset by default): By default when run locally this script +# executes tests directly on the host. The CONTAINER_IMAGE variable can be set +# to execute tests in a custom container image for local testing. E.g.: # +# CONTAINER_IMAGE="us-docker.pkg.dev/tink-test-infrastructure/tink-ci-images/linux-tink-cc-cmake:latest" \ +# sh ./kokoro/gcp_ubuntu/cmake/run_tests.sh +# +set -euo pipefail + RUN_COMMAND_ARGS=() if [[ -n "${KOKORO_ARTIFACTS_DIR:-}" ]]; then readonly TINK_BASE_DIR="$(echo "${KOKORO_ARTIFACTS_DIR}"/git*)" @@ -33,7 +38,7 @@ if [[ -n "${KOKORO_ARTIFACTS_DIR:-}" ]]; then fi readonly CONTAINER_IMAGE -if [[ -n "${CONTAINER_IMAGE}" ]]; then +if [[ -n "${CONTAINER_IMAGE:-}" ]]; then RUN_COMMAND_ARGS+=( -c "${CONTAINER_IMAGE}" ) fi diff --git a/kokoro/gcp_ubuntu/cmake_openssl/run_tests.sh b/kokoro/gcp_ubuntu/cmake_openssl/run_tests.sh index ce26beae..b4b24f93 100644 --- a/kokoro/gcp_ubuntu/cmake_openssl/run_tests.sh +++ b/kokoro/gcp_ubuntu/cmake_openssl/run_tests.sh @@ -14,15 +14,20 @@ # limitations under the License. ################################################################################ -set -euo pipefail - -# By default when run locally this script runs the command below directly on the -# host. The CONTAINER_IMAGE variable can be set to run on a custom container -# image for local testing. E.g.: +# Builds and tests tink-cc with OpenSSL 1.1.1 and its examples CMake. +# +# The behavior of this script can be modified using the following optional env +# variables: +# +# - CONTAINER_IMAGE (unset by default): By default when run locally this script +# executes tests directly on the host. The CONTAINER_IMAGE variable can be set +# to execute tests in a custom container image for local testing. E.g.: # -# CONTAINER_IMAGE="us-docker.pkg.dev/tink-test-infrastructure/tink-ci-images/linux-tink-cc-cmake-and-openssl-1_1_1:latest" \ -# sh ./kokoro/gcp_ubuntu/cmake_openssl/run_tests.sh +# CONTAINER_IMAGE="us-docker.pkg.dev/tink-test-infrastructure/tink-ci-images/linux-tink-cc-cmake-and-openssl-1_1_1:latest" \ +# sh ./kokoro/gcp_ubuntu/cmake_openssl/run_tests.sh # +set -euo pipefail + RUN_COMMAND_ARGS=() if [[ -n "${KOKORO_ARTIFACTS_DIR:-}" ]]; then readonly TINK_BASE_DIR="$(echo "${KOKORO_ARTIFACTS_DIR}"/git*)" @@ -33,9 +38,13 @@ if [[ -n "${KOKORO_ARTIFACTS_DIR:-}" ]]; then fi readonly CONTAINER_IMAGE -if [[ -n "${CONTAINER_IMAGE}" ]]; then +if [[ -n "${CONTAINER_IMAGE:-}" ]]; then RUN_COMMAND_ARGS+=( -c "${CONTAINER_IMAGE}" ) fi ./kokoro/testutils/run_command.sh "${RUN_COMMAND_ARGS[@]}" \ ./kokoro/testutils/run_cmake_tests.sh . -DTINK_USE_SYSTEM_OPENSSL=ON + +./kokoro/testutils/run_command.sh "${RUN_COMMAND_ARGS[@]}" \ + ./kokoro/testutils/run_cmake_tests.sh "examples" -DTINK_BUILD_TESTS=OFF \ + -DTINK_USE_SYSTEM_OPENSSL=ON diff --git a/kokoro/gcp_ubuntu/cmake_openssl3/run_tests.sh b/kokoro/gcp_ubuntu/cmake_openssl3/run_tests.sh index 26e30cc5..a6d0d78c 100644 --- a/kokoro/gcp_ubuntu/cmake_openssl3/run_tests.sh +++ b/kokoro/gcp_ubuntu/cmake_openssl3/run_tests.sh @@ -14,15 +14,20 @@ # limitations under the License. ################################################################################ -set -euo pipefail - -# By default when run locally this script runs the command below directly on the -# host. The CONTAINER_IMAGE variable can be set to run on a custom container -# image for local testing. E.g.: +# Builds and tests tink-cc with OpenSSL 3 and its examples CMake. +# +# The behavior of this script can be modified using the following optional env +# variables: +# +# - CONTAINER_IMAGE (unset by default): By default when run locally this script +# executes tests directly on the host. The CONTAINER_IMAGE variable can be set +# to execute tests in a custom container image for local testing. E.g.: # -# CONTAINER_IMAGE="us-docker.pkg.dev/tink-test-infrastructure/tink-ci-images/linux-tink-cc-cmake-and-openssl-3:latest" \ -# sh ./kokoro/gcp_ubuntu/cmake_openssl/run_tests.sh +# CONTAINER_IMAGE="us-docker.pkg.dev/tink-test-infrastructure/tink-ci-images/linux-tink-cc-cmake-and-openssl-3:latest" \ +# sh ./kokoro/gcp_ubuntu/cmake_openssl3/run_tests.sh # +set -euo pipefail + RUN_COMMAND_ARGS=() if [[ -n "${KOKORO_ARTIFACTS_DIR:-}" ]]; then readonly TINK_BASE_DIR="$(echo "${KOKORO_ARTIFACTS_DIR}"/git*)" @@ -33,9 +38,13 @@ if [[ -n "${KOKORO_ARTIFACTS_DIR:-}" ]]; then fi readonly CONTAINER_IMAGE -if [[ -n "${CONTAINER_IMAGE}" ]]; then +if [[ -n "${CONTAINER_IMAGE:-}" ]]; then RUN_COMMAND_ARGS+=( -c "${CONTAINER_IMAGE}" ) fi ./kokoro/testutils/run_command.sh "${RUN_COMMAND_ARGS[@]}" \ ./kokoro/testutils/run_cmake_tests.sh . -DTINK_USE_SYSTEM_OPENSSL=ON + +./kokoro/testutils/run_command.sh "${RUN_COMMAND_ARGS[@]}" \ + ./kokoro/testutils/run_cmake_tests.sh "examples" -DTINK_BUILD_TESTS=OFF \ + -DTINK_USE_SYSTEM_OPENSSL=ON diff --git a/kokoro/gcp_ubuntu/examples/cmake/run_tests.sh b/kokoro/gcp_ubuntu/examples/cmake/run_tests.sh deleted file mode 100755 index 16500641..00000000 --- a/kokoro/gcp_ubuntu/examples/cmake/run_tests.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/bash -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -################################################################################ - -set -euo pipefail - -# By default when run locally this script runs the command below directly on the -# host. The CONTAINER_IMAGE variable can be set to run on a custom container -# image for local testing. E.g.: -# -# CONTAINER_IMAGE="us-docker.pkg.dev/tink-test-infrastructure/tink-ci-images/linux-tink-cc-cmake:latest" \ -# sh ./kokoro/gcp_ubuntu/examples/cmake/run_tests.sh -# -RUN_COMMAND_ARGS=() -if [[ -n "${KOKORO_ARTIFACTS_DIR:-}" ]]; then - readonly TINK_BASE_DIR="$(echo "${KOKORO_ARTIFACTS_DIR}"/git*)" - cd "${TINK_BASE_DIR}/tink_cc" - source kokoro/testutils/cc_test_container_images.sh - CONTAINER_IMAGE="${TINK_CC_CMAKE_IMAGE}" - RUN_COMMAND_ARGS+=( -k "${TINK_GCR_SERVICE_KEY}" ) -fi -readonly CONTAINER_IMAGE - -if [[ -n "${CONTAINER_IMAGE}" ]]; then - RUN_COMMAND_ARGS+=( -c "${CONTAINER_IMAGE}" ) -fi - -./kokoro/testutils/run_command.sh "${RUN_COMMAND_ARGS[@]}" \ - ./kokoro/testutils/run_cmake_tests.sh "examples" -DTINK_BUILD_TESTS=OFF diff --git a/kokoro/gcp_ubuntu/examples/cmake_openssl/run_tests.sh b/kokoro/gcp_ubuntu/examples/cmake_openssl/run_tests.sh deleted file mode 100755 index f0336db7..00000000 --- a/kokoro/gcp_ubuntu/examples/cmake_openssl/run_tests.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/bash -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -################################################################################ - -set -euo pipefail - -# By default when run locally this script runs the command below directly on the -# host. The CONTAINER_IMAGE variable can be set to run on a custom container -# image for local testing. E.g.: -# -# CONTAINER_IMAGE="us-docker.pkg.dev/tink-test-infrastructure/tink-ci-images/linux-tink-cc-cmake-and-openssl-1_1_1:latest" \ -# sh ./kokoro/gcp_ubuntu/examples/cmake_openssl/run_tests.sh -# -RUN_COMMAND_ARGS=() -if [[ -n "${KOKORO_ARTIFACTS_DIR:-}" ]]; then - readonly TINK_BASE_DIR="$(echo "${KOKORO_ARTIFACTS_DIR}"/git*)" - cd "${TINK_BASE_DIR}/tink_cc" - source kokoro/testutils/cc_test_container_images.sh - CONTAINER_IMAGE="${TINK_CC_CMAKE_AND_OPENSSL_1_1_1_IMAGE}" - RUN_COMMAND_ARGS+=( -k "${TINK_GCR_SERVICE_KEY}" ) -fi -readonly CONTAINER_IMAGE - -if [[ -n "${CONTAINER_IMAGE}" ]]; then - RUN_COMMAND_ARGS+=( -c "${CONTAINER_IMAGE}" ) -fi - -./kokoro/testutils/run_command.sh "${RUN_COMMAND_ARGS[@]}" \ - ./kokoro/testutils/run_cmake_tests.sh "examples" -DTINK_BUILD_TESTS=OFF diff --git a/kokoro/macos_external/bazel/run_tests.sh b/kokoro/macos_external/bazel/run_tests.sh index be84f6dc..0b24f1dd 100644 --- a/kokoro/macos_external/bazel/run_tests.sh +++ b/kokoro/macos_external/bazel/run_tests.sh @@ -18,8 +18,9 @@ set -euo pipefail # If we are running on Kokoro cd into the repository. if [[ -n "${KOKORO_ROOT:-}" ]]; then - TINK_BASE_DIR="$(echo "${KOKORO_ARTIFACTS_DIR}"/git*)" + readonly TINK_BASE_DIR="$(echo "${KOKORO_ARTIFACTS_DIR}"/git*)" cd "${TINK_BASE_DIR}/tink_cc" fi ./kokoro/testutils/run_bazel_tests.sh . +./kokoro/testutils/run_bazel_tests.sh "examples" diff --git a/kokoro/macos_external/cmake/run_tests.sh b/kokoro/macos_external/cmake/run_tests.sh index 67b15dcf..837b9fff 100644 --- a/kokoro/macos_external/cmake/run_tests.sh +++ b/kokoro/macos_external/cmake/run_tests.sh @@ -22,3 +22,4 @@ if [[ -n "${KOKORO_ROOT:-}" ]]; then fi ./kokoro/testutils/run_cmake_tests.sh . +./kokoro/testutils/run_cmake_tests.sh "examples" -DTINK_BUILD_TESTS=OFF diff --git a/kokoro/macos_external/cmake_openssl/run_tests.sh b/kokoro/macos_external/cmake_openssl/run_tests.sh index de7f6034..80fff668 100644 --- a/kokoro/macos_external/cmake_openssl/run_tests.sh +++ b/kokoro/macos_external/cmake_openssl/run_tests.sh @@ -24,3 +24,5 @@ fi # Sourcing is needed to update the caller environment. source ./kokoro/testutils/install_openssl.sh ./kokoro/testutils/run_cmake_tests.sh . -DTINK_USE_SYSTEM_OPENSSL=ON +./kokoro/testutils/run_cmake_tests.sh "examples" -DTINK_BUILD_TESTS=OFF \ + -DTINK_USE_SYSTEM_OPENSSL=ON diff --git a/kokoro/macos_external/examples/bazel/run_tests.sh b/kokoro/macos_external/examples/bazel/run_tests.sh deleted file mode 100755 index b5a2ff38..00000000 --- a/kokoro/macos_external/examples/bazel/run_tests.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -################################################################################ - -set -euo pipefail - -if [[ -n "${KOKORO_ROOT:-}" ]]; then - TINK_BASE_DIR="$(echo "${KOKORO_ARTIFACTS_DIR}"/git*)" -fi -: "${TINK_BASE_DIR:=$(cd .. && pwd)}" -readonly TINK_BASE_DIR - -cd "${TINK_BASE_DIR}/tink_cc" - -./kokoro/testutils/run_bazel_tests.sh "examples" diff --git a/kokoro/macos_external/examples/cmake/run_tests.sh b/kokoro/macos_external/examples/cmake/run_tests.sh deleted file mode 100755 index 3a3719d8..00000000 --- a/kokoro/macos_external/examples/cmake/run_tests.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -################################################################################ - -set -euo pipefail - -if [[ -n "${KOKORO_ROOT:-}" ]]; then - TINK_BASE_DIR="$(echo "${KOKORO_ARTIFACTS_DIR}"/git*)" - cd "${TINK_BASE_DIR}/tink_cc" -fi - -./kokoro/testutils/run_cmake_tests.sh "examples" -DTINK_BUILD_TESTS=OFF diff --git a/kokoro/macos_external/examples/cmake_openssl/run_tests.sh b/kokoro/macos_external/examples/cmake_openssl/run_tests.sh deleted file mode 100755 index e8da3919..00000000 --- a/kokoro/macos_external/examples/cmake_openssl/run_tests.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -################################################################################ - -set -euo pipefail - -if [[ -n "${KOKORO_ROOT:-}" ]]; then - TINK_BASE_DIR="$(echo "${KOKORO_ARTIFACTS_DIR}"/git*)" - cd "${TINK_BASE_DIR}/tink_cc" -fi - -# Sourcing is needed to update the caller environment. -source ./kokoro/testutils/install_openssl.sh -./kokoro/testutils/run_cmake_tests.sh "examples" -DTINK_BUILD_TESTS=OFF \ - -DTINK_USE_SYSTEM_OPENSSL=ON