Skip to content

Commit

Permalink
Fix test name of test[suit|case] in the generated test.xml.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 365972959
  • Loading branch information
coeuvre committed Jul 15, 2021
1 parent ef67b67 commit 1ff0375
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
18 changes: 18 additions & 0 deletions src/test/shell/bazel/bazel_test_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -852,4 +852,22 @@ EOF
expect_log "<testcase name=\"a/x\""
}

function test_xml_output_format() {
touch WORKSPACE
cat <<'EOF' > BUILD
py_test(
name = 'x',
srcs = ['x.py'],
)
EOF
touch x.py

bazel test //:x &> $TEST_log \
|| fail "expected success"

cat bazel-testlogs/x/test.xml > $TEST_log
expect_log "<testsuite name=\"x\""
expect_log "<testcase name=\"x\""
}

run_suite "bazel test tests"
2 changes: 1 addition & 1 deletion tools/test/generate-xml.sh
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ if [ "$TEST_LOG" == "-" ]; then
fi

test_name="${TEST_BINARY#./}"
test_name="${TEST_BINARY#../}"
test_name="${test_name#../}"
errors=0
error_msg=""
if (( $EXIT_CODE != 0 )); then
Expand Down

0 comments on commit 1ff0375

Please sign in to comment.