gotest: multiple +build lines must all be true

The code that handled +build lines did not correctly require them to all
    be true.  While looking into this I discovered that multiple +build
    lines were mishandled in a different way, because the shell does not
    preseve line breaks in backquoted data.  Look for the +build token to
    tell us when we are switching from one +build line to another.
    
    Reviewed-on: https://go-review.googlesource.com/25460

From-SVN: r239100
This commit is contained in:
Ian Lance Taylor 2016-08-03 22:46:06 +00:00
parent ac2c96ab12
commit 9c26dfd08a
2 changed files with 50 additions and 46 deletions

View File

@ -1,4 +1,4 @@
0fb416a7bed076bdfef168480789bb2994a58de3
3096ac81185edacbf800783f0f803d1c419dccdd
The first line of this file holds the git revision number of the last
merge done from the gofrontend repository.

View File

@ -313,13 +313,9 @@ x)
esac
if test x$tag1 != xnonmatchingtag -a x$tag2 != xnonmatchingtag; then
taglines=`sed '/^package /q' < $f | fgrep '// +build '`
if test "$taglines" = ""; then
tags=`sed '/^package /q' < $f | fgrep '// +build '`
omatch=true
else
omatch=false
fi
for tags in $taglines; do
first=true
match=false
for tag in $tags; do
reverse=false
@ -331,7 +327,15 @@ x)
esac
case $tag in
"//" | "+build")
"//")
;;
"+build")
if test "$first" = "true"; then
first=false
elif test "$match" = "false"; then
omatch=false
fi
match=false
;;
$goos | $goarch | cgo)
match=true
@ -358,10 +362,10 @@ x)
fi
fi
done
if test "$match" = "true"; then
omatch=true
if test "$match" = "false" -a "$first" = "false"; then
omatch=false
fi
done
if test "$omatch" = "true"; then
gofiles="$gofiles $f"