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
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:
cd test ; echo "schema test"; time ./schema.py $$VT_TEST_FLAGS
cd test ; echo "sharded test"; time ./sharded.py $$VT_TEST_FLAGS
cd test ; echo "tabletmanager test"; time ./tabletmanager.py $$VT_TEST_FLAGS
cd test ; echo "clone test"; time ./clone.py $$VT_TEST_FLAGS
cd test ; echo "reparent test"; time ./reparent.py $$VT_TEST_FLAGS
cd test ; echo "zkocc test"; time ./zkocc_test.py $$VT_TEST_FLAGS
cd test ; echo "updatestream test"; time ./update_stream.py
cd test ; echo "rowcache_invalidator test"; time ./rowcache_invalidator.py
cd test ; echo "secure test"; time ./secure.py $$VT_TEST_FLAGS
cd test ; echo "resharding test"; time ./resharding.py $$VT_TEST_FLAGS
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
cd test ; \
for t in $(integration_test_files) ; do \
echo Running test/$$t... ; \
output=$$(time ./$$t $$VT_TEST_FLAGS 2>&1) ; \
if [[ $$? != 0 ]]; then \
echo $output >&2 ; \
exit 1 ; \
fi ; \
echo ; \
done
bson:
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 PATH=$(prepend_path $PATH $VTROOT/bin)
# Add the current GOBIN
if [ "$GOBIN" ]; then
export PATH=$(prepend_path $PATH $GOBIN)
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)
# GOROOT sanity

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

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

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

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