You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ch...@apache.org on 2018/06/22 22:15:51 UTC

[couchdb] 22/31: Integrate Elixir suite with `make`

This is an automated email from the ASF dual-hosted git repository.

chewbranca pushed a commit to branch elixir-suite
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 17f8de1fd3154cc0005f47ad929edcf2350b99ff
Author: Paul J. Davis <pa...@gmail.com>
AuthorDate: Fri Dec 15 12:08:33 2017 -0600

    Integrate Elixir suite with `make`
---
 Makefile        |  5 +++++
 dev/run         | 25 ++++++++++++++++---------
 test/elixir/run |  4 ++++
 3 files changed, 25 insertions(+), 9 deletions(-)

diff --git a/Makefile b/Makefile
index 1e0ea82..db54294 100644
--- a/Makefile
+++ b/Makefile
@@ -137,6 +137,11 @@ soak-eunit: couch
 	@$(REBAR) setup_eunit 2> /dev/null
 	while [ $$? -eq 0 ] ; do $(REBAR) -r eunit $(EUNIT_OPTS) ; done
 
+.PHONY: elixir
+elixir:
+	@rm -rf dev/lib
+	@dev/run -a adm:pass --no-eval test/elixir/run
+
 .PHONY: javascript
 # target: javascript - Run JavaScript test suites or specific ones defined by suites option
 javascript: devclean
diff --git a/dev/run b/dev/run
index a5d8fde..5ab895e 100755
--- a/dev/run
+++ b/dev/run
@@ -132,6 +132,8 @@ def setup_argparse():
                       help='Optional key=val config overrides. Can be repeated')
     parser.add_option('--degrade-cluster', dest="degrade_cluster",type=int, default=0,
                       help='The number of nodes that should be stopped after cluster config')
+    parser.add_option('--no-eval', action='store_true', default=False,
+                      help='Do not eval subcommand output')
     return parser.parse_args()
 
 
@@ -153,6 +155,7 @@ def setup_context(opts, args):
             'haproxy': opts.haproxy,
             'haproxy_port': opts.haproxy_port,
             'config_overrides': opts.config_overrides,
+            'no_eval': opts.no_eval,
             'reset_logs': True,
             'procs': []}
 
@@ -569,15 +572,19 @@ def join(ctx, lead_port, user, password):
 
 @log('Exec command {cmd}')
 def run_command(ctx, cmd):
-    p = sp.Popen(cmd, shell=True, stdout=sp.PIPE, stderr=sys.stderr)
-    while True:
-        line = p.stdout.readline()
-        if not line:
-            break
-        eval(line)
-    p.wait()
-    exit(p.returncode)
-
+    if ctx['no_eval']:
+        p = sp.Popen(cmd, shell=True)
+        p.wait()
+        exit(p.returncode)
+    else:
+        p = sp.Popen(cmd, shell=True, stdout=sp.PIPE, stderr=sys.stderr)
+        while True:
+            line = p.stdout.readline()
+            if not line:
+                break
+            eval(line)
+        p.wait()
+        exit(p.returncode)
 
 @log('Restart all nodes')
 def reboot_nodes(ctx):
diff --git a/test/elixir/run b/test/elixir/run
new file mode 100755
index 0000000..66a5947
--- /dev/null
+++ b/test/elixir/run
@@ -0,0 +1,4 @@
+#!/bin/bash -e
+cd "$(dirname "$0")"
+mix deps.get
+mix test --trace