integration: improve package- and filename for junit.xml
Generate more unique names, based on architecture and test-suite name.
Clean up the path to this integration test to create a useful package name.
"$dir" can be either absolute (/go/src/github.com/docker/docker/integration/foo)
or relative (./integration/foo). To account for both, first we strip the
absolute path, then any leading periods and slashes.
For the package-name, we use periods as separator instead of slashes, to be more
in-line with Java package names (which is what junit.xml was originally designed
for).
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit f007b0150a
)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
48e8f18495
commit
5d4f5db76c
1 changed files with 16 additions and 4 deletions
|
@ -72,15 +72,27 @@ run_test_integration_suites() {
|
|||
for dir in ${integration_api_dirs}; do
|
||||
if ! (
|
||||
cd "$dir"
|
||||
echo "Running $PWD flags=${flags}"
|
||||
# Create a useful package name based on the tests's $dir. We need to take
|
||||
# into account that "$dir" can be either an absolute (/go/src/github.com/docker/docker/integration/foo)
|
||||
# or relative (./integration/foo) path. To account for both, first we strip
|
||||
# the absolute path, then remove any leading periods and slashes.
|
||||
pkgname="${dir}"
|
||||
pkgname="${pkgname#*${GOPATH}/src/${DOCKER_PKG}}"
|
||||
pkgname="${pkgname#*.}"
|
||||
pkgname="${pkgname#*\/}"
|
||||
|
||||
# Finally, we use periods as separator (instead of slashes) to be more
|
||||
# in line with Java package names (which is what junit.xml was designed for)
|
||||
pkgname="$(go env GOARCH).${pkgname//\//.}"
|
||||
echo "Running $PWD (${pkgname}) flags=${flags}"
|
||||
[ -n "$TESTDEBUG" ] && set -x
|
||||
# shellcheck disable=SC2086
|
||||
test_env gotestsum \
|
||||
--format=standard-verbose \
|
||||
--jsonfile="${ABS_DEST}/$(basename "$dir")-go-test-report.json" \
|
||||
--junitfile="${ABS_DEST}/$(basename "$dir")-junit-report.xml" \
|
||||
--jsonfile="${ABS_DEST}/${pkgname//./-}-go-test-report.json" \
|
||||
--junitfile="${ABS_DEST}/${pkgname//./-}-junit-report.xml" \
|
||||
--raw-command \
|
||||
-- go tool test2json -t ./test.main ${flags}
|
||||
-- go tool test2json -p "${pkgname}" -t ./test.main ${flags}
|
||||
); then exit 1; fi
|
||||
done
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue