-
-
Save nyarly/83d1803091455035c6cd2c6387194430 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/local/bin/fish | |
| # XXX use git command to build this | |
| set -l projname swaggering | |
| set -l coverdir /tmp/{$projname} | |
| set -l numpipes 2 | |
| set -l filter '\ | |
| { gsub(/.*\\r/, "") }; | |
| { gsub(/.*_obj_test/, ".") }; | |
| /^ok|^\?/ { lines = ""; print; next }; | |
| /^FAIL[[:space:]][[:alnum:]]/ { print "BEGIN " gp "/src/" $2; print lines; print "FAIL " gp "/src/" $2; lines = ""; next }; | |
| { lines = lines "\n" $0 }; | |
| END { print lines }' | |
| mkdir -p $coverdir | |
| set -l result "succeeded" | |
| for p in (go list ./...) | |
| set -l fifodir (mktemp -d) | |
| mkfifo $fifodir/{(seq $numpipes)} | |
| awk -v gp=$GOPATH "$filter" < {$fifodir}/1 & | |
| if not go build $p > {$fifodir}/1 2>&1 | |
| set result "failed" | |
| continue | |
| end | |
| awk -v gp=$GOPATH "$filter" < {$fifodir}/2 & | |
| if not go test -short -timeout 10s -coverprofile=$coverdir/(echo $p | sed 's#/##g').out $p >> {$fifodir}/2 2>&1 | |
| set result "failed" | |
| end | |
| end | |
| legendary .cadre/coverage.vim $coverdir/*.out | |
| while jobs | grep -q 'running' | |
| sleep 0.1 | |
| end | |
| if [ $result = "failed" ] | |
| exit 1 | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment