aboutsummaryrefslogtreecommitdiff
path: root/kokoro
diff options
context:
space:
mode:
authorambrosin <ambrosin@google.com>2023-01-11 02:58:45 -0800
committerCopybara-Service <copybara-worker@google.com>2023-01-11 03:00:16 -0800
commit5ea60b84580a16d9037c421f4ed8a86e683a26cb (patch)
tree7ab1edad021858792b63a1340277f1f2458d1099 /kokoro
parentc8daf5cd3e052e1cb415aa031664e6e3cf8f3aca (diff)
downloadtink-5ea60b84580a16d9037c421f4ed8a86e683a26cb.tar.gz
Fix Kokoro test scripts for migrating to new Monterey image.
PiperOrigin-RevId: 501230294
Diffstat (limited to 'kokoro')
-rw-r--r--kokoro/macos_external/apps/run_tests.sh18
-rw-r--r--kokoro/macos_external/cc/bazel/run_tests.sh11
-rw-r--r--kokoro/macos_external/go/bazel/run_tests.sh20
-rw-r--r--kokoro/macos_external/java_src/run_tests.sh23
-rw-r--r--kokoro/macos_external/javascript/run_tests.sh28
-rw-r--r--kokoro/macos_external/python/bazel/run_tests.sh18
-rw-r--r--kokoro/macos_external/python/pip/run_tests.sh6
-rw-r--r--kokoro/macos_external/tools/run_tests.sh44
8 files changed, 67 insertions, 101 deletions
diff --git a/kokoro/macos_external/apps/run_tests.sh b/kokoro/macos_external/apps/run_tests.sh
index 52010e61f..de288eaae 100644
--- a/kokoro/macos_external/apps/run_tests.sh
+++ b/kokoro/macos_external/apps/run_tests.sh
@@ -14,19 +14,17 @@
# limitations under the License.
################################################################################
-
set -euo pipefail
-cd ${KOKORO_ARTIFACTS_DIR}/git/tink
-
-export XCODE_VERSION=11.3
+export XCODE_VERSION=14
export DEVELOPER_DIR="/Applications/Xcode_${XCODE_VERSION}.app/Contents/Developer"
-export ANDROID_HOME="/Users/kbuilder/Library/Android/sdk"
+export ANDROID_HOME="/usr/local/share/android-sdk"
export COURSIER_OPTS="-Djava.net.preferIPv6Addresses=true"
-./kokoro/testutils/update_android_sdk.sh
+if [[ -n "${KOKORO_ROOT:-}" ]] ; then
+ cd "$(echo "${KOKORO_ARTIFACTS_DIR}"/git*/tink)"
+ export JAVA_HOME=$(/usr/libexec/java_home -v "1.8.0_292")
+fi
-cd apps
-use_bazel.sh $(cat .bazelversion)
-time bazel build -- ...
-time bazel test --test_output="errors" -- ...
+./kokoro/testutils/update_android_sdk.sh
+./kokoro/testutils/run_bazel_tests.sh apps
diff --git a/kokoro/macos_external/cc/bazel/run_tests.sh b/kokoro/macos_external/cc/bazel/run_tests.sh
index 220bb254d..e17b297aa 100644
--- a/kokoro/macos_external/cc/bazel/run_tests.sh
+++ b/kokoro/macos_external/cc/bazel/run_tests.sh
@@ -15,11 +15,10 @@
# limitations under the License.
################################################################################
-
set -euo pipefail
-cd ${KOKORO_ARTIFACTS_DIR}/git/tink
-cd cc
-use_bazel.sh $(cat .bazelversion)
-bazel build -- ...
-bazel test --test_output="errors" -- ...
+if [[ -n "${KOKORO_ARTIFACTS_DIR:-}" ]] ; then
+ cd "$(echo "${KOKORO_ARTIFACTS_DIR}"/git*/tink)"
+fi
+
+./kokoro/testutils/run_bazel_tests.sh cc
diff --git a/kokoro/macos_external/go/bazel/run_tests.sh b/kokoro/macos_external/go/bazel/run_tests.sh
index 838a783af..993e35603 100644
--- a/kokoro/macos_external/go/bazel/run_tests.sh
+++ b/kokoro/macos_external/go/bazel/run_tests.sh
@@ -16,22 +16,26 @@
set -euo pipefail
-if [[ -n "${KOKORO_ROOT:-}" ]]; then
- cd "${KOKORO_ARTIFACTS_DIR}/git/tink"
- use_bazel.sh "$(cat go/.bazelversion)"
+IS_KOKORO="false"
+if [[ -n "${KOKORO_ARTIFACTS_DIR:-}" ]]; then
+ IS_KOKORO="true"
+fi
+readonly IS_KOKORO
+
+if [[ "${IS_KOKORO}" == "true" ]]; then
+ cd "$(echo "${KOKORO_ARTIFACTS_DIR}"/git*/tink)"
fi
./kokoro/testutils/copy_credentials.sh "go/testdata" "all"
# Sourcing required to update callers environment.
source ./kokoro/testutils/install_go.sh
-
echo "Using go binary from $(which go): $(go version)"
-
-./kokoro/testutils/check_go_generated_files_up_to_date.sh go/
+./kokoro/testutils/check_go_generated_files_up_to_date.sh go
MANUAL_TARGETS=()
-# Run manual tests that rely on test data only available via Bazel.
-if [[ -n "${KOKORO_ROOT:-}" ]]; then
+# Run manual tests which rely on key material injected into the Kokoro
+# environement.
+if [[ "${IS_KOKORO}" == "true" ]]; then
MANUAL_TARGETS+=(
"//integration/gcpkms:gcpkms_test"
"//integration/awskms:awskms_test"
diff --git a/kokoro/macos_external/java_src/run_tests.sh b/kokoro/macos_external/java_src/run_tests.sh
index 5a3ffcfc8..d559c7a7a 100644
--- a/kokoro/macos_external/java_src/run_tests.sh
+++ b/kokoro/macos_external/java_src/run_tests.sh
@@ -16,24 +16,15 @@
set -euo pipefail
-export XCODE_VERSION=11.3
+export XCODE_VERSION=14
export DEVELOPER_DIR="/Applications/Xcode_${XCODE_VERSION}.app/Contents/Developer"
-export ANDROID_HOME="/Users/kbuilder/Library/Android/sdk"
+export ANDROID_HOME="/usr/local/share/android-sdk"
export COURSIER_OPTS="-Djava.net.preferIPv6Addresses=true"
-declare -a TEST_FLAGS
-TEST_FLAGS=(
- --strategy=TestRunner=standalone
- --test_output=errors
- --jvmopt="-Djava.net.preferIPv6Addresses=true"
-)
-readonly TEST_FLAGS
+if [[ -n "${KOKORO_ROOT:-}" ]] ; then
+ cd "$(echo "${KOKORO_ARTIFACTS_DIR}"/git*/tink)"
+ export JAVA_HOME=$(/usr/libexec/java_home -v "1.8.0_292")
+fi
-cd ${KOKORO_ARTIFACTS_DIR}/git/tink
-./kokoro/testutils/copy_credentials.sh "java_src/testdata" "all"
./kokoro/testutils/update_android_sdk.sh
-
-cd java_src
-use_bazel.sh $(cat .bazelversion)
-bazel build ...
-bazel test "${TEST_FLAGS[@]}" -- ...
+./kokoro/testutils/run_bazel_tests.sh java_src
diff --git a/kokoro/macos_external/javascript/run_tests.sh b/kokoro/macos_external/javascript/run_tests.sh
index 8d01912c6..1e59dd6dd 100644
--- a/kokoro/macos_external/javascript/run_tests.sh
+++ b/kokoro/macos_external/javascript/run_tests.sh
@@ -14,30 +14,10 @@
# limitations under the License.
################################################################################
-
set -euo pipefail
-main() {
- if [[ -n "${KOKORO_ROOT:-}" ]]; then
- cd "${KOKORO_ARTIFACTS_DIR}/git/tink"
- fi
-
- cd javascript
- if [[ -n "${KOKORO_ROOT:-}" ]]; then
- use_bazel.sh "$(cat .bazelversion)"
- fi
-
- local readonly TEST_FLAGS=(
- --strategy=TestRunner=standalone
- --test_output=errors
- )
-
- # This is needed to handle recent Chrome distributions on macOS which have
- # paths with spaces. Context:
- # https://github.com/bazelbuild/bazel/issues/4327#issuecomment-627422865
- local readonly BAZEL_FLAGS=( --experimental_inprocess_symlink_creation )
- bazel build "${BAZEL_FLAGS[@]}" -- ...
- bazel test "${BAZEL_FLAGS[@]}" "${TEST_FLAGS[@]}" -- ...
-}
+if [[ -n "${KOKORO_ARTIFACTS_DIR:-}" ]]; then
+ cd "$(echo "${KOKORO_ARTIFACTS_DIR}"/git*/tink)"
+fi
-main "$@"
+./kokoro/testutils/run_bazel_tests.sh javascript
diff --git a/kokoro/macos_external/python/bazel/run_tests.sh b/kokoro/macos_external/python/bazel/run_tests.sh
index 12912c641..a36a8a886 100644
--- a/kokoro/macos_external/python/bazel/run_tests.sh
+++ b/kokoro/macos_external/python/bazel/run_tests.sh
@@ -16,22 +16,24 @@
set -euo pipefail
-if [[ -n "${KOKORO_ROOT:-}" ]]; then
- cd "${KOKORO_ARTIFACTS_DIR}/git/tink"
+IS_KOKORO="false"
+if [[ -n "${KOKORO_ARTIFACTS_DIR:-}" ]]; then
+ IS_KOKORO="true"
+fi
+readonly IS_KOKORO
+
+if [[ "${IS_KOKORO}" == "true" ]]; then
+ cd "$(echo "${KOKORO_ARTIFACTS_DIR}"/git*/tink)"
fi
./kokoro/testutils/copy_credentials.sh "python/testdata" "gcp"
# Install protobuf pip packages.
-pip3 install protobuf --user
-
-if [[ -n "${KOKORO_ROOT:-}" ]]; then
- use_bazel.sh $(cat python/.bazelversion)
-fi
+pip3 install protobuf==3.20.3 --user
# Run manual tests which rely on key material injected into the Kokoro
# environement.
MANUAL_TARGETS=()
-if [[ -n "${KOKORO_ROOT:-}" ]]; then
+if [[ "${IS_KOKORO}" == "true" ]]; then
MANUAL_TARGETS+=( "//tink/integration/gcpkms:_gcp_kms_aead_test" )
fi
readonly MANUAL_TARGETS
diff --git a/kokoro/macos_external/python/pip/run_tests.sh b/kokoro/macos_external/python/pip/run_tests.sh
index 5fee23e76..e1c098202 100644
--- a/kokoro/macos_external/python/pip/run_tests.sh
+++ b/kokoro/macos_external/python/pip/run_tests.sh
@@ -16,10 +16,8 @@
set -euo pipefail
-# If we are running on Kokoro cd into the repository.
-if [[ -n "${KOKORO_ROOT:-}" ]]; then
- cd "${KOKORO_ARTIFACTS_DIR}/git/tink"
- use_bazel.sh "$(cat python/.bazelversion)"
+if [[ -n "${KOKORO_ARTIFACTS_DIR:-}" ]]; then
+ cd "$(echo "${KOKORO_ARTIFACTS_DIR}"/git*/tink)"
fi
./kokoro/testutils/copy_credentials.sh "python/testdata" "all"
diff --git a/kokoro/macos_external/tools/run_tests.sh b/kokoro/macos_external/tools/run_tests.sh
index a9f0fab0a..41f241ad6 100644
--- a/kokoro/macos_external/tools/run_tests.sh
+++ b/kokoro/macos_external/tools/run_tests.sh
@@ -14,45 +14,38 @@
# limitations under the License.
################################################################################
-
set -euo pipefail
-
-export XCODE_VERSION=11.3
+export XCODE_VERSION=14
export DEVELOPER_DIR="/Applications/Xcode_${XCODE_VERSION}.app/Contents/Developer"
-export ANDROID_HOME="/Users/kbuilder/Library/Android/sdk"
+export ANDROID_HOME="/usr/local/share/android-sdk"
export COURSIER_OPTS="-Djava.net.preferIPv6Addresses=true"
-cd "${KOKORO_ARTIFACTS_DIR}/git/tink"
+IS_KOKORO="false"
+if [[ -n "${KOKORO_ARTIFACTS_DIR:-}" ]]; then
+ IS_KOKORO="true"
+fi
+readonly IS_KOKORO
+
+if [[ "${IS_KOKORO}" == "true" ]] ; then
+ cd "$(echo "${KOKORO_ARTIFACTS_DIR}"/git*/tink)"
+ export JAVA_HOME=$(/usr/libexec/java_home -v "1.8.0_292")
+fi
+
./kokoro/testutils/copy_credentials.sh "tools/testdata" "all"
./kokoro/testutils/update_android_sdk.sh
# Sourcing required to update callers environment.
source ./kokoro/testutils/install_go.sh
-
echo "Using go binary from $(which go): $(go version)"
# TODO(b/155225382): Avoid modifying the sytem Python installation.
pip3 install --user protobuf
-cd tools
-use_bazel.sh $(cat .bazelversion)
-
-declare -a TEST_FLAGS
-TEST_FLAGS=(
- --strategy=TestRunner=standalone
- --test_output=errors
- --jvmopt="-Djava.net.preferIPv6Addresses=true"
-)
-readonly TEST_FLAGS
-
-time bazel build -- ...
-time bazel test "${TEST_FLAGS[@]}" -- ...
-
# Run manual tests which rely on key material injected into the Kokoro
# environement.
-if [[ -n "${KOKORO_ROOT}" ]]; then
- declare -a MANUAL_TARGETS
- MANUAL_TARGETS=(
+MANUAL_TARGETS=()
+if [[ "${IS_KOKORO}" == "true" ]] ; then
+ MANUAL_TARGETS+=(
"//testing/cc:aws_kms_aead_test"
"//testing/cc:gcp_kms_aead_test"
"//testing/cross_language:aead_envelope_test"
@@ -61,6 +54,7 @@ if [[ -n "${KOKORO_ROOT}" ]]; then
"//tinkey/src/test/java/com/google/crypto/tink/tinkey:CreatePublicKeysetCommandTest"
"//tinkey/src/test/java/com/google/crypto/tink/tinkey:RotateKeysetCommandTest"
)
- readonly MANUAL_TARGETS
- time bazel test "${TEST_FLAGS[@]}" -- "${MANUAL_TARGETS[@]}"
fi
+readonly MANUAL_TARGETS
+
+./kokoro/testutils/run_bazel_tests.sh tools "${MANUAL_TARGETS}"