Return-Path: X-Original-To: apmail-couchdb-commits-archive@www.apache.org Delivered-To: apmail-couchdb-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 7160DCCAE for ; Fri, 28 Nov 2014 21:00:11 +0000 (UTC) Received: (qmail 99258 invoked by uid 500); 28 Nov 2014 21:00:05 -0000 Delivered-To: apmail-couchdb-commits-archive@couchdb.apache.org Received: (qmail 99176 invoked by uid 500); 28 Nov 2014 21:00:05 -0000 Mailing-List: contact commits-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list commits@couchdb.apache.org Received: (qmail 97890 invoked by uid 99); 28 Nov 2014 21:00:04 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 28 Nov 2014 21:00:04 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id A9A9B8B69BA; Fri, 28 Nov 2014 21:00:04 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: robertkowalski@apache.org To: commits@couchdb.apache.org Date: Fri, 28 Nov 2014 21:00:43 -0000 Message-Id: In-Reply-To: <73dbd4c3aedd405d98e87fed3b3c1cb9@git.apache.org> References: <73dbd4c3aedd405d98e87fed3b3c1cb9@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [41/47] couchdb commit: updated refs/heads/enable-csp-default to dbd38a1 Run dev/run script in quite mode for javascript tests Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/390e9228 Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/390e9228 Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/390e9228 Branch: refs/heads/enable-csp-default Commit: 390e9228e8f9c175bc67f7b69d4bf68bcfbf0687 Parents: 9ad3f9b Author: Alexander Shorin Authored: Sat Nov 15 19:19:36 2014 +0300 Committer: Alexander Shorin Committed: Sun Nov 16 00:51:15 2014 +0300 ---------------------------------------------------------------------- Makefile | 2 +- dev/run | 26 ++++++++++++++++++++------ 2 files changed, 21 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb/blob/390e9228/Makefile ---------------------------------------------------------------------- diff --git a/Makefile b/Makefile index e881f61..986d2dc 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 http://git-wip-us.apache.org/repos/asf/couchdb/blob/390e9228/dev/run ---------------------------------------------------------------------- diff --git a/dev/run b/dev/run index 3f98bf3..932fbae 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)