Add shell function to create a Bazel test summary XML file.
Bazel normally generates one of these per target, which causes signficant overhead on upload. Instead we create a single XML file for the status of each target. PiperOrigin-RevId: 310229087 Change-Id: I77f614e0d32222eeacf62c34f1cbeec07ed3d73a
This commit is contained in:
parent
3798e8de1a
commit
0c96f9772d
@ -268,3 +268,46 @@ function copy_to_new_project_name {
|
||||
popd
|
||||
rm -rf "${TMP_DIR}"
|
||||
}
|
||||
|
||||
# Create minimalist test XML for web view. It includes the pass/fail status
|
||||
# of each target, without including errors or stacktraces.
|
||||
# Remember to "set +e" before calling bazel or we'll only generate the XML for
|
||||
# passing runs.
|
||||
function test_xml_summary {
|
||||
set +x
|
||||
set +e
|
||||
mkdir -p "${KOKORO_ARTIFACTS_DIR}/${KOKORO_JOB_NAME}/summary"
|
||||
# First build the repeated inner XML blocks, since the header block needs to
|
||||
# report the number of test cases / failures / errors.
|
||||
# TODO(rsopher): handle build breakages
|
||||
# TODO(rsopher): extract per-test times as well
|
||||
TESTCASE_XML="$(sed -n '/INFO:\ Build\ completed/,/INFO:\ Build\ completed/p' \
|
||||
/tmpfs/kokoro_build.log \
|
||||
| grep -E '(PASSED|FAILED|TIMEOUT)\ in' \
|
||||
| while read -r line; \
|
||||
do echo '<testcase name="'"$(echo "${line}" | tr -s ' ' | cut -d ' ' -f 1)"\
|
||||
'" status="run" classname="" time="0">'"$( \
|
||||
case "$(echo "${line}" | tr -s ' ' | cut -d ' ' -f 2)" in \
|
||||
FAILED) echo '<failure message="" type=""/>' ;; \
|
||||
TIMEOUT) echo '<failure message="timeout" type=""/>' ;; \
|
||||
esac; \
|
||||
)"'</testcase>'; done; \
|
||||
)"
|
||||
NUMBER_OF_TESTS="$(echo "${TESTCASE_XML}" | wc -l)"
|
||||
NUMBER_OF_FAILURES="$(echo "${TESTCASE_XML}" | grep -c '<failure')"
|
||||
echo '<?xml version="1.0" encoding="UTF-8"?>'\
|
||||
'<testsuites name="1" tests="1" failures="0" errors="0" time="0">'\
|
||||
'<testsuite name="Kokoro Summary" tests="'"${NUMBER_OF_TESTS}"\
|
||||
'" failures="'"${NUMBER_OF_FAILURES}"'" errors="0" time="0">'\
|
||||
"${TESTCASE_XML}"'</testsuite></testsuites>'\
|
||||
> "${KOKORO_ARTIFACTS_DIR}/${KOKORO_JOB_NAME}/summary/sponge_log.xml"
|
||||
}
|
||||
|
||||
# Create minimalist test XML for web view, then exit.
|
||||
# Ends script with value of previous command, meant to be called immediately
|
||||
# after bazel as the last call in the build script.
|
||||
function test_xml_summary_exit {
|
||||
RETVAL=$?
|
||||
test_xml_summary
|
||||
exit "${RETVAL}"
|
||||
}
|
||||
|
@ -41,9 +41,11 @@ source tensorflow/tools/ci_build/build_scripts/PRESUBMIT_BUILD_TARGETS.sh
|
||||
tag_filters="-no_oss,-oss_serial,-nomac,-no_mac,-no_oss_py2,-v1only,-gpu,-tpu,-benchmark-test"
|
||||
|
||||
# Run tests
|
||||
set +e
|
||||
bazel test --test_output=errors --config=opt \
|
||||
--action_env=TF2_BEHAVIOR="${TF2_BEHAVIOR}" \
|
||||
--build_tag_filters="${tag_filters}" \
|
||||
--test_tag_filters="${tag_filters}" -- \
|
||||
${DEFAULT_BAZEL_TARGETS} \
|
||||
-//tensorflow/lite/...
|
||||
test_xml_summary_exit
|
@ -41,9 +41,11 @@ tag_filters="-no_oss,-oss_serial,-nomac,-no_mac,-no_oss_py35,-v1only,-gpu,-tpu,-
|
||||
source tensorflow/tools/ci_build/build_scripts/PRESUBMIT_BUILD_TARGETS.sh
|
||||
|
||||
# Run tests
|
||||
set +e
|
||||
bazel test --test_output=errors --config=opt \
|
||||
--action_env=TF2_BEHAVIOR="${TF2_BEHAVIOR}" \
|
||||
--build_tag_filters="${tag_filters}" \
|
||||
--test_tag_filters="${tag_filters}" -- \
|
||||
${DEFAULT_BAZEL_TARGETS} \
|
||||
-//tensorflow/lite/...
|
||||
test_xml_summary_exit
|
||||
|
@ -41,10 +41,11 @@ tag_filters="-no_oss,-oss_serial,-nomac,-no_mac,-no_oss_py36,-v1only,-gpu,-tpu,-
|
||||
source tensorflow/tools/ci_build/build_scripts/PRESUBMIT_BUILD_TARGETS.sh
|
||||
|
||||
# Run tests
|
||||
set +e
|
||||
bazel test --test_output=errors --config=opt \
|
||||
--action_env=TF2_BEHAVIOR="${TF2_BEHAVIOR}" \
|
||||
--build_tag_filters="${tag_filters}" \
|
||||
--test_tag_filters="${tag_filters}" -- \
|
||||
${DEFAULT_BAZEL_TARGETS} \
|
||||
-//tensorflow/lite/...
|
||||
|
||||
test_xml_summary_exit
|
||||
|
@ -41,9 +41,11 @@ tag_filters="-no_oss,-oss_serial,-nomac,-no_mac$(maybe_skip_v1),-gpu,-tpu,-bench
|
||||
source tensorflow/tools/ci_build/build_scripts/PRESUBMIT_BUILD_TARGETS.sh
|
||||
|
||||
# Run tests
|
||||
set +e
|
||||
bazel test --test_output=errors --config=opt \
|
||||
--action_env=TF2_BEHAVIOR="${TF2_BEHAVIOR}" \
|
||||
--build_tag_filters="${tag_filters}" \
|
||||
--test_tag_filters="${tag_filters}" -- \
|
||||
${DEFAULT_BAZEL_TARGETS} \
|
||||
-//tensorflow/lite/...
|
||||
test_xml_summary_exit
|
||||
|
@ -41,9 +41,11 @@ tag_filters="-no_oss,-oss_serial,-nomac,-no_mac$(maybe_skip_v1),-gpu,-tpu,-bench
|
||||
source tensorflow/tools/ci_build/build_scripts/PRESUBMIT_BUILD_TARGETS.sh
|
||||
|
||||
# Run tests
|
||||
set +e
|
||||
bazel test --test_output=errors --config=opt \
|
||||
--action_env=TF2_BEHAVIOR="${TF2_BEHAVIOR}" \
|
||||
--build_tag_filters="${tag_filters}" \
|
||||
--test_tag_filters="${tag_filters}" -- \
|
||||
${DEFAULT_BAZEL_TARGETS} \
|
||||
-//tensorflow/lite/...
|
||||
test_xml_summary_exit
|
||||
|
@ -38,6 +38,7 @@ tag_filters="-no_oss,-oss_serial,-gpu,-tpu,-benchmark-test,-no_oss_py2,-v1only"
|
||||
source tensorflow/tools/ci_build/build_scripts/PRESUBMIT_BUILD_TARGETS.sh
|
||||
|
||||
# Run tests
|
||||
set +e
|
||||
bazel test --test_output=errors --config=opt --test_lang_filters=py \
|
||||
--crosstool_top=//third_party/toolchains/preconfig/ubuntu16.04/gcc7_manylinux2010-nvcc-cuda10.1:toolchain \
|
||||
--linkopt=-lrt \
|
||||
@ -45,3 +46,4 @@ bazel test --test_output=errors --config=opt --test_lang_filters=py \
|
||||
--build_tag_filters="${tag_filters}" \
|
||||
--test_tag_filters="${tag_filters}" -- \
|
||||
${DEFAULT_BAZEL_TARGETS} -//tensorflow/lite/...
|
||||
test_xml_summary_exit
|
||||
|
@ -37,6 +37,7 @@ tag_filters="-no_oss,-oss_serial,-gpu,-tpu,-benchmark-test,-no_oss_py35,-v1only"
|
||||
source tensorflow/tools/ci_build/build_scripts/PRESUBMIT_BUILD_TARGETS.sh
|
||||
|
||||
# Run tests
|
||||
set +e
|
||||
bazel test --test_output=errors --config=opt --test_lang_filters=py \
|
||||
--crosstool_top=//third_party/toolchains/preconfig/ubuntu16.04/gcc7_manylinux2010-nvcc-cuda10.1:toolchain \
|
||||
--linkopt=-lrt \
|
||||
@ -44,3 +45,4 @@ bazel test --test_output=errors --config=opt --test_lang_filters=py \
|
||||
--build_tag_filters="${tag_filters}" \
|
||||
--test_tag_filters="${tag_filters}" -- \
|
||||
${DEFAULT_BAZEL_TARGETS} -//tensorflow/lite/...
|
||||
test_xml_summary_exit
|
||||
|
@ -37,6 +37,7 @@ tag_filters="-no_oss,-oss_serial,-gpu,-tpu,-benchmark-test,-no_oss_py36,-v1only"
|
||||
source tensorflow/tools/ci_build/build_scripts/PRESUBMIT_BUILD_TARGETS.sh
|
||||
|
||||
# Run tests
|
||||
set +e
|
||||
bazel test --test_output=errors --config=opt --test_lang_filters=py \
|
||||
--crosstool_top=//third_party/toolchains/preconfig/ubuntu16.04/gcc7_manylinux2010-nvcc-cuda10.1:toolchain \
|
||||
--linkopt=-lrt \
|
||||
@ -44,3 +45,4 @@ bazel test --test_output=errors --config=opt --test_lang_filters=py \
|
||||
--build_tag_filters="${tag_filters}" \
|
||||
--test_tag_filters="${tag_filters}" -- \
|
||||
${DEFAULT_BAZEL_TARGETS} -//tensorflow/lite/...
|
||||
test_xml_summary_exit
|
||||
|
@ -37,6 +37,7 @@ tag_filters="-no_oss,-oss_serial,-gpu,-tpu,-benchmark-test,-no_oss_py37,-v1only"
|
||||
source tensorflow/tools/ci_build/build_scripts/PRESUBMIT_BUILD_TARGETS.sh
|
||||
|
||||
# Run tests
|
||||
set +e
|
||||
bazel test --test_output=errors --config=opt --test_lang_filters=py \
|
||||
--crosstool_top=//third_party/toolchains/preconfig/ubuntu16.04/gcc7_manylinux2010-nvcc-cuda10.1:toolchain \
|
||||
--linkopt=-lrt \
|
||||
@ -44,3 +45,4 @@ bazel test --test_output=errors --config=opt --test_lang_filters=py \
|
||||
--build_tag_filters="${tag_filters}" \
|
||||
--test_tag_filters="${tag_filters}" -- \
|
||||
${DEFAULT_BAZEL_TARGETS} -//tensorflow/lite/...
|
||||
test_xml_summary_exit
|
||||
|
@ -37,6 +37,7 @@ tag_filters="-no_oss,-oss_serial,-gpu,-tpu,-benchmark-test,-no_oss_py38,-v1only"
|
||||
source tensorflow/tools/ci_build/build_scripts/PRESUBMIT_BUILD_TARGETS.sh
|
||||
|
||||
# Run tests
|
||||
set +e
|
||||
bazel test --test_output=errors --config=opt --test_lang_filters=py \
|
||||
--crosstool_top=//third_party/toolchains/preconfig/ubuntu16.04/gcc7_manylinux2010-nvcc-cuda10.1:toolchain \
|
||||
--linkopt=-lrt \
|
||||
@ -44,3 +45,4 @@ bazel test --test_output=errors --config=opt --test_lang_filters=py \
|
||||
--build_tag_filters="${tag_filters}" \
|
||||
--test_tag_filters="${tag_filters}" -- \
|
||||
${DEFAULT_BAZEL_TARGETS} -//tensorflow/lite/...
|
||||
test_xml_summary_exit
|
||||
|
@ -45,6 +45,7 @@ source tensorflow/tools/ci_build/build_scripts/PRESUBMIT_BUILD_TARGETS.sh
|
||||
|
||||
tag_filters="gpu,requires-gpu,-no_gpu,-no_oss,-oss_serial,-no_oss_py2"
|
||||
|
||||
set +e
|
||||
bazel test --config=cuda --config=opt \
|
||||
--crosstool_top=//third_party/toolchains/preconfig/ubuntu16.04/gcc7_manylinux2010-nvcc-cuda10.1:toolchain \
|
||||
--linkopt=-lrt \
|
||||
@ -56,3 +57,4 @@ bazel test --config=cuda --config=opt \
|
||||
--test_output=errors --verbose_failures=true --keep_going \
|
||||
--run_under=//tensorflow/tools/ci_build/gpu_build:parallel_gpu_execute \
|
||||
-- ${DEFAULT_BAZEL_TARGETS} -//tensorflow/lite/...
|
||||
test_xml_summary_exit
|
||||
|
@ -45,6 +45,7 @@ source tensorflow/tools/ci_build/build_scripts/PRESUBMIT_BUILD_TARGETS.sh
|
||||
|
||||
tag_filters="gpu,requires-gpu,-no_gpu,-no_oss,-oss_serial,-no_oss_py35"
|
||||
|
||||
set +e
|
||||
bazel test --config=cuda --config=opt \
|
||||
--crosstool_top=//third_party/toolchains/preconfig/ubuntu16.04/gcc7_manylinux2010-nvcc-cuda10.1:toolchain \
|
||||
--linkopt=-lrt \
|
||||
@ -56,3 +57,4 @@ bazel test --config=cuda --config=opt \
|
||||
--test_output=errors --verbose_failures=true --keep_going \
|
||||
--run_under=//tensorflow/tools/ci_build/gpu_build:parallel_gpu_execute \
|
||||
-- ${DEFAULT_BAZEL_TARGETS} -//tensorflow/lite/...
|
||||
test_xml_summary_exit
|
||||
|
@ -45,6 +45,7 @@ source tensorflow/tools/ci_build/build_scripts/PRESUBMIT_BUILD_TARGETS.sh
|
||||
|
||||
tag_filters="gpu,requires-gpu,-no_gpu,-no_oss,-oss_serial,-no_oss_py36"
|
||||
|
||||
set +e
|
||||
bazel test --config=cuda --config=opt \
|
||||
--crosstool_top=//third_party/toolchains/preconfig/ubuntu16.04/gcc7_manylinux2010-nvcc-cuda10.1:toolchain \
|
||||
--linkopt=-lrt \
|
||||
@ -56,3 +57,4 @@ bazel test --config=cuda --config=opt \
|
||||
--test_output=errors --verbose_failures=true --keep_going \
|
||||
--run_under=//tensorflow/tools/ci_build/gpu_build:parallel_gpu_execute \
|
||||
-- ${DEFAULT_BAZEL_TARGETS} -//tensorflow/lite/...
|
||||
test_xml_summary_exit
|
||||
|
@ -45,6 +45,7 @@ source tensorflow/tools/ci_build/build_scripts/PRESUBMIT_BUILD_TARGETS.sh
|
||||
|
||||
tag_filters="gpu,requires-gpu,-no_gpu,-no_oss,-oss_serial,-no_oss_py37"
|
||||
|
||||
set +e
|
||||
bazel test --config=cuda --config=opt \
|
||||
--crosstool_top=//third_party/toolchains/preconfig/ubuntu16.04/gcc7_manylinux2010-nvcc-cuda10.1:toolchain \
|
||||
--linkopt=-lrt \
|
||||
@ -56,3 +57,4 @@ bazel test --config=cuda --config=opt \
|
||||
--test_output=errors --verbose_failures=true --keep_going \
|
||||
--run_under=//tensorflow/tools/ci_build/gpu_build:parallel_gpu_execute \
|
||||
-- ${DEFAULT_BAZEL_TARGETS} -//tensorflow/lite/...
|
||||
test_xml_summary_exit
|
||||
|
@ -45,6 +45,7 @@ source tensorflow/tools/ci_build/build_scripts/PRESUBMIT_BUILD_TARGETS.sh
|
||||
|
||||
tag_filters="gpu,requires-gpu,-no_gpu,-no_oss,-oss_serial,-no_oss_py38"
|
||||
|
||||
test +e
|
||||
bazel test --config=cuda --config=opt \
|
||||
--crosstool_top=//third_party/toolchains/preconfig/ubuntu16.04/gcc7_manylinux2010-nvcc-cuda10.1:toolchain \
|
||||
--linkopt=-lrt \
|
||||
@ -56,3 +57,4 @@ bazel test --config=cuda --config=opt \
|
||||
--test_output=errors --verbose_failures=true --keep_going \
|
||||
--run_under=//tensorflow/tools/ci_build/gpu_build:parallel_gpu_execute \
|
||||
-- ${DEFAULT_BAZEL_TARGETS} -//tensorflow/lite/...
|
||||
test_xml_summary_exit
|
||||
|
@ -61,4 +61,6 @@ test_args=(
|
||||
--local_test_jobs=1
|
||||
)
|
||||
|
||||
set +e
|
||||
bazel test "${bazel_args[@]}" "${test_args[@]}" -- "${test_patterns[@]}"
|
||||
test_xml_summary_exit
|
||||
|
Loading…
x
Reference in New Issue
Block a user