#!/usr/bin/env bash set -ex if [ "${TESTMODE}" == "lint" ]; then .travis/no_ginkgo.sh ./bin/golangci-lint run ./... fi 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 # delete all files generated by Genny grep --include \*.go -lrIZ "This file was automatically generated by genny." . | xargs --null rm # first generate Genny files to make the code compile grep --include \*.go -lrI "//go:generate genny" | xargs -L 1 go generate # 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" if [ -n "$DIFF" ]; then exit 1 fi fi 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 ginkgo -race -r -v -randomizeAllSpecs -randomizeSuites -trace -skipPackage integrationtests,benchmark fi fi 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 ginkgo -race -randomizeAllSpecs -randomizeSuites -trace benchmark -- -size=5 fi # run integration tests ginkgo -r -v -randomizeAllSpecs -randomizeSuites -trace integrationtests fi