summaryrefslogtreecommitdiffhomepage
path: root/scripts/common_bazel.sh
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/common_bazel.sh')
-rwxr-xr-xscripts/common_bazel.sh18
1 files changed, 16 insertions, 2 deletions
diff --git a/scripts/common_bazel.sh b/scripts/common_bazel.sh
index ea2291a4d..a82163297 100755
--- a/scripts/common_bazel.sh
+++ b/scripts/common_bazel.sh
@@ -71,6 +71,13 @@ function run_as_root() {
function collect_logs() {
# Zip out everything into a convenient form.
if [[ -v KOKORO_ARTIFACTS_DIR ]] && [[ -e bazel-testlogs ]]; then
+ # Merge results files of all shards for each test suite.
+ 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_*/outputs.zip && zip -r -1 $d/outputs.zip $d/shard_*_of_*/outputs.zip
+ done
+ find -L "bazel-testlogs" -name 'shard_*_of_*' | xargs rm -rf
# Move test logs to Kokoro directory. tar is used to conveniently perform
# renames while moving files.
find -L "bazel-testlogs" -name "test.xml" -o -name "test.log" -o -name "outputs.zip" |
@@ -79,9 +86,16 @@ function collect_logs() {
# Collect sentry logs, if any.
if [[ -v RUNSC_LOGS_DIR ]] && [[ -d "${RUNSC_LOGS_DIR}" ]]; then
- local -r logs=$(ls "${RUNSC_LOGS_DIR}")
+ # Check if the directory is empty or not (only the first line it needed).
+ local -r logs=$(ls "${RUNSC_LOGS_DIR}" | head -n1)
if [[ "${logs}" ]]; then
- tar --create --gzip --file="${KOKORO_ARTIFACTS_DIR}/${RUNTIME}.tar.gz" -C "${RUNSC_LOGS_DIR}" .
+ local -r archive=runsc_logs_"${RUNTIME}".tar.gz
+ if [[ -v KOKORO_BUILD_ARTIFACTS_SUBDIR ]]; then
+ echo "runsc logs will be uploaded to:"
+ 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}" .
fi
fi
fi