From 4bb4b3d7553f74d68b38743dd6500ece1b1be2e7 Mon Sep 17 00:00:00 2001 From: Benjamin Peterson Date: Tue, 27 Jun 2017 11:37:07 +0200 Subject: 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 --- tools/test/test-setup.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'tools/test') 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 - $error_msg + $error_msg EOF -- cgit v1.2.3