github.com/aporeto-inc/trireme-lib@v10.358.0+incompatible/.test.sh (about)

     1  #!/usr/bin/env bash
     2  
     3  set -e
     4  echo "" > coverage.txt
     5  
     6  ./mockgen.sh
     7  ./fix_bpf
     8  
     9  ## FIX ME. go1.14 automatically enables unsafe ptr checks when doing race checks,
    10  ## and it is not clear if this is compatible (it is disabled on Windows)
    11  ##
    12  ## This needs to be revisited and maybe remove "-gcflags=all=-d=checkptr=0" below
    13  ## for go1.14 once we determine if there is a real pointer issue in the tests.
    14  ##
    15  ## this is the file that fails when ptr checking is enabled:
    16  ## go.aporeto.io/trireme-lib/controller/internal/enforcer/applicationproxy/markedconn_test.go
    17  ##
    18  ## to see the failure, test that package individually setting "checkptr=1"
    19  
    20  case "$(go version)" in
    21      *1.13*) CHECKPTR=""  ;;
    22      *)      CHECKPTR="-gcflags=all=-d=checkptr=0" ;;
    23  esac
    24  
    25  for d in $(go list ./... | grep -v 'mock|bpf'); do
    26      go test ${CHECKPTR} -race -tags test -coverprofile=profile.out -covermode=atomic $d
    27      if [ -f profile.out ]; then
    28          cat profile.out >> coverage.txt
    29          rm profile.out
    30      fi
    31  done