From cc638819fd54d4d1a80566d785a1acd57ce0ff44 Mon Sep 17 00:00:00 2001 From: Marten Seemann Date: Wed, 5 Aug 2020 11:25:00 +0700 Subject: [PATCH 1/2] fix error check in the gogenerate Travis task --- .travis/script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis/script.sh b/.travis/script.sh index 1472d875a..a7985a1b0 100755 --- a/.travis/script.sh +++ b/.travis/script.sh @@ -20,7 +20,7 @@ if [ ${TESTMODE} == "gogenerate" ]; then find . -type f -name "*.go" -exec shasum {} \; > checksums_after.txt DIFF=`diff checksums_before.txt checksums_after.txt` echo $DIFF - if [ ! -z "$var" ]; then + if [ -n "$DIFF" ]; then exit 1 fi fi From 28f8eeedb7426988cbf166caa536086021e1e239 Mon Sep 17 00:00:00 2001 From: Marten Seemann Date: Wed, 5 Aug 2020 11:25:21 +0700 Subject: [PATCH 2/2] apply suggestions from shellcheck --- .travis/script.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.travis/script.sh b/.travis/script.sh index a7985a1b0..310700f66 100755 --- a/.travis/script.sh +++ b/.travis/script.sh @@ -2,12 +2,12 @@ set -ex -if [ ${TESTMODE} == "lint" ]; then +if [ "${TESTMODE}" == "lint" ]; then .travis/no_ginkgo.sh ./bin/golangci-lint run ./... fi -if [ ${TESTMODE} == "gogenerate" ]; then +if [ "${TESTMODE}" == "gogenerate" ]; then find . -type f -name "*.go" -exec shasum {} \; > checksums_before.txt # delete all go-generated files generated (that adhere to the comment convention) grep --include \*.go --exclude-dir quictrace/ -lrIZ "^// Code generated .* DO NOT EDIT\.$" . | xargs --null rm @@ -18,28 +18,28 @@ if [ ${TESTMODE} == "gogenerate" ]; then # now generate everything go generate ./... find . -type f -name "*.go" -exec shasum {} \; > checksums_after.txt - DIFF=`diff checksums_before.txt checksums_after.txt` - echo $DIFF + DIFF=$(diff checksums_before.txt checksums_after.txt) + echo "$DIFF" if [ -n "$DIFF" ]; then exit 1 fi fi -if [ ${TESTMODE} == "unit" ]; then +if [ "${TESTMODE}" == "unit" ]; then ginkgo -r -v -cover -randomizeAllSpecs -randomizeSuites -trace -skipPackage integrationtests,benchmark # run unit tests with the Go race detector # The Go race detector only works on amd64. - if [ ${TRAVIS_GOARCH} == 'amd64' ]; then + if [ "${TRAVIS_GOARCH}" == 'amd64' ]; then ginkgo -race -r -v -randomizeAllSpecs -randomizeSuites -trace -skipPackage integrationtests,benchmark fi fi -if [ ${TESTMODE} == "integration" ]; then +if [ "${TESTMODE}" == "integration" ]; then # run benchmark tests ginkgo -randomizeAllSpecs -randomizeSuites -trace benchmark -- -size=10 # run benchmark tests with the Go race detector # The Go race detector only works on amd64. - if [ ${TRAVIS_GOARCH} == 'amd64' ]; then + if [ "${TRAVIS_GOARCH}" == 'amd64' ]; then ginkgo -race -randomizeAllSpecs -randomizeSuites -trace benchmark -- -size=5 fi # run integration tests