aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/test
diff options
context:
space:
mode:
authorGravatar Benjamin Peterson <bp@benjamin.pe>2017-06-27 11:37:07 +0200
committerGravatar Marcel Hlopko <hlopko@google.com>2017-06-27 15:06:01 +0200
commit4bb4b3d7553f74d68b38743dd6500ece1b1be2e7 (patch)
treea418c5d33c88c38e95e5675ea66fdb346e3b2f6a /tools/test
parent69e74cd463c29ce7f3cbc36f392633b2617b3f80 (diff)
give the duration of test in the fallback xml file
A common extension to junitxml is to provide the duration of each test case in seconds. Here, we add the duration to the xml file that test-setup.sh provides if the test driver doesn't generate one. Change-Id: I25f94f10bb99db7078919f3e0bcdf7bd3cbb637d PiperOrigin-RevId: 160252993
Diffstat (limited to 'tools/test')
-rwxr-xr-xtools/test/test-setup.sh4
1 files changed, 3 insertions, 1 deletions
diff --git a/tools/test/test-setup.sh b/tools/test/test-setup.sh
index 308f658865..8ce2ea8dce 100755
--- a/tools/test/test-setup.sh
+++ b/tools/test/test-setup.sh
@@ -161,11 +161,13 @@ fi
[[ -n "$RUNTEST_PRESERVE_CWD" ]] && EXE="${TEST_NAME}"
exitCode=0
+start=$(date +%s)
if [ -z "$COVERAGE_DIR" ]; then
"${TEST_PATH}" "$@" || exitCode=$?
else
"$1" "$TEST_PATH" "${@:3}" || exitCode=$?
fi
+duration=$(expr $(date +%s) - $start)
if [ -n "${XML_OUTPUT_FILE-}" -a ! -f "${XML_OUTPUT_FILE-}" ]; then
@@ -181,7 +183,7 @@ if [ -n "${XML_OUTPUT_FILE-}" -a ! -f "${XML_OUTPUT_FILE-}" ]; then
<?xml version="1.0" encoding="UTF-8"?>
<testsuites>
<testsuite name="$TEST_NAME" tests="1" failures="0" errors="$errors">
- <testcase name="$TEST_NAME" status="run">$error_msg</testcase>
+ <testcase name="$TEST_NAME" status="run" duration="$duration">$error_msg</testcase>
</testsuite>
</testsuites>
EOF