summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTony Sun <tony.sun427@gmail.com>2017-10-13 23:06:34 -0700
committerTony Sun <tony.sun427@gmail.com>2017-10-25 10:58:57 -0700
commit54ac3adaabbac689cf344dfc9c53abd137c8ecbb (patch)
tree5a91a27850abecadbf74d925ada9194c039f01e2
parenta99cc6fda04e35e2266953a73a182c724ed928de (diff)
downloadcouchdb-54ac3adaabbac689cf344dfc9c53abd137c8ecbb.tar.gz
add ability to ignore javascript test suites
Developers can now ignore javascript test suites with the new option ignore_js_suites. Example usage: make javascript ignore_js_suites="all_docs basics" make javascript suites="all_docs basics view_errors" ignore_js_suites= "view_errors" The second example is redundant but the functionality works.
-rw-r--r--Makefile8
-rw-r--r--README-DEV.rst11
-rwxr-xr-xtest/javascript/run57
3 files changed, 55 insertions, 21 deletions
diff --git a/Makefile b/Makefile
index 239a2db1c..2c4bca501 100644
--- a/Makefile
+++ b/Makefile
@@ -36,6 +36,8 @@ DIALYZE_OPTS=$(shell echo "\
skip_deps=$(skip_deps) \
" | sed -e 's/[a-z]\+= / /g')
+#ignore javascript tests
+ignore_js_suites=
################################################################################
# Main commands
@@ -123,7 +125,8 @@ endif
@rm -rf dev/lib
@dev/run -n 1 -q --with-admin-party-please \
-c 'startup_jitter=0' \
- test/javascript/run $(suites)
+ 'test/javascript/run --suites "$(suites)" \
+ --ignore "$(ignore_js_suites)"'
.PHONY: soak-javascript
soak-javascript:
@@ -138,7 +141,8 @@ endif
while [ $$? -eq 0 ]; do \
dev/run -n 1 -q --with-admin-party-please \
-c 'startup_jitter=0' \
- test/javascript/run $(suites); \
+ 'test/javascript/run --suites "$(suites)" \
+ --ignore "$(ignore_js_suites)"' \
done
.PHONY: check-qs
diff --git a/README-DEV.rst b/README-DEV.rst
index 613aea2b6..f8d80ac41 100644
--- a/README-DEV.rst
+++ b/README-DEV.rst
@@ -173,8 +173,15 @@ JavaScript tests accepts only `suites` option, but in the same way::
# Run only basic and design_options tests
make javascript suites="basic design_options"
-Note that tests are delimited here by whitespace, not by comma. You can get list
-of all possible test targets with the following command::
+ # Ignore specific test suites via command line
+ make javascript ignore_js_suites="all_docs bulk_docs"
+
+ # Ignore specific test suites in makefile
+ ignore_js_suites=all_docs,bulk_docs
+
+Note that tests on the command line are delimited here by whitespace,
+not by comma.You can get list of all possible test targets with the
+following command::
make list-js-suites
diff --git a/test/javascript/run b/test/javascript/run
index f7659b0f2..96b3a5696 100755
--- a/test/javascript/run
+++ b/test/javascript/run
@@ -17,6 +17,7 @@ import optparse as op
import os
import subprocess as sp
import sys
+import re
USAGE = "%prog [options] [command to run...]"
@@ -100,7 +101,13 @@ def options():
help="Start from the given filename if multiple files "
"are passed"),
op.make_option("-a", "--all", action="store_true", dest="all",
- help="Run all tests, even if one or more fail")
+ help="Run all tests, even if one or more fail"),
+ op.make_option("-i", "--ignore", type="string", action="callback",
+ default=None, callback=get_delimited_list,
+ dest="ignore", help="Ignore test suites"),
+ op.make_option("-u", "--suites", type="string", action="callback",
+ default=None, callback=get_delimited_list,
+ dest="suites", help="Run specific suites")
]
@@ -108,23 +115,15 @@ def main():
parser = op.OptionParser(usage=USAGE, option_list=options())
opts, args = parser.parse_args()
+ run_list = []
+ ignore_list = []
tests = []
- if not len(args):
- args = ["test/javascript/tests"]
- for name in args:
- if os.path.isdir(name):
- tests.extend(sorted(glob.glob(os.path.join(name, "*.js"))))
- elif os.path.isfile(name):
- tests.append(name)
- else:
- pname = os.path.join("test/javascript/tests", name)
- if os.path.isfile(pname):
- tests.append(pname)
- elif os.path.isfile(pname + ".js"):
- tests.append(pname + ".js")
- else:
- sys.stderr.write("Unknown test: " + name + os.linesep)
- exit(1)
+
+ run_list = ["test/javascript/tests"] if not opts.suites else opts.suites
+ run_list = build_test_case_paths(run_list)
+ ignore_list = build_test_case_paths(opts.ignore)
+ # sort is needed because certain tests fail if executed out of order
+ tests = sorted(list(set(run_list)-set(ignore_list)))
if opts.start is not None:
tmp = []
@@ -152,6 +151,30 @@ def main():
failed, passed) + os.linesep)
exit(failed > 0)
+def build_test_case_paths(args=None):
+ tests = []
+ if args is None:
+ args = []
+ for name in args:
+ if os.path.isdir(name):
+ tests.extend(sorted(glob.glob(os.path.join(name, "*.js"))))
+ elif os.path.isfile(name):
+ check = tests.append(name)
+ else:
+ pname = os.path.join("test/javascript/tests", name)
+ if os.path.isfile(pname):
+ tests.append(pname)
+ elif os.path.isfile(pname + ".js"):
+ tests.append(pname + ".js")
+ else:
+ sys.stderr.write("Unknown test: " + name + os.linesep)
+ exit(1)
+ return tests
+
+
+def get_delimited_list(option, opt, value, parser):
+ delimited = [i for i in re.split(r',|\s', value.strip()) if i]
+ setattr(parser.values, option.dest, delimited)
if __name__ == "__main__":
try: