internal: report error in any module
Fixes #1802
Change-Id: I89ccca8e994493246183cfb3ccbf77f4bc6bd459
Reviewed-on: https://code-review.googlesource.com/c/gocloud/+/52510
Reviewed-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Tyler Bui-Palsulich <tbp@google.com>
diff --git a/internal/kokoro/continuous.sh b/internal/kokoro/continuous.sh
index 1304176..17cb37c 100755
--- a/internal/kokoro/continuous.sh
+++ b/internal/kokoro/continuous.sh
@@ -60,8 +60,6 @@
# Takes the kokoro output log (raw stdout) and creates a machine-parseable xml
# file (xUnit). Then it exits with whatever exit code the last command had.
create_junit_xml() {
- last_status_code=$?
-
cat $KOKORO_ARTIFACTS_DIR/$KOKORO_GERRIT_CHANGE_NUMBER.txt \
| go-junit-report > $KOKORO_ARTIFACTS_DIR/tests/sponge_log.xml
@@ -69,16 +67,18 @@
chmod +x $KOKORO_GFILE_DIR/linux_amd64/buildcop
$KOKORO_GFILE_DIR/linux_amd64/buildcop -logs_dir=$KOKORO_ARTIFACTS_DIR
fi
-
- exit $last_status_code
}
trap create_junit_xml EXIT ERR
+exit_code=0
# Run tests and tee output to log file, to be pushed to GCS as artifact.
for i in `find . -name go.mod`; do
pushd `dirname $i`;
go test -race -v -timeout 30m ./... 2>&1 \
| tee -a $KOKORO_ARTIFACTS_DIR/$KOKORO_GERRIT_CHANGE_NUMBER.txt
+ exit_code=$(($exit_code + $?))
popd;
done
+
+exit $exit_code
diff --git a/internal/kokoro/presubmit.sh b/internal/kokoro/presubmit.sh
index 9a59e18..73c7bd4 100755
--- a/internal/kokoro/presubmit.sh
+++ b/internal/kokoro/presubmit.sh
@@ -51,20 +51,20 @@
# Takes the kokoro output log (raw stdout) and creates a machine-parseable xml
# file (xUnit). Then it exits with whatever exit code the last command had.
create_junit_xml() {
- last_status_code=$?
-
cat $KOKORO_ARTIFACTS_DIR/$KOKORO_GERRIT_CHANGE_NUMBER.txt \
| go-junit-report > $KOKORO_ARTIFACTS_DIR/tests/sponge_log.xml
-
- exit $last_status_code
}
trap create_junit_xml EXIT ERR
+exit_code=0
# Run tests and tee output to log file, to be pushed to GCS as artifact.
for i in `find . -name go.mod`; do
pushd `dirname $i`;
go test -race -v -timeout 15m -short ./... 2>&1 \
| tee -a $KOKORO_ARTIFACTS_DIR/$KOKORO_GERRIT_CHANGE_NUMBER.txt
+ exit_code=$(($exit_code + $?))
popd;
done
+
+exit $exit_code