summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Shorin <kxepal@apache.org>2014-11-15 19:19:36 +0300
committerAlexander Shorin <kxepal@apache.org>2014-11-16 00:51:15 +0300
commit390e9228e8f9c175bc67f7b69d4bf68bcfbf0687 (patch)
tree1cc1ae6293f34d881a93058d61a4dc86a4307bfc
parent9ad3f9bdbbbe23fe56f888b6779863c7c7bb53db (diff)
downloadcouchdb-390e9228e8f9c175bc67f7b69d4bf68bcfbf0687.tar.gz
Run dev/run script in quite mode for javascript tests
-rw-r--r--Makefile2
-rwxr-xr-xdev/run26
2 files changed, 21 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index e881f61c3..986d2dc95 100644
--- a/Makefile
+++ b/Makefile
@@ -68,4 +68,4 @@ eunit: compile
@rebar -r eunit skip_deps=meck,mochiweb,lager,snappy,couch_replicator,fabric,folsom
javascript: compile
- @dev/run test/javascript/run
+ @dev/run -q test/javascript/run
diff --git a/dev/run b/dev/run
index 3f98bf38a..932fbaec5 100755
--- a/dev/run
+++ b/dev/run
@@ -44,22 +44,26 @@ def log(msg):
def decorator(func):
@functools.wraps(func)
def wrapper(*args, **kwargs):
+ def print_(chars):
+ if log.verbose:
+ sys.stdout.write(chars)
+ sys.stdout.flush()
callargs = dict(zip(inspect.getargspec(func).args, args))
callargs.update(kwargs)
- sys.stdout.write(msg.format(**callargs) + '... ')
- sys.stdout.flush()
+ print_(msg.format(**callargs) + '... ')
try:
res = func(*args, **kwargs)
+ except KeyboardInterrupt:
+ print_('ok\n')
except:
- sys.stdout.write('failed\n')
+ print_('failed\n')
raise
else:
- sys.stdout.write('ok\n')
+ print_('ok\n')
return res
- finally:
- sys.stdout.flush()
return wrapper
return decorator
+log.verbose = True
def main():
@@ -74,12 +78,17 @@ def main():
def setup():
opts, args = setup_argparse()
ctx = setup_context(opts, args)
+ setup_logging(ctx)
setup_dirs(ctx)
check_beams(ctx)
setup_configs(ctx)
return ctx
+def setup_logging(ctx):
+ log.verbose = ctx['verbose']
+
+
def setup_argparse():
parser = optparse.OptionParser(description='Runs CouchDB 2.0 dev cluster')
parser.add_option('-a', '--admin', metavar='USER:PASS', default=None,
@@ -87,6 +96,9 @@ def setup_argparse():
parser.add_option("-n", "--nodes", metavar="nodes", default=3,
type=int,
help="Number of development nodes to be spun up")
+ parser.add_option("-q", "--quite",
+ action="store_false", dest="verbose", default=True,
+ help="Don't print anything to STDOUT")
return parser.parse_args()
@@ -98,6 +110,7 @@ def setup_context(opts, args):
'devdir': os.path.dirname(fpath),
'rootdir': os.path.dirname(os.path.dirname(fpath)),
'cmd': ' '.join(args),
+ 'verbose': opts.verbose,
'procs': []}
@@ -314,6 +327,7 @@ def run_command(ctx, cmd):
exit(p.returncode)
+@log('Restart all nodes')
def reboot_nodes(ctx):
kill_processes(ctx)
boot_nodes(ctx)