Gitweb links:
...log
http://git.netsurf-browser.org/netsurf.git/shortlog/e39afa3c9734399c0285a019980147710761a589
...commit
http://git.netsurf-browser.org/netsurf.git/commit/e39afa3c9734399c0285a019980147710761a589
...tree
http://git.netsurf-browser.org/netsurf.git/tree/e39afa3c9734399c0285a019980147710761a589
The branch, master has been updated
via e39afa3c9734399c0285a019980147710761a589 (commit)
from 86f73b767a00dc4a78d86c3225583970149e2905 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff
http://git.netsurf-browser.org/netsurf.git/commit/?id=e39afa3c9734399c0285a019980147710761a589
commit e39afa3c9734399c0285a019980147710761a589
Author: Vincent Sanders <[email protected]>
Commit: Vincent Sanders <[email protected]>
allow setting division pararameter on test plan fetch
diff --git a/test/monkey-see-monkey-do b/test/monkey-see-monkey-do
index 8de29fa..48d9953 100755
--- a/test/monkey-see-monkey-do
+++ b/test/monkey-see-monkey-do
@@ -1,26 +1,30 @@
#!/usr/bin/python3
-# If you have any poo, fling it now!
+'''
+NetSurf automated test runner
-BASE_PATH="https://test.netsurf-browser.org/cgi-bin/monkey-index.cgi"
-MONKEY_PATH="./nsmonkey"
+This script retrives a test plan from the NetSurf infrastructure and
+ executes it using the monkey frontend
+'''
-# Otherwise let's begin...
+# If you have any poo, fling it now!
import sys
import getopt
-import yaml
-
import multiprocessing as mp
-
-from urllib import request
+from urllib import request, parse
from io import StringIO
-
+import yaml
import monkey_driver as driver
+# Otherwise let's begin...
+
+BASE_PATH = "https://test.netsurf-browser.org/cgi-bin/monkey-index.cgi"
+MONKEY_PATH = "./nsmonkey"
+
mp.set_start_method('fork')
-def child_run_test(parts):
+def child_run_test(verbose, parts):
outcapture = StringIO()
errcapture = StringIO()
oldout = sys.stdout
@@ -40,23 +44,24 @@ def child_run_test(parts):
else:
sys.stdout = oldout
sys.stderr = olderr
- if verbose == True:
+ if verbose:
print("STDOUT:\n{}\n".format(outcapture.getvalue()))
-def run_test(parts):
- p = mp.Process(target=child_run_test, args=(parts, ))
+def run_test(verbose, parts):
+ p = mp.Process(target=child_run_test, args=(verbose, parts, ))
p.start()
p.join()
return p.exitcode
def print_usage():
print('Usage:')
- print(' ' + sys.argv[0] + ' [-v] [-h]')
+ print(' ' + sys.argv[0] + ' [-v] [-h] [-d <division>]')
def parse_argv(argv):
- verbose=False
+ verbose = False
+ division = 'index'
try:
- opts, args = getopt.getopt(argv,"hv",[])
+ opts, args = getopt.getopt(argv, "hvd:", [])
except getopt.GetoptError:
print_usage()
sys.exit(2)
@@ -65,32 +70,43 @@ def parse_argv(argv):
print_usage()
sys.exit()
elif opt in ("-v", "--verbose"):
- verbose=True
- return verbose
-
-verbose = parse_argv(sys.argv[1:])
-
-print("Fetching tests...")
-index = request.urlopen(BASE_PATH)
-index = index.read()
-print("Parsing tests...")
-test_set = yaml.load_all(index)
-
-print("Running tests...")
-ret = 0
-for test in test_set:
- if test["kind"] == 'group':
- print("Start group: {}".format(test["group"]))
- print(" [ {} ]".format(test["description"]))
- elif test["kind"] == 'test':
- print(" => Run test: {}".format(test["filename"]))
- ret = run_test(test["content"])
- if ret != 0:
- break
-
-if ret != 0:
- print("FAIL")
- sys.exit(1)
-else:
- print("PASS")
- sys.exit(0)
+ verbose = True
+ elif opt == '-d':
+ division = arg
+
+ return verbose, division
+
+def main():
+ verbose, division = parse_argv(sys.argv[1:])
+
+ print("Fetching tests...")
+ data = parse.urlencode({"division": division}).encode()
+ req = request.Request(BASE_PATH, data=data)
+ index = request.urlopen(req)
+ index = index.read()
+
+ print("Parsing tests...")
+ test_set = yaml.load_all(index)
+
+ print("Running tests...")
+ ret = 0
+ for test in test_set:
+ if test["kind"] == 'group':
+ print("Start group: {}".format(test["group"]))
+ print(" [ {} ]".format(test["description"]))
+ elif test["kind"] == 'test':
+ print(" => Run test: {}".format(test["filename"]))
+ ret = run_test(verbose, test["content"])
+ if ret != 0:
+ break
+
+ if ret != 0:
+ print("FAIL")
+ sys.exit(1)
+ else:
+ print("PASS")
+ sys.exit(0)
+
+
+if __name__ == "__main__":
+ main()
-----------------------------------------------------------------------
Summary of changes:
test/monkey-see-monkey-do | 106 ++++++++++++++++++++++++++-------------------
1 file changed, 61 insertions(+), 45 deletions(-)
diff --git a/test/monkey-see-monkey-do b/test/monkey-see-monkey-do
index 8de29fa..48d9953 100755
--- a/test/monkey-see-monkey-do
+++ b/test/monkey-see-monkey-do
@@ -1,26 +1,30 @@
#!/usr/bin/python3
-# If you have any poo, fling it now!
+'''
+NetSurf automated test runner
-BASE_PATH="https://test.netsurf-browser.org/cgi-bin/monkey-index.cgi"
-MONKEY_PATH="./nsmonkey"
+This script retrives a test plan from the NetSurf infrastructure and
+ executes it using the monkey frontend
+'''
-# Otherwise let's begin...
+# If you have any poo, fling it now!
import sys
import getopt
-import yaml
-
import multiprocessing as mp
-
-from urllib import request
+from urllib import request, parse
from io import StringIO
-
+import yaml
import monkey_driver as driver
+# Otherwise let's begin...
+
+BASE_PATH = "https://test.netsurf-browser.org/cgi-bin/monkey-index.cgi"
+MONKEY_PATH = "./nsmonkey"
+
mp.set_start_method('fork')
-def child_run_test(parts):
+def child_run_test(verbose, parts):
outcapture = StringIO()
errcapture = StringIO()
oldout = sys.stdout
@@ -40,23 +44,24 @@ def child_run_test(parts):
else:
sys.stdout = oldout
sys.stderr = olderr
- if verbose == True:
+ if verbose:
print("STDOUT:\n{}\n".format(outcapture.getvalue()))
-def run_test(parts):
- p = mp.Process(target=child_run_test, args=(parts, ))
+def run_test(verbose, parts):
+ p = mp.Process(target=child_run_test, args=(verbose, parts, ))
p.start()
p.join()
return p.exitcode
def print_usage():
print('Usage:')
- print(' ' + sys.argv[0] + ' [-v] [-h]')
+ print(' ' + sys.argv[0] + ' [-v] [-h] [-d <division>]')
def parse_argv(argv):
- verbose=False
+ verbose = False
+ division = 'index'
try:
- opts, args = getopt.getopt(argv,"hv",[])
+ opts, args = getopt.getopt(argv, "hvd:", [])
except getopt.GetoptError:
print_usage()
sys.exit(2)
@@ -65,32 +70,43 @@ def parse_argv(argv):
print_usage()
sys.exit()
elif opt in ("-v", "--verbose"):
- verbose=True
- return verbose
-
-verbose = parse_argv(sys.argv[1:])
-
-print("Fetching tests...")
-index = request.urlopen(BASE_PATH)
-index = index.read()
-print("Parsing tests...")
-test_set = yaml.load_all(index)
-
-print("Running tests...")
-ret = 0
-for test in test_set:
- if test["kind"] == 'group':
- print("Start group: {}".format(test["group"]))
- print(" [ {} ]".format(test["description"]))
- elif test["kind"] == 'test':
- print(" => Run test: {}".format(test["filename"]))
- ret = run_test(test["content"])
- if ret != 0:
- break
-
-if ret != 0:
- print("FAIL")
- sys.exit(1)
-else:
- print("PASS")
- sys.exit(0)
+ verbose = True
+ elif opt == '-d':
+ division = arg
+
+ return verbose, division
+
+def main():
+ verbose, division = parse_argv(sys.argv[1:])
+
+ print("Fetching tests...")
+ data = parse.urlencode({"division": division}).encode()
+ req = request.Request(BASE_PATH, data=data)
+ index = request.urlopen(req)
+ index = index.read()
+
+ print("Parsing tests...")
+ test_set = yaml.load_all(index)
+
+ print("Running tests...")
+ ret = 0
+ for test in test_set:
+ if test["kind"] == 'group':
+ print("Start group: {}".format(test["group"]))
+ print(" [ {} ]".format(test["description"]))
+ elif test["kind"] == 'test':
+ print(" => Run test: {}".format(test["filename"]))
+ ret = run_test(verbose, test["content"])
+ if ret != 0:
+ break
+
+ if ret != 0:
+ print("FAIL")
+ sys.exit(1)
+ else:
+ print("PASS")
+ sys.exit(0)
+
+
+if __name__ == "__main__":
+ main()
--
NetSurf Browser
_______________________________________________
netsurf-commits mailing list
[email protected]
http://listmaster.pepperfish.net/cgi-bin/mailman/listinfo/netsurf-commits-netsurf-browser.org