From 58961d23bbbaea65d6d06aa2da61e4414ba5a83c Mon Sep 17 00:00:00 2001 From: James Shubin Date: Tue, 12 Mar 2019 15:50:30 -0400 Subject: [PATCH] test: Improve test depth Make sure we're catching everything, including new, deeper code. --- test/test-examples.sh | 2 +- test/test-golint.sh | 4 ++-- test/test-gometalinter.sh | 2 +- test/test-govet.sh | 5 ++++- test/test-vet.sh | 2 +- 5 files changed, 9 insertions(+), 6 deletions(-) diff --git a/test/test-examples.sh b/test/test-examples.sh index 6cbf954e..f7f2f94c 100755 --- a/test/test-examples.sh +++ b/test/test-examples.sh @@ -22,7 +22,7 @@ ln -s "$linkto" # symlink outside of dir cd `basename "$linkto"` # loop through individual *.go files in working dir -for file in `find . -maxdepth 3 -type f -name '*.go'`; do +for file in `find . -maxdepth 9 -type f -name '*.go'`; do #echo "running test on: $file" run-test go build -i -o "$buildout" "$file" || fail_test "could not build: $file" done diff --git a/test/test-golint.sh b/test/test-golint.sh index 5095120e..f3c3855c 100755 --- a/test/test-golint.sh +++ b/test/test-golint.sh @@ -27,7 +27,7 @@ if [ "$COMMITS" != "" ] && [ "$COMMITS" -gt "1" ]; then fi # find all go files, exluding temporary directories and generated files -LINT=$(find * -maxdepth 5 -iname '*.go' -not -path 'old/*' -not -path 'tmp/*' -not -path 'bindata/*' -not -path 'lang/y.go' -not -path 'lang/lexer.nn.go' -not -path 'vendor/*' -exec golint {} \;) # current golint output +LINT=$(find * -maxdepth 9 -iname '*.go' -not -path 'old/*' -not -path 'tmp/*' -not -path 'bindata/*' -not -path 'lang/y.go' -not -path 'lang/lexer.nn.go' -not -path 'vendor/*' -exec golint {} \;) # current golint output COUNT=`echo -e "$LINT" | wc -l` # number of golint problems in current branch [ "$LINT" = "" ] && echo PASS && exit # everything is "perfect" @@ -55,7 +55,7 @@ while read -r line; do done <<< "$NUMSTAT1" # three < is the secret to putting a variable into read git checkout "$PREVIOUS" &>/dev/null # previous commit -LINT1=$(find * -maxdepth 5 -iname '*.go' -not -path 'old/*' -not -path 'tmp/*' -not -path 'bindata/*' -not -path 'lang/y.go' -not -path 'lang/lexer.nn.go' -not -path 'vendor/*' -exec golint {} \;) +LINT1=$(find * -maxdepth 9 -iname '*.go' -not -path 'old/*' -not -path 'tmp/*' -not -path 'bindata/*' -not -path 'lang/y.go' -not -path 'lang/lexer.nn.go' -not -path 'vendor/*' -exec golint {} \;) COUNT1=`echo -e "$LINT1" | wc -l` # number of golint problems in older branch # clean up diff --git a/test/test-gometalinter.sh b/test/test-gometalinter.sh index 1d969386..535f3d4f 100755 --- a/test/test-gometalinter.sh +++ b/test/test-gometalinter.sh @@ -54,7 +54,7 @@ echo "Using: $gometalinter" # loop through directories in an attempt to scan each go package # TODO: lint the *.go examples as individual files and not as a single *.go -for dir in `find * -maxdepth 5 -type d -not -path 'old/*' -not -path 'old' -not -path 'tmp/*' -not -path 'tmp' -not -path 'vendor/*' -not -path 'examples/*' -not -path 'test/*'`; do +for dir in `find * -maxdepth 9 -type d -not -path 'old/*' -not -path 'old' -not -path 'tmp/*' -not -path 'tmp' -not -path 'vendor/*' -not -path 'examples/*' -not -path 'test/*'`; do #echo "Running in: $dir" match="$dir/*.go" diff --git a/test/test-govet.sh b/test/test-govet.sh index 294ea108..3fe28bcd 100755 --- a/test/test-govet.sh +++ b/test/test-govet.sh @@ -75,7 +75,10 @@ for pkg in `go list -e ./... | grep -v "^${base}/vendor/" | grep -v "^${base}/ex done # loop through individual *.go files -for file in `find . -maxdepth 3 -type f -name '*.go' -not -path './old/*' -not -path './tmp/*'`; do +for file in `find . -maxdepth 9 -type f -name '*.go' -not -path './old/*' -not -path './tmp/*' -not -path 'vendor/*'`; do + #if [[ $file == "./vendor/"* ]]; then # skip files that start with... + # continue + #fi run-test grep 'log.Print' "$file" | grep '\\n"' && fail_test 'no newline needed in log.Print*()' # no \n needed in log.Printf or log.Println run-test simplify-gocase "$file" run-test token-coloncheck "$file" diff --git a/test/test-vet.sh b/test/test-vet.sh index 0d963f91..9392c006 100755 --- a/test/test-vet.sh +++ b/test/test-vet.sh @@ -39,7 +39,7 @@ function parser-conflicts() { } # loop through individual *.y files -for file in `find . -maxdepth 3 -type f -name '*.y' -not -path './old/*' -not -path './tmp/*'`; do +for file in `find . -maxdepth 9 -type f -name '*.y' -not -path './old/*' -not -path './tmp/*' -not -path 'vendor/*'`; do run-test parser-indentation "$file" run-test parser-conflicts "$file" done