Skip to content

Commit

Permalink
Makefile: do more caching in make test-only
Browse files Browse the repository at this point in the history
  • Loading branch information
Raynos committed Apr 17, 2017
1 parent 8f542e3 commit 81457bb
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -24,3 +24,4 @@ scripts/easy_json/easy_json
*.pprof
*.prof
node_modules/
./test/.cached_binary_test_info.json
13 changes: 9 additions & 4 deletions Makefile
Expand Up @@ -92,10 +92,15 @@ test: generate lint

.PHONY: test-only
test-only:
go test ./examples/example-gateway/... | grep -v '\[no test files\]'
go test ./codegen/... | grep -v '\[no test files\]'
go test ./runtime/... | grep -v '\[no test files\]'
go test ./test/... | grep -v '\[no test files\]'
rm -f ./test/.cached_binary_test_info.json
go test ./test/health_test.go # preload the binary cache.
go test \
./examples/example-gateway/... \
./codegen/... \
./runtime/... \
./test/... | \
grep -v '\[no test files\]'
rm -f ./test/.cached_binary_test_info.json
echo "<coverage />" > ./coverage/cobertura-coverage.xml

.PHONY: travis-coveralls
Expand Down
6 changes: 2 additions & 4 deletions test/lib/test_gateway/test_gateway_cover.go
Expand Up @@ -153,7 +153,7 @@ func createTestBinaryFile(
mainPath string,
config map[string]interface{},
) (*testBinaryInfo, error) {
if os.Getenv("COVER_ON") == "1" && cachedBinaryFile == nil {
if cachedBinaryFile == nil {
// Try to load cachedBinaryFile from disk
tryLoadCachedBinaryTestInfo(mainPath)
}
Expand Down Expand Up @@ -227,8 +227,6 @@ func createTestBinaryFile(
CoverProfileFile: coverProfileFile,
MainFile: mainPath,
}
if os.Getenv("COVER_ON") == "1" {
tryWriteCachedBinaryTestInfo()
}
tryWriteCachedBinaryTestInfo()
return cachedBinaryFile, nil
}

0 comments on commit 81457bb

Please sign in to comment.