File: test.sh

package info (click to toggle)
golang-google-genproto 0.0~git20210726.e7812ac-4
  • links: PTS, VCS
  • area: main
  • in suites: experimental, forky, sid, trixie
  • size: 88,368 kB
  • sloc: sh: 49; makefile: 3
file content (49 lines) | stat: -rwxr-xr-x 1,199 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/bash

# Fail on any error
set -eo pipefail

# Display commands being run
set -x

# cd to project dir on Kokoro instance
cd github/go-genproto

go version

# Set $GOPATH
export GOPATH="$HOME/go"
export GENPROTO_HOME=$GOPATH/src/google.golang.org/genproto
export PATH="$GOPATH/bin:$PATH"
export GO111MODULE=on
mkdir -p $GENPROTO_HOME

# Move code into $GOPATH and get dependencies
git clone . $GENPROTO_HOME
cd $GENPROTO_HOME

try3() { eval "$*" || eval "$*" || eval "$*"; }

# All packages, including +build tools, are fetched.
try3 go mod download
./internal/kokoro/vet.sh

go get github.com/jstemmer/go-junit-report

set +e

# Run tests and tee output to log file, to be pushed to GCS as artifact.
go test -race -v ./... 2>&1 | tee $KOKORO_ARTIFACTS_DIR/sponge_log.log

cat $KOKORO_ARTIFACTS_DIR/sponge_log.log | go-junit-report -set-exit-code >$KOKORO_ARTIFACTS_DIR/sponge_log.xml
exit_code=$?

# Send logs to Flaky Bot for continuous builds.
if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"continuous"* ]]; then
  chmod +x $KOKORO_GFILE_DIR/linux_amd64/flakybot
  $KOKORO_GFILE_DIR/linux_amd64/flakybot \
    -logs_dir=$KOKORO_ARTIFACTS_DIR \
    -repo=googleapis/go-genproto
fi

exit $exit_code