From 43a2d404b9f4e46b03ddcc0643555a7ac5a9c14d Mon Sep 17 00:00:00 2001 From: Carl Baldwin Date: Tue, 20 Aug 2019 09:19:06 -0600 Subject: Fix tools test This changes the test to no longer reference $GOPATH. Instead, it removes `github.com/osrg/gobgp/` fore calling grep from the package name before calling grep so that it greps a location relative to wherever the script was located when it was called. This should work regardless of $GOPATH. The problem was that in a Travis CI run, the repository is not cloned to the correct spot under $GOPATH and the grep fails because it is looking in the wrong place. The repository is cloned to `/home/travis/build/osrg/gobgp` and GOPATH is set to `/home/travis/gopath` during a Travis run which don't match up. --- tools/grep_avoided_functions.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'tools') diff --git a/tools/grep_avoided_functions.sh b/tools/grep_avoided_functions.sh index d5b6494b..26681a43 100755 --- a/tools/grep_avoided_functions.sh +++ b/tools/grep_avoided_functions.sh @@ -9,14 +9,17 @@ FUNCS=( ) SCRIPT_DIR=`dirname $0` +cd "${SCRIPT_DIR}/.." RESULT=0 +PKG_BASE=github.com/osrg/gobgp + for FUNC in ${FUNCS[@]} do - for GO_PKG in $(go list github.com/osrg/gobgp/... | grep -v '/vendor/') + for GO_PKG in $(go list $PKG_BASE/... | grep -v '/vendor/') do - grep ${FUNC} -r ${GOPATH}/src/${GO_PKG} + grep ${FUNC} -r ${GO_PKG#$PKG_BASE/} if [ $? -ne 1 ] then RESULT=1 -- cgit v1.2.3