2012-11-01 02:29:41 +04:00
|
|
|
# Copyright 2012, Google Inc. All rights reserved.
|
|
|
|
# Use of this source code is governed by a BSD-style license that can
|
|
|
|
# be found in the LICENSE file.
|
|
|
|
|
|
|
|
MAKEFLAGS = -s
|
|
|
|
|
2014-09-11 01:56:25 +04:00
|
|
|
.PHONY: all build test clean unit_test unit_test_cover unit_test_race queryservice_test integration_test bson site_test site_integration_test
|
2014-05-17 01:45:16 +04:00
|
|
|
|
|
|
|
all: build test
|
2012-11-01 02:29:41 +04:00
|
|
|
|
2014-12-10 10:19:35 +03:00
|
|
|
# Values to be burned into the binary at build-time.
|
|
|
|
LDFLAGS = "\
|
|
|
|
-X github.com/youtube/vitess/go/vt/servenv.buildHost '$$(hostname)'\
|
|
|
|
-X github.com/youtube/vitess/go/vt/servenv.buildUser '$$(whoami)'\
|
|
|
|
-X github.com/youtube/vitess/go/vt/servenv.buildGitRev '$$(git rev-parse HEAD)'\
|
|
|
|
-X github.com/youtube/vitess/go/vt/servenv.buildTime '$$(date)'\
|
|
|
|
"
|
|
|
|
|
2012-11-01 02:29:41 +04:00
|
|
|
build:
|
2014-12-10 10:19:35 +03:00
|
|
|
go install -ldflags ${LDFLAGS} ./go/...
|
2013-12-25 02:28:19 +04:00
|
|
|
|
2014-09-11 01:56:25 +04:00
|
|
|
# Set VT_TEST_FLAGS to pass flags to python tests.
|
|
|
|
# For example, verbose output: export VT_TEST_FLAGS=-v
|
2014-05-17 01:45:16 +04:00
|
|
|
test: unit_test queryservice_test integration_test
|
2014-09-11 01:56:25 +04:00
|
|
|
site_test: unit_test site_integration_test
|
2014-05-17 01:45:16 +04:00
|
|
|
|
2013-12-25 02:28:19 +04:00
|
|
|
clean:
|
|
|
|
go clean -i ./go/...
|
2014-06-18 22:33:29 +04:00
|
|
|
rm -rf java/vtocc-client/target java/vtocc-jdbc-driver/target third_party/acolyte
|
2012-11-01 02:29:41 +04:00
|
|
|
|
|
|
|
unit_test:
|
2013-07-27 04:02:14 +04:00
|
|
|
go test ./go/...
|
2012-11-01 02:29:41 +04:00
|
|
|
|
2014-05-01 00:43:22 +04:00
|
|
|
# Run the code coverage tools, compute aggregate.
|
|
|
|
# If you want to improve in a directory, run:
|
|
|
|
# go test -coverprofile=coverage.out && go tool cover -html=coverage.out
|
2014-05-01 00:13:59 +04:00
|
|
|
unit_test_cover:
|
2014-05-01 00:43:22 +04:00
|
|
|
go test -cover ./go/... | misc/parse_cover.py
|
2014-05-01 00:13:59 +04:00
|
|
|
|
2013-10-29 15:40:01 +04:00
|
|
|
unit_test_race:
|
|
|
|
go test -race ./go/...
|
|
|
|
|
2014-10-01 05:59:51 +04:00
|
|
|
unit_test_goveralls:
|
|
|
|
go list -f '{{if len .TestGoFiles}}go test -coverprofile={{.Dir}}/.coverprofile {{.ImportPath}}{{end}}' ./go/... | xargs -i sh -c {}
|
|
|
|
gover ./go/
|
|
|
|
goveralls -coverprofile=gover.coverprofile -repotoken $$COVERALLS_TOKEN
|
|
|
|
|
2012-11-29 04:41:43 +04:00
|
|
|
queryservice_test:
|
2014-09-04 01:00:41 +04:00
|
|
|
echo $$(date): Running test/queryservice_test.py...
|
2012-11-02 20:49:07 +04:00
|
|
|
if [ -e "/usr/bin/memcached" ]; then \
|
2014-09-09 02:09:42 +04:00
|
|
|
time test/queryservice_test.py -m -e vtocc $$VT_TEST_FLAGS || exit 1 ; \
|
|
|
|
time test/queryservice_test.py -m -e vttablet $$VT_TEST_FLAGS || exit 1 ; \
|
2012-11-01 02:29:41 +04:00
|
|
|
else \
|
2014-09-09 02:09:42 +04:00
|
|
|
time test/queryservice_test.py -e vtocc $$VT_TEST_FLAGS || exit 1 ; \
|
|
|
|
time test/queryservice_test.py -e vttablet $$VT_TEST_FLAGS || exit 1 ; \
|
2012-11-01 02:29:41 +04:00
|
|
|
fi
|
|
|
|
|
2014-09-11 01:56:25 +04:00
|
|
|
# These tests should be run by users to check that Vitess works in their environment.
|
|
|
|
site_integration_test_files = \
|
|
|
|
keyrange_test.py \
|
|
|
|
keyspace_test.py \
|
|
|
|
mysqlctl.py \
|
|
|
|
secure.py \
|
|
|
|
tabletmanager.py \
|
|
|
|
update_stream.py \
|
|
|
|
vtdb_test.py \
|
|
|
|
vtgatev2_test.py \
|
|
|
|
zkocc_test.py
|
|
|
|
|
|
|
|
# These tests should be run by developers after making code changes.
|
2014-10-01 05:59:51 +04:00
|
|
|
# integration tests that take under 45s to run
|
|
|
|
small_integration_test_files = \
|
2014-04-14 05:38:00 +04:00
|
|
|
keyrange_test.py \
|
2014-08-21 04:54:58 +04:00
|
|
|
mysqlctl.py \
|
2014-04-14 05:38:00 +04:00
|
|
|
sharded.py \
|
2014-10-01 05:59:51 +04:00
|
|
|
keyspace_test.py \
|
2014-04-14 05:38:00 +04:00
|
|
|
update_stream.py \
|
2014-10-01 05:59:51 +04:00
|
|
|
schema.py \
|
2014-12-10 00:41:36 +03:00
|
|
|
vertical_split.py \
|
2014-10-01 05:59:51 +04:00
|
|
|
secure.py \
|
2014-04-14 05:38:00 +04:00
|
|
|
vertical_split_vtgate.py \
|
2014-10-01 05:59:51 +04:00
|
|
|
binlog.py \
|
|
|
|
clone.py
|
|
|
|
|
|
|
|
# integration tests that take between 45s and 1 min
|
|
|
|
medium_integration_test_files = \
|
|
|
|
tabletmanager.py \
|
|
|
|
reparent.py \
|
2014-04-14 05:38:00 +04:00
|
|
|
vtdb_test.py \
|
2014-10-01 05:59:51 +04:00
|
|
|
rowcache_invalidator.py \
|
|
|
|
initial_sharding.py
|
|
|
|
|
|
|
|
# integration tests that take between 1-2 mins
|
|
|
|
large_integration_test_files = \
|
2014-08-07 22:34:57 +04:00
|
|
|
vtgatev2_test.py \
|
2014-10-01 05:59:51 +04:00
|
|
|
zkocc_test.py \
|
|
|
|
initial_sharding_bytes.py
|
|
|
|
|
|
|
|
# integration tests that take more than 2 mins
|
|
|
|
huge_integration_test_files = \
|
|
|
|
resharding.py
|
2012-12-28 02:25:51 +04:00
|
|
|
|
2014-12-13 05:12:58 +03:00
|
|
|
# these tests are considered too flaky to be included
|
|
|
|
# in the continous integration test suites
|
|
|
|
ci_skip_integration_test_files = \
|
|
|
|
resharding_bytes.py
|
|
|
|
|
2014-04-14 05:38:00 +04:00
|
|
|
.ONESHELL:
|
|
|
|
SHELL = /bin/bash
|
2014-10-01 05:59:51 +04:00
|
|
|
|
|
|
|
# function to execute a list of integration test files
|
|
|
|
# exits on first failure
|
|
|
|
define run_integration_tests
|
2014-04-14 05:38:00 +04:00
|
|
|
cd test ; \
|
2014-10-01 05:59:51 +04:00
|
|
|
for t in $1 ; do \
|
2014-09-04 01:00:41 +04:00
|
|
|
echo $$(date): Running test/$$t... ; \
|
2014-04-14 05:38:00 +04:00
|
|
|
output=$$(time ./$$t $$VT_TEST_FLAGS 2>&1) ; \
|
|
|
|
if [[ $$? != 0 ]]; then \
|
2014-04-28 10:28:55 +04:00
|
|
|
echo "$$output" >&2 ; \
|
2014-04-14 05:38:00 +04:00
|
|
|
exit 1 ; \
|
|
|
|
fi ; \
|
|
|
|
echo ; \
|
|
|
|
done
|
2014-10-01 05:59:51 +04:00
|
|
|
endef
|
|
|
|
|
|
|
|
small_integration_test:
|
|
|
|
$(call run_integration_tests, $(small_integration_test_files))
|
|
|
|
|
|
|
|
medium_integration_test:
|
|
|
|
$(call run_integration_tests, $(medium_integration_test_files))
|
|
|
|
|
|
|
|
large_integration_test:
|
|
|
|
$(call run_integration_tests, $(large_integration_test_files))
|
|
|
|
|
|
|
|
huge_integration_test:
|
|
|
|
$(call run_integration_tests, $(huge_integration_test_files))
|
|
|
|
|
2014-12-13 05:12:58 +03:00
|
|
|
ci_skip_integration_test:
|
|
|
|
$(call run_integration_tests, $(ci_skip_integration_test_files))
|
|
|
|
|
|
|
|
integration_test: small_integration_test medium_integration_test large_integration_test huge_integration_test ci_skip_integration_test
|
2014-03-22 02:55:49 +04:00
|
|
|
|
2014-09-11 01:56:25 +04:00
|
|
|
site_integration_test:
|
2014-10-01 05:59:51 +04:00
|
|
|
$(call run_integration_tests, $(site_integration_test_files))
|
2014-09-11 01:56:25 +04:00
|
|
|
|
2014-06-18 22:33:29 +04:00
|
|
|
# this rule only works if bootstrap.sh was successfully ran in ./java
|
|
|
|
java_test:
|
|
|
|
cd java && mvn verify
|
|
|
|
|
2014-10-01 05:59:51 +04:00
|
|
|
java_vtgate_client_test:
|
|
|
|
mvn -f java/gorpc/pom.xml clean install -DskipTests
|
|
|
|
mvn -f java/vtgate-client/pom.xml clean verify
|
|
|
|
|
2014-12-06 09:12:47 +03:00
|
|
|
v3_test:
|
|
|
|
cd test && ./vtgatev3_test.py
|
|
|
|
|
2014-03-22 02:55:49 +04:00
|
|
|
bson:
|
|
|
|
bsongen -file ./go/mysql/proto/structs.go -type QueryResult -o ./go/mysql/proto/query_result_bson.go
|
|
|
|
bsongen -file ./go/mysql/proto/structs.go -type Field -o ./go/mysql/proto/field_bson.go
|
2014-09-27 02:35:09 +04:00
|
|
|
bsongen -file ./go/mysql/proto/structs.go -type Charset -o ./go/mysql/proto/charset_bson.go
|
2014-03-22 10:38:45 +04:00
|
|
|
bsongen -file ./go/vt/key/key.go -type KeyRange -o ./go/vt/key/key_range_bson.go
|
2014-04-04 01:51:04 +04:00
|
|
|
bsongen -file ./go/vt/key/key.go -type KeyspaceId -o ./go/vt/key/keyspace_id_bson.go
|
|
|
|
bsongen -file ./go/vt/key/key.go -type KeyspaceIdType -o ./go/vt/key/keyspace_id_type_bson.go
|
2014-03-23 11:26:24 +04:00
|
|
|
bsongen -file ./go/vt/tabletserver/proto/structs.go -type Query -o ./go/vt/tabletserver/proto/query_bson.go
|
|
|
|
bsongen -file ./go/vt/tabletserver/proto/structs.go -type Session -o ./go/vt/tabletserver/proto/session_bson.go
|
|
|
|
bsongen -file ./go/vt/tabletserver/proto/structs.go -type BoundQuery -o ./go/vt/tabletserver/proto/bound_query_bson.go
|
|
|
|
bsongen -file ./go/vt/tabletserver/proto/structs.go -type QueryList -o ./go/vt/tabletserver/proto/query_list_bson.go
|
|
|
|
bsongen -file ./go/vt/tabletserver/proto/structs.go -type QueryResultList -o ./go/vt/tabletserver/proto/query_result_list_bson.go
|
2014-11-01 22:17:39 +03:00
|
|
|
bsongen -file ./go/vt/vtgate/proto/vtgate_proto.go -type Query -o ./go/vt/vtgate/proto/query_bson.go
|
2014-03-23 11:26:24 +04:00
|
|
|
bsongen -file ./go/vt/vtgate/proto/vtgate_proto.go -type QueryShard -o ./go/vt/vtgate/proto/query_shard_bson.go
|
|
|
|
bsongen -file ./go/vt/vtgate/proto/vtgate_proto.go -type BatchQueryShard -o ./go/vt/vtgate/proto/batch_query_shard_bson.go
|
2014-04-04 01:51:04 +04:00
|
|
|
bsongen -file ./go/vt/vtgate/proto/vtgate_proto.go -type KeyspaceIdQuery -o ./go/vt/vtgate/proto/keyspace_id_query_bson.go
|
|
|
|
bsongen -file ./go/vt/vtgate/proto/vtgate_proto.go -type KeyRangeQuery -o ./go/vt/vtgate/proto/key_range_query_bson.go
|
2014-05-03 03:44:07 +04:00
|
|
|
bsongen -file ./go/vt/vtgate/proto/vtgate_proto.go -type EntityId -o ./go/vt/vtgate/proto/entity_id_bson.go
|
2014-04-04 01:51:04 +04:00
|
|
|
bsongen -file ./go/vt/vtgate/proto/vtgate_proto.go -type EntityIdsQuery -o ./go/vt/vtgate/proto/entity_ids_query_bson.go
|
|
|
|
bsongen -file ./go/vt/vtgate/proto/vtgate_proto.go -type KeyspaceIdBatchQuery -o ./go/vt/vtgate/proto/keyspace_id_batch_query_bson.go
|
|
|
|
bsongen -file ./go/vt/vtgate/proto/vtgate_proto.go -type Session -o ./go/vt/vtgate/proto/session_bson.go
|
|
|
|
bsongen -file ./go/vt/vtgate/proto/vtgate_proto.go -type ShardSession -o ./go/vt/vtgate/proto/shard_session_bson.go
|
|
|
|
bsongen -file ./go/vt/vtgate/proto/vtgate_proto.go -type QueryResult -o ./go/vt/vtgate/proto/query_result_bson.go
|
2014-03-23 13:15:16 +04:00
|
|
|
bsongen -file ./go/vt/topo/srvshard.go -type SrvShard -o ./go/vt/topo/srvshard_bson.go
|
|
|
|
bsongen -file ./go/vt/topo/srvshard.go -type SrvKeyspace -o ./go/vt/topo/srvkeyspace_bson.go
|
|
|
|
bsongen -file ./go/vt/topo/srvshard.go -type KeyspacePartition -o ./go/vt/topo/keyspace_partition_bson.go
|
2014-04-04 01:51:04 +04:00
|
|
|
bsongen -file ./go/vt/topo/tablet.go -type TabletType -o ./go/vt/topo/tablet_type_bson.go
|
2014-07-11 20:48:38 +04:00
|
|
|
bsongen -file ./go/vt/topo/toporeader.go -type GetSrvKeyspaceNamesArgs -o ./go/vt/topo/get_srv_keyspace_names_args_bson.go
|
|
|
|
bsongen -file ./go/vt/topo/toporeader.go -type GetSrvKeyspaceArgs -o ./go/vt/topo/get_srv_keyspace_args_bson.go
|
|
|
|
bsongen -file ./go/vt/topo/toporeader.go -type SrvKeyspaceNames -o ./go/vt/topo/srv_keyspace_names_bson.go
|
|
|
|
bsongen -file ./go/vt/topo/toporeader.go -type GetEndPointsArgs -o ./go/vt/topo/get_end_points_args_bson.go
|
2014-05-28 23:11:38 +04:00
|
|
|
bsongen -file ./go/vt/binlog/proto/binlog_player.go -type BlpPosition -o ./go/vt/binlog/proto/blp_position_bson.go
|
|
|
|
bsongen -file ./go/vt/binlog/proto/binlog_player.go -type BlpPositionList -o ./go/vt/binlog/proto/blp_position_list_bson.go
|
2014-03-24 02:26:15 +04:00
|
|
|
bsongen -file ./go/vt/binlog/proto/binlog_transaction.go -type BinlogTransaction -o ./go/vt/binlog/proto/binlog_transaction_bson.go
|
|
|
|
bsongen -file ./go/vt/binlog/proto/binlog_transaction.go -type Statement -o ./go/vt/binlog/proto/statement_bson.go
|
|
|
|
bsongen -file ./go/vt/binlog/proto/stream_event.go -type StreamEvent -o ./go/vt/binlog/proto/stream_event_bson.go
|
2014-03-24 08:48:50 +04:00
|
|
|
bsongen -file ./go/zk/zkocc_structs.go -type ZkPath -o ./go/zk/zkpath_bson.go
|
|
|
|
bsongen -file ./go/zk/zkocc_structs.go -type ZkPathV -o ./go/zk/zkpathv_bson.go
|
2014-03-24 12:46:05 +04:00
|
|
|
bsongen -file ./go/zk/zkocc_structs.go -type ZkStat -o ./go/zk/zkstat_bson.go
|
|
|
|
bsongen -file ./go/zk/zkocc_structs.go -type ZkNode -o ./go/zk/zknode_bson.go
|
|
|
|
bsongen -file ./go/zk/zkocc_structs.go -type ZkNodeV -o ./go/zk/zknodev_bson.go
|
2014-04-04 01:51:04 +04:00
|
|
|
|