Keep normal output quiet, but make failures more verbose to aid debugging.

Codify some assumptions on external environment variables.
This commit is contained in:
Mike Solomon 2014-04-13 18:38:00 -07:00
Родитель 49fff35fd4
Коммит 65674504b7
4 изменённых файлов: 51 добавлений и 27 удалений

Просмотреть файл

@ -27,28 +27,40 @@ queryservice_test:
fi fi
time test/sensitive_info_test.py time test/sensitive_info_test.py
# export VT_TEST_FLAGS=-v for instance #export VT_TEST_FLAGS=-v for instance
integration_test_files = clone.py \
initial_sharding_bytes.py \
initial_sharding.py \
keyrange_test.py \
keyspace_test.py \
reparent.py \
resharding_bytes.py \
resharding.py \
rowcache_invalidator.py \
secure.py \
schema.py \
sharded.py \
tabletmanager.py \
update_stream.py \
vertical_split.py \
vertical_split_vtgate.py \
vtdb_test.py \
vtgate_test.py \
zkocc_test.py
.ONESHELL:
SHELL = /bin/bash
integration_test: integration_test:
cd test ; echo "schema test"; time ./schema.py $$VT_TEST_FLAGS cd test ; \
cd test ; echo "sharded test"; time ./sharded.py $$VT_TEST_FLAGS for t in $(integration_test_files) ; do \
cd test ; echo "tabletmanager test"; time ./tabletmanager.py $$VT_TEST_FLAGS echo Running test/$$t... ; \
cd test ; echo "clone test"; time ./clone.py $$VT_TEST_FLAGS output=$$(time ./$$t $$VT_TEST_FLAGS 2>&1) ; \
cd test ; echo "reparent test"; time ./reparent.py $$VT_TEST_FLAGS if [[ $$? != 0 ]]; then \
cd test ; echo "zkocc test"; time ./zkocc_test.py $$VT_TEST_FLAGS echo $output >&2 ; \
cd test ; echo "updatestream test"; time ./update_stream.py exit 1 ; \
cd test ; echo "rowcache_invalidator test"; time ./rowcache_invalidator.py fi ; \
cd test ; echo "secure test"; time ./secure.py $$VT_TEST_FLAGS echo ; \
cd test ; echo "resharding test"; time ./resharding.py $$VT_TEST_FLAGS done
cd test ; echo "resharding_bytes test"; time ./resharding_bytes.py $$VT_TEST_FLAGS
cd test ; echo "vtdb test"; time ./vtdb_test.py $$VT_TEST_FLAGS
cd test ; echo "vtgate test"; time ./vtgate_test.py $$VT_TEST_FLAGS
cd test ; echo "keyrange test"; time ./keyrange_test.py $$VT_TEST_FLAGS
cd test ; echo "vertical_split test"; time ./vertical_split.py $$VT_TEST_FLAGS
cd test ; echo "vertical_split_vtgate test"; time ./vertical_split_vtgate.py $$VT_TEST_FLAGS
cd test ; echo "initial_sharding test"; time ./initial_sharding.py $$VT_TEST_FLAGS
cd test ; echo "initial_sharding_bytes test"; time ./initial_sharding_bytes.py $$VT_TEST_FLAGS
cd test ; echo "keyspace_test test"; time ./keyspace_test.py $$VT_TEST_FLAGS
bson: 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 QueryResult -o ./go/mysql/proto/query_result_bson.go

Просмотреть файл

@ -32,11 +32,16 @@ done
export PYTHONPATH=$(prepend_path $PYTHONPATH $VTROOT/py-vtdb) export PYTHONPATH=$(prepend_path $PYTHONPATH $VTROOT/py-vtdb)
export PATH=$(prepend_path $PATH $VTROOT/bin) # Add the current GOBIN
if [ "$GOBIN" ]; then if [ "$GOBIN" ]; then
export PATH=$(prepend_path $PATH $GOBIN) export PATH=$(prepend_path $PATH $GOBIN)
fi fi
# Many tests rely on "go install" and assume GOBIN is really $VTROOT/bin.
# Make sure these take precedence.
export GOBIN=$VTROOT/bin
export PATH=$(prepend_path $PATH $GOBIN)
export PATH=$(prepend_path $PATH $VTROOT/dist/mysql/bin) export PATH=$(prepend_path $PATH $VTROOT/dist/mysql/bin)
# GOROOT sanity # GOROOT sanity

Просмотреть файл

@ -59,17 +59,22 @@ def reserve_ports(count):
# simple run command, cannot use utils.run to avoid circular dependencies # simple run command, cannot use utils.run to avoid circular dependencies
def run(args, raise_on_error=True, **kargs): def run(args, raise_on_error=True, **kargs):
proc = subprocess.Popen(args, try:
stdout=subprocess.PIPE, proc = subprocess.Popen(args,
stderr=subprocess.PIPE, stdout=subprocess.PIPE,
**kargs) stderr=subprocess.PIPE,
stdout, stderr = proc.communicate() **kargs)
stdout, stderr = proc.communicate()
except Exception as e:
raise Exception('Command failed', e, args)
if proc.returncode: if proc.returncode:
if raise_on_error: if raise_on_error:
raise Exception('Command failed: ' + ' '.join(args) + ':\n' + stdout + raise Exception('Command failed: ' + ' '.join(args) + ':\n' + stdout +
stderr) stderr)
else: else:
logging.error('Command failed: %s:\n%s%s', ' '.join(args), stdout, stderr) logging.error('Command failed: %s:\n%s%s', ' '.join(args), stdout, stderr)
return stdout, stderr
# compile command line programs, only once # compile command line programs, only once
compiled_progs = [] compiled_progs = []
@ -116,7 +121,7 @@ def topo_server_setup(add_bad_host=False):
'test_ca:_zkocc': 'localhost:%u'%(zkocc_port_base), 'test_ca:_zkocc': 'localhost:%u'%(zkocc_port_base),
'global:_zkocc': 'localhost:%u'%(zkocc_port_base),} 'global:_zkocc': 'localhost:%u'%(zkocc_port_base),}
json.dump(zk_cell_mapping, f) json.dump(zk_cell_mapping, f)
os.putenv('ZK_CLIENT_CONFIG', config) os.environ['ZK_CLIENT_CONFIG'] = config
run([binary_path('zk'), 'touch', '-p', '/zk/test_nj/vt']) run([binary_path('zk'), 'touch', '-p', '/zk/test_nj/vt'])
run([binary_path('zk'), 'touch', '-p', '/zk/test_ny/vt']) run([binary_path('zk'), 'touch', '-p', '/zk/test_ny/vt'])
run([binary_path('zk'), 'touch', '-p', '/zk/test_ca/vt']) run([binary_path('zk'), 'touch', '-p', '/zk/test_ca/vt'])

Просмотреть файл

@ -104,6 +104,8 @@ def main(mod=None):
except KeyboardInterrupt: except KeyboardInterrupt:
logging.warning("======== Tests interrupted, cleaning up ========") logging.warning("======== Tests interrupted, cleaning up ========")
mod.tearDownModule() mod.tearDownModule()
# If you interrupt a test, you probably want to stop evaluating the rest.
sys.exit(1)
def remove_tmp_files(): def remove_tmp_files():
try: try: