From 6cd7901d7d5f9639e95fff3d8927ba8856a83f91 Mon Sep 17 00:00:00 2001 From: Brad Burlage Date: Mon, 3 Feb 2020 15:30:42 -0800 Subject: Add 1 Kokoro job per runtime test. PiperOrigin-RevId: 293019326 --- kokoro/runtime_tests/go1.12.cfg | 6 ++++++ kokoro/runtime_tests/java11.cfg | 6 ++++++ kokoro/runtime_tests/nodejs12.4.0.cfg | 6 ++++++ kokoro/runtime_tests/php7.3.6.cfg | 6 ++++++ kokoro/runtime_tests/python3.7.3.cfg | 6 ++++++ kokoro/runtime_tests/runtime_tests.sh | 25 +++++++++++++++++++++++++ 6 files changed, 55 insertions(+) create mode 100644 kokoro/runtime_tests/go1.12.cfg create mode 100644 kokoro/runtime_tests/java11.cfg create mode 100644 kokoro/runtime_tests/nodejs12.4.0.cfg create mode 100644 kokoro/runtime_tests/php7.3.6.cfg create mode 100644 kokoro/runtime_tests/python3.7.3.cfg create mode 100755 kokoro/runtime_tests/runtime_tests.sh (limited to 'kokoro/runtime_tests') diff --git a/kokoro/runtime_tests/go1.12.cfg b/kokoro/runtime_tests/go1.12.cfg new file mode 100644 index 000000000..024740ab2 --- /dev/null +++ b/kokoro/runtime_tests/go1.12.cfg @@ -0,0 +1,6 @@ +build_file: "github/kokoro/runtime_tests/runtime_tests.sh" + +env_vars { + key: "RUNTIME_TEST_NAME" + value: "go1.12" +} \ No newline at end of file diff --git a/kokoro/runtime_tests/java11.cfg b/kokoro/runtime_tests/java11.cfg new file mode 100644 index 000000000..f01d26153 --- /dev/null +++ b/kokoro/runtime_tests/java11.cfg @@ -0,0 +1,6 @@ +build_file: "github/kokoro/runtime_tests/runtime_tests.sh" + +env_vars { + key: "RUNTIME_TEST_NAME" + value: "java11" +} \ No newline at end of file diff --git a/kokoro/runtime_tests/nodejs12.4.0.cfg b/kokoro/runtime_tests/nodejs12.4.0.cfg new file mode 100644 index 000000000..d4861fb07 --- /dev/null +++ b/kokoro/runtime_tests/nodejs12.4.0.cfg @@ -0,0 +1,6 @@ +build_file: "github/kokoro/runtime_tests/runtime_tests.sh" + +env_vars { + key: "RUNTIME_TEST_NAME" + value: "nodejs12.4.0" +} \ No newline at end of file diff --git a/kokoro/runtime_tests/php7.3.6.cfg b/kokoro/runtime_tests/php7.3.6.cfg new file mode 100644 index 000000000..b737ed9cb --- /dev/null +++ b/kokoro/runtime_tests/php7.3.6.cfg @@ -0,0 +1,6 @@ +build_file: "github/kokoro/runtime_tests/runtime_tests.sh" + +env_vars { + key: "RUNTIME_TEST_NAME" + value: "php7.3.6" +} \ No newline at end of file diff --git a/kokoro/runtime_tests/python3.7.3.cfg b/kokoro/runtime_tests/python3.7.3.cfg new file mode 100644 index 000000000..971fcba05 --- /dev/null +++ b/kokoro/runtime_tests/python3.7.3.cfg @@ -0,0 +1,6 @@ +build_file: "github/kokoro/runtime_tests/runtime_tests.sh" + +env_vars { + key: "RUNTIME_TEST_NAME" + value: "python3.7.3" +} \ No newline at end of file diff --git a/kokoro/runtime_tests/runtime_tests.sh b/kokoro/runtime_tests/runtime_tests.sh new file mode 100755 index 000000000..9ee991e42 --- /dev/null +++ b/kokoro/runtime_tests/runtime_tests.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +# Copyright 2019 The gVisor Authors. +# +# 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. + +source $(dirname $0)/common.sh + +if [ ! -v RUNTIME_TEST_NAME ]; then + echo 'Must set $RUNTIME_TEST_NAME' >&2 + exit 1 +fi + +install_runsc_for_test runtimes +test_runsc "//test/runtimes:${RUNTIME_TEST_NAME}_test" -- cgit v1.2.3 From bc504d52026790b7deed6506371ebc6d5d17c948 Mon Sep 17 00:00:00 2001 From: Brad Burlage Date: Mon, 10 Feb 2020 13:06:57 -0800 Subject: Fix build_file in runtimes_tests. PiperOrigin-RevId: 294286242 --- kokoro/runtime_tests/go1.12.cfg | 4 ++-- kokoro/runtime_tests/java11.cfg | 4 ++-- kokoro/runtime_tests/nodejs12.4.0.cfg | 4 ++-- kokoro/runtime_tests/php7.3.6.cfg | 4 ++-- kokoro/runtime_tests/python3.7.3.cfg | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) (limited to 'kokoro/runtime_tests') diff --git a/kokoro/runtime_tests/go1.12.cfg b/kokoro/runtime_tests/go1.12.cfg index 024740ab2..164ddc18f 100644 --- a/kokoro/runtime_tests/go1.12.cfg +++ b/kokoro/runtime_tests/go1.12.cfg @@ -1,6 +1,6 @@ -build_file: "github/kokoro/runtime_tests/runtime_tests.sh" +build_file: "github/github/kokoro/runtime_tests/runtime_tests.sh" env_vars { key: "RUNTIME_TEST_NAME" value: "go1.12" -} \ No newline at end of file +} diff --git a/kokoro/runtime_tests/java11.cfg b/kokoro/runtime_tests/java11.cfg index f01d26153..4957d4794 100644 --- a/kokoro/runtime_tests/java11.cfg +++ b/kokoro/runtime_tests/java11.cfg @@ -1,6 +1,6 @@ -build_file: "github/kokoro/runtime_tests/runtime_tests.sh" +build_file: "github/github/kokoro/runtime_tests/runtime_tests.sh" env_vars { key: "RUNTIME_TEST_NAME" value: "java11" -} \ No newline at end of file +} diff --git a/kokoro/runtime_tests/nodejs12.4.0.cfg b/kokoro/runtime_tests/nodejs12.4.0.cfg index d4861fb07..1df343f95 100644 --- a/kokoro/runtime_tests/nodejs12.4.0.cfg +++ b/kokoro/runtime_tests/nodejs12.4.0.cfg @@ -1,6 +1,6 @@ -build_file: "github/kokoro/runtime_tests/runtime_tests.sh" +build_file: "github/github/kokoro/runtime_tests/runtime_tests.sh" env_vars { key: "RUNTIME_TEST_NAME" value: "nodejs12.4.0" -} \ No newline at end of file +} diff --git a/kokoro/runtime_tests/php7.3.6.cfg b/kokoro/runtime_tests/php7.3.6.cfg index b737ed9cb..8e3667125 100644 --- a/kokoro/runtime_tests/php7.3.6.cfg +++ b/kokoro/runtime_tests/php7.3.6.cfg @@ -1,6 +1,6 @@ -build_file: "github/kokoro/runtime_tests/runtime_tests.sh" +build_file: "github/github/kokoro/runtime_tests/runtime_tests.sh" env_vars { key: "RUNTIME_TEST_NAME" value: "php7.3.6" -} \ No newline at end of file +} diff --git a/kokoro/runtime_tests/python3.7.3.cfg b/kokoro/runtime_tests/python3.7.3.cfg index 971fcba05..0ca70d5bb 100644 --- a/kokoro/runtime_tests/python3.7.3.cfg +++ b/kokoro/runtime_tests/python3.7.3.cfg @@ -1,6 +1,6 @@ -build_file: "github/kokoro/runtime_tests/runtime_tests.sh" +build_file: "github/github/kokoro/runtime_tests/runtime_tests.sh" env_vars { key: "RUNTIME_TEST_NAME" value: "python3.7.3" -} \ No newline at end of file +} -- cgit v1.2.3 From cf1e50a80976fae95eef4ab05d961200b04e2346 Mon Sep 17 00:00:00 2001 From: gVisor bot Date: Wed, 12 Feb 2020 16:26:08 -0800 Subject: Minor runtime test fixes. * Allow scripts/common.sh to be sourced from outside the scripts/ directory * Fix passing empty args to Bazel, which causes the tool to exit with a failure even if the command succeeds. PiperOrigin-RevId: 294785456 --- kokoro/runtime_tests/runtime_tests.sh | 6 +++++- scripts/common.sh | 12 +++++++++++- scripts/common_build.sh | 27 ++++++++++++++++----------- 3 files changed, 32 insertions(+), 13 deletions(-) (limited to 'kokoro/runtime_tests') diff --git a/kokoro/runtime_tests/runtime_tests.sh b/kokoro/runtime_tests/runtime_tests.sh index 9ee991e42..73a58f806 100755 --- a/kokoro/runtime_tests/runtime_tests.sh +++ b/kokoro/runtime_tests/runtime_tests.sh @@ -14,7 +14,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -source $(dirname $0)/common.sh +# Run in the root of the repo. +cd "$(dirname "$0")" +cd "$(git rev-parse --show-toplevel)" + +source scripts/common.sh if [ ! -v RUNTIME_TEST_NAME ]; then echo 'Must set $RUNTIME_TEST_NAME' >&2 diff --git a/scripts/common.sh b/scripts/common.sh index cd91b9f8e..3ca699e4a 100755 --- a/scripts/common.sh +++ b/scripts/common.sh @@ -16,7 +16,17 @@ set -xeou pipefail -source $(dirname $0)/common_build.sh +# Get the path to the directory this script lives in. +# If this script is being called with `source`, $0 will be the path of the +# *sourcing* script, so we can't use `dirname $0` to find scripts in this +# directory. +if [[ -v BASH_SOURCE && "$0" != "$BASH_SOURCE" ]]; then + declare -r script_dir="$(dirname "$BASH_SOURCE")" +else + declare -r script_dir="$(dirname "$0")" +fi + +source "${script_dir}/common_build.sh" # Ensure it attempts to collect logs in all cases. trap collect_logs EXIT diff --git a/scripts/common_build.sh b/scripts/common_build.sh index 2c2a826c7..ae8b67383 100755 --- a/scripts/common_build.sh +++ b/scripts/common_build.sh @@ -14,8 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -# Install the latest version of Bazel and log the version. -(which use_bazel.sh && use_bazel.sh latest) || which bazel +which bazel bazel version # Switch into the workspace; only necessary if run with kokoro. @@ -26,27 +25,30 @@ elif [[ -v KOKORO_GIT_COMMIT ]] && [[ -d github/repo ]]; then fi # Set the standard bazel flags. -declare -r BAZEL_FLAGS=( +declare -a BAZEL_FLAGS=( "--show_timestamps" "--test_output=errors" "--keep_going" "--verbose_failures=true" ) -BAZEL_RBE_AUTH_FLAGS="" -BAZEL_RBE_FLAGS="" if [[ -v KOKORO_BAZEL_AUTH_CREDENTIAL ]]; then - declare -r BAZEL_RBE_AUTH_FLAGS="--auth_credentials=${KOKORO_BAZEL_AUTH_CREDENTIAL}" - declare -r BAZEL_RBE_FLAGS="--config=remote" + BAZEL_FLAGS+=( + "--auth_credentials=${KOKORO_BAZEL_AUTH_CREDENTIAL}" + "--config=remote" + ) fi +declare -r BAZEL_FLAGS # Wrap bazel. function build() { - bazel build "${BAZEL_RBE_FLAGS}" "${BAZEL_RBE_AUTH_FLAGS}" "${BAZEL_FLAGS[@]}" "$@" 2>&1 | - tee /dev/fd/2 | grep -E '^ bazel-bin/' | awk '{ print $1; }' + bazel build "${BAZEL_FLAGS[@]}" "$@" 2>&1 \ + | tee /dev/fd/2 \ + | grep -E '^ bazel-bin/' \ + | awk '{ print $1; }' } function test() { - bazel test "${BAZEL_RBE_FLAGS}" "${BAZEL_RBE_AUTH_FLAGS}" "${BAZEL_FLAGS[@]}" "$@" + bazel test "${BAZEL_FLAGS[@]}" "$@" } function run() { @@ -95,5 +97,8 @@ function collect_logs() { } function find_branch_name() { - git branch --show-current || git rev-parse HEAD || bazel info workspace | xargs basename + git branch --show-current \ + || git rev-parse HEAD \ + || bazel info workspace \ + | xargs basename } -- cgit v1.2.3 From ededa90d07e4df3eb3fe8a52a0afbcdaf82e8df5 Mon Sep 17 00:00:00 2001 From: Brad Burlage Date: Mon, 24 Feb 2020 14:21:18 -0800 Subject: Internal change. PiperOrigin-RevId: 296972565 --- kokoro/runtime_tests/go1.12.cfg | 10 ++++++++++ kokoro/runtime_tests/java11.cfg | 10 ++++++++++ kokoro/runtime_tests/nodejs12.4.0.cfg | 10 ++++++++++ kokoro/runtime_tests/php7.3.6.cfg | 10 ++++++++++ kokoro/runtime_tests/python3.7.3.cfg | 10 ++++++++++ scripts/common_build.sh | 12 ++++++++++-- 6 files changed, 60 insertions(+), 2 deletions(-) (limited to 'kokoro/runtime_tests') diff --git a/kokoro/runtime_tests/go1.12.cfg b/kokoro/runtime_tests/go1.12.cfg index 164ddc18f..fd4911e88 100644 --- a/kokoro/runtime_tests/go1.12.cfg +++ b/kokoro/runtime_tests/go1.12.cfg @@ -4,3 +4,13 @@ env_vars { key: "RUNTIME_TEST_NAME" value: "go1.12" } + +action { + define_artifacts { + regex: "**/sponge_log.xml" + regex: "**/sponge_log.log" + regex: "**/outputs.zip" + regex: "**/runsc" + regex: "**/runsc.*" + } +} \ No newline at end of file diff --git a/kokoro/runtime_tests/java11.cfg b/kokoro/runtime_tests/java11.cfg index 4957d4794..7f8611a08 100644 --- a/kokoro/runtime_tests/java11.cfg +++ b/kokoro/runtime_tests/java11.cfg @@ -4,3 +4,13 @@ env_vars { key: "RUNTIME_TEST_NAME" value: "java11" } + +action { + define_artifacts { + regex: "**/sponge_log.xml" + regex: "**/sponge_log.log" + regex: "**/outputs.zip" + regex: "**/runsc" + regex: "**/runsc.*" + } +} \ No newline at end of file diff --git a/kokoro/runtime_tests/nodejs12.4.0.cfg b/kokoro/runtime_tests/nodejs12.4.0.cfg index 1df343f95..c67ad5567 100644 --- a/kokoro/runtime_tests/nodejs12.4.0.cfg +++ b/kokoro/runtime_tests/nodejs12.4.0.cfg @@ -4,3 +4,13 @@ env_vars { key: "RUNTIME_TEST_NAME" value: "nodejs12.4.0" } + +action { + define_artifacts { + regex: "**/sponge_log.xml" + regex: "**/sponge_log.log" + regex: "**/outputs.zip" + regex: "**/runsc" + regex: "**/runsc.*" + } +} \ No newline at end of file diff --git a/kokoro/runtime_tests/php7.3.6.cfg b/kokoro/runtime_tests/php7.3.6.cfg index 8e3667125..f266c5e26 100644 --- a/kokoro/runtime_tests/php7.3.6.cfg +++ b/kokoro/runtime_tests/php7.3.6.cfg @@ -4,3 +4,13 @@ env_vars { key: "RUNTIME_TEST_NAME" value: "php7.3.6" } + +action { + define_artifacts { + regex: "**/sponge_log.xml" + regex: "**/sponge_log.log" + regex: "**/outputs.zip" + regex: "**/runsc" + regex: "**/runsc.*" + } +} \ No newline at end of file diff --git a/kokoro/runtime_tests/python3.7.3.cfg b/kokoro/runtime_tests/python3.7.3.cfg index 0ca70d5bb..574add152 100644 --- a/kokoro/runtime_tests/python3.7.3.cfg +++ b/kokoro/runtime_tests/python3.7.3.cfg @@ -4,3 +4,13 @@ env_vars { key: "RUNTIME_TEST_NAME" value: "python3.7.3" } + +action { + define_artifacts { + regex: "**/sponge_log.xml" + regex: "**/sponge_log.log" + regex: "**/outputs.zip" + regex: "**/runsc" + regex: "**/runsc.*" + } +} \ No newline at end of file diff --git a/scripts/common_build.sh b/scripts/common_build.sh index ae8b67383..3be0bb21c 100755 --- a/scripts/common_build.sh +++ b/scripts/common_build.sh @@ -70,7 +70,9 @@ function collect_logs() { for d in `find -L "bazel-testlogs" -name 'shard_*_of_*' | xargs dirname | sort | uniq`; do junitparser merge `find $d -name test.xml` $d/test.xml cat $d/shard_*_of_*/test.log > $d/test.log - ls -l $d/shard_*_of_*/test.outputs/outputs.zip && zip -r -1 $d/outputs.zip $d/shard_*_of_*/test.outputs/outputs.zip + if ls -l $d/shard_*_of_*/test.outputs/outputs.zip 2>/dev/null; then + zip -r -1 "$d/outputs.zip" $d/shard_*_of_*/test.outputs/outputs.zip + fi done find -L "bazel-testlogs" -name 'shard_*_of_*' | xargs rm -rf # Move test logs to Kokoro directory. tar is used to conveniently perform @@ -90,7 +92,13 @@ function collect_logs() { echo " gsutil cp gs://gvisor/logs/${KOKORO_BUILD_ARTIFACTS_SUBDIR}/${archive} /tmp" echo " https://storage.cloud.google.com/gvisor/logs/${KOKORO_BUILD_ARTIFACTS_SUBDIR}/${archive}" fi - tar --create --gzip --file="${KOKORO_ARTIFACTS_DIR}/${archive}" -C "${RUNSC_LOGS_DIR}" . + time tar \ + --verbose \ + --create \ + --gzip \ + --file="${KOKORO_ARTIFACTS_DIR}/${archive}" \ + --directory "${RUNSC_LOGS_DIR}" \ + . fi fi fi -- cgit v1.2.3