diff options
author | Andrei Vagin <avagin@google.com> | 2019-11-08 16:39:25 -0800 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2019-11-08 16:40:51 -0800 |
commit | b91ad8fa0950c752ab08af7d08727d5a97b14b12 (patch) | |
tree | f8dcbb50b4bfd45db8f1aaa42b3513734c490807 /scripts/common_bazel.sh | |
parent | 14f4461f93a4c0014314a35a374ce07eec25636c (diff) |
test: merge log files of all shards for each test suite
This significantly speeds up a process of uploading this files
to sponge and resultstore by kokoro.
PiperOrigin-RevId: 279416349
Diffstat (limited to 'scripts/common_bazel.sh')
-rwxr-xr-x | scripts/common_bazel.sh | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/scripts/common_bazel.sh b/scripts/common_bazel.sh index f8ec967b1..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" | |