internal: continue running tests if one module fails

Updates #1786.

Change-Id: I7da7649525461b3838c52bf421e4fec5adb42a39
Reviewed-on: https://code-review.googlesource.com/c/gocloud/+/53411
Reviewed-by: Cody Oss <codyoss@google.com>
Reviewed-by: kokoro <noreply+kokoro@google.com>
diff --git a/internal/kokoro/continuous.sh b/internal/kokoro/continuous.sh
index 909f823..b28d810 100755
--- a/internal/kokoro/continuous.sh
+++ b/internal/kokoro/continuous.sh
@@ -53,16 +53,18 @@
 go install github.com/jstemmer/go-junit-report
 ./internal/kokoro/vet.sh
 
+set +e # Run all tests, don't stop after the first failure.
 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 sponge_log.log
-    # 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.
+    # Takes the kokoro output log (raw stdout) and creates a machine-parseable
+    # xUnit XML file.
     cat sponge_log.log \
       | go-junit-report -set-exit-code > sponge_log.xml
+    # Add the exit codes together so we exit non-zero if any module fails.
     exit_code=$(($exit_code + $?))
   popd;
 done
diff --git a/internal/kokoro/presubmit.sh b/internal/kokoro/presubmit.sh
index 8801eaf..065b3ff 100755
--- a/internal/kokoro/presubmit.sh
+++ b/internal/kokoro/presubmit.sh
@@ -44,16 +44,18 @@
 ./internal/kokoro/vet.sh
 ./internal/kokoro/check_incompat_changes.sh
 
+set +e # Run all tests, don't stop after the first failure.
 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 sponge_log.log
-    # 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.
+    # Takes the kokoro output log (raw stdout) and creates a machine-parseable
+    # xUnit XML file.
     cat sponge_log.log \
       | go-junit-report -set-exit-code > sponge_log.xml
+    # Add the exit codes together so we exit non-zero if any module fails.
     exit_code=$(($exit_code + $?))
   popd;
 done