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 f007b0150a1559ab3ba34cd81832c7c9b4e8f78f)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
| ... | ... |
@@ -72,15 +72,27 @@ run_test_integration_suites() {
|
| 72 | 72 |
for dir in ${integration_api_dirs}; do
|
| 73 | 73 |
if ! ( |
| 74 | 74 |
cd "$dir" |
| 75 |
- echo "Running $PWD flags=${flags}"
|
|
| 75 |
+ # Create a useful package name based on the tests's $dir. We need to take |
|
| 76 |
+ # into account that "$dir" can be either an absolute (/go/src/github.com/docker/docker/integration/foo) |
|
| 77 |
+ # or relative (./integration/foo) path. To account for both, first we strip |
|
| 78 |
+ # the absolute path, then remove any leading periods and slashes. |
|
| 79 |
+ pkgname="${dir}"
|
|
| 80 |
+ pkgname="${pkgname#*${GOPATH}/src/${DOCKER_PKG}}"
|
|
| 81 |
+ pkgname="${pkgname#*.}"
|
|
| 82 |
+ pkgname="${pkgname#*\/}"
|
|
| 83 |
+ |
|
| 84 |
+ # Finally, we use periods as separator (instead of slashes) to be more |
|
| 85 |
+ # in line with Java package names (which is what junit.xml was designed for) |
|
| 86 |
+ pkgname="$(go env GOARCH).${pkgname//\//.}"
|
|
| 87 |
+ echo "Running $PWD (${pkgname}) flags=${flags}"
|
|
| 76 | 88 |
[ -n "$TESTDEBUG" ] && set -x |
| 77 | 89 |
# shellcheck disable=SC2086 |
| 78 | 90 |
test_env gotestsum \ |
| 79 | 91 |
--format=standard-verbose \ |
| 80 |
- --jsonfile="${ABS_DEST}/$(basename "$dir")-go-test-report.json" \
|
|
| 81 |
- --junitfile="${ABS_DEST}/$(basename "$dir")-junit-report.xml" \
|
|
| 92 |
+ --jsonfile="${ABS_DEST}/${pkgname//./-}-go-test-report.json" \
|
|
| 93 |
+ --junitfile="${ABS_DEST}/${pkgname//./-}-junit-report.xml" \
|
|
| 82 | 94 |
--raw-command \ |
| 83 |
- -- go tool test2json -t ./test.main ${flags}
|
|
| 95 |
+ -- go tool test2json -p "${pkgname}" -t ./test.main ${flags}
|
|
| 84 | 96 |
); then exit 1; fi |
| 85 | 97 |
done |
| 86 | 98 |
} |