Run benchmarks and fmt in travis (#174)

This commit is contained in:
Thomas Pelletier
2017-06-01 23:55:32 -07:00
committed by GitHub
parent e94d595cd4
commit fe7536c3de
7 changed files with 44 additions and 11 deletions
+2
View File
@@ -10,7 +10,9 @@ matrix:
- go: tip
fast_finish: true
script:
- if [ -n "$(go fmt ./...)" ]; then exit 1; fi
- ./test.sh
- ./benchmark.sh $TRAVIS_BRANCH https://github.com/$TRAVIS_REPO_SLUG.git
before_install:
- go get github.com/axw/gocov/gocov
- go get github.com/mattn/goveralls
Executable
+32
View File
@@ -0,0 +1,32 @@
#!/bin/bash
set -e
reference_ref=${1:-master}
reference_git=${2:-.}
if ! `hash benchstat 2>/dev/null`; then
echo "Installing benchstat"
go get golang.org/x/perf/cmd/benchstat
go install golang.org/x/perf/cmd/benchstat
fi
tempdir=`mktemp -d /tmp/go-toml-benchmark-XXXXXX`
ref_tempdir="${tempdir}/ref"
ref_benchmark="${ref_tempdir}/benchmark-${reference_ref}.txt"
local_benchmark="`pwd`/benchmark-local.txt"
echo "=== ${reference_ref} (${ref_tempdir})"
git clone ${reference_git} ${ref_tempdir} >/dev/null 2>/dev/null
pushd ${ref_tempdir} >/dev/null
git checkout ${reference_ref} >/dev/null 2>/dev/null
go test -bench=. -benchmem | tee ${ref_benchmark}
popd >/dev/null
echo ""
echo "=== local"
go test -bench=. -benchmem | tee ${local_benchmark}
echo ""
echo "=== diff"
benchstat -delta-test=none ${ref_benchmark} ${local_benchmark}
+1 -1
View File
@@ -7,10 +7,10 @@ package query
import (
"fmt"
"github.com/pelletier/go-toml"
"strconv"
"strings"
"unicode/utf8"
"github.com/pelletier/go-toml"
)
// Lexer state function
+1 -1
View File
@@ -1,8 +1,8 @@
package query
import (
"testing"
"github.com/pelletier/go-toml"
"testing"
)
func testQLFlow(t *testing.T, input string, expectedFlow []token) {
+1 -1
View File
@@ -2,8 +2,8 @@ package query
import (
"fmt"
"testing"
"github.com/pelletier/go-toml"
"testing"
)
// dump path tree to a string
+1 -1
View File
@@ -2,12 +2,12 @@ package query
import (
"fmt"
"github.com/pelletier/go-toml"
"io/ioutil"
"sort"
"strings"
"testing"
"time"
"github.com/pelletier/go-toml"
)
type queryTestNode struct {
+1 -2
View File
@@ -2,9 +2,9 @@ package query
import (
"fmt"
"github.com/pelletier/go-toml"
"strconv"
"unicode"
"github.com/pelletier/go-toml"
)
// Define tokens
@@ -104,4 +104,3 @@ func isHexDigit(r rune) bool {
(r >= 'a' && r <= 'f') ||
(r >= 'A' && r <= 'F')
}