From 5f060d60a7a7ba54168faf3effc9274f7257242c Mon Sep 17 00:00:00 2001 From: James Shubin Date: Wed, 1 Mar 2017 22:37:08 -0500 Subject: [PATCH] test: Avoid matching three X's This helps my "WIP" detector script avoid false positives. It is a simple script which helps me find release critical problems. --- test/test-golint.sh | 2 +- test/test-govet.sh | 3 ++- test/test-reproducible.sh | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/test/test-golint.sh b/test/test-golint.sh index c14ee52c..0af3f145 100755 --- a/test/test-golint.sh +++ b/test/test-golint.sh @@ -28,7 +28,7 @@ COUNT=`echo -e "$LINT" | wc -l` # number of golint problems in current branch [ "$LINT" = "" ] && echo PASS && exit # everything is "perfect" echo "$LINT" # display the issues -T=`mktemp --tmpdir -d tmp.XXX` +T=`mktemp --tmpdir -d tmp.X'X'X` # add quotes to avoid matching three X's [ "$T" = "" ] && fail_test "Could not create tmpdir" cd $T || fail_test "Could not change into tmpdir $T" git clone --recursive "${ROOT}" 2>/dev/null # make a copy diff --git a/test/test-govet.sh b/test/test-govet.sh index 58f6b798..4fec1616 100755 --- a/test/test-govet.sh +++ b/test/test-govet.sh @@ -22,7 +22,8 @@ function simplify-gocase() { } function token-coloncheck() { - if grep -Ei "[\/]+[\/]+[ ]*+(FIXME[^:]|TODO[^:]|XXX[^:])" "$1"; then + # add quotes to avoid matching three X's + if grep -Ei "[\/]+[\/]+[ ]*+(FIXME[^:]|TODO[^:]|X"'X'"X[^:])" "$1"; then return 1 # tokens must end with a colon fi return 0 diff --git a/test/test-reproducible.sh b/test/test-reproducible.sh index 8fd65c04..6c03cc0f 100755 --- a/test/test-reproducible.sh +++ b/test/test-reproducible.sh @@ -7,7 +7,7 @@ set -o pipefail DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd )" # dir! cd "$DIR" >/dev/null # work from main mgmt directory make build -T=`mktemp --tmpdir -d tmp.XXX` +T=`mktemp --tmpdir -d tmp.X'X'X` # add quotes to avoid matching three X's cp -a ./mgmt "$T"/mgmt.1 make clean make build