Gitweb links:

...log 
http://git.netsurf-browser.org/netsurf.git/shortlog/90e4976800c18d16c66a72c1d0c23b73ce59d7a2
...commit 
http://git.netsurf-browser.org/netsurf.git/commit/90e4976800c18d16c66a72c1d0c23b73ce59d7a2
...tree 
http://git.netsurf-browser.org/netsurf.git/tree/90e4976800c18d16c66a72c1d0c23b73ce59d7a2

The branch, master has been updated
       via  90e4976800c18d16c66a72c1d0c23b73ce59d7a2 (commit)
      from  6fcb0d498f8f5c39a94a8d0c79e425b480c272bc (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=90e4976800c18d16c66a72c1d0c23b73ce59d7a2
commit 90e4976800c18d16c66a72c1d0c23b73ce59d7a2
Author: Michael Drake <[email protected]>
Commit: Michael Drake <[email protected]>

    Monkey driver: Initial loader for monkey test plans.

diff --git a/test/monkey-driver.py b/test/monkey-driver.py
new file mode 100755
index 0000000..25c6422
--- /dev/null
+++ b/test/monkey-driver.py
@@ -0,0 +1,119 @@
+#!/usr/bin/python3
+
+import sys, getopt, yaml
+
+def print_usage():
+    print('Usage:')
+    print('  ' + sys.argv[0] + ' -m <path to monkey> -t <path to test>')
+
+def parse_argv(argv):
+    path_monkey = ''
+    path_test = ''
+    try:
+        opts, args = getopt.getopt(argv,"hm:t:",["monkey=","test="])
+    except getopt.GetoptError:
+        print_usage()
+        sys.exit(2)
+    for opt, arg in opts:
+        if opt == '-h':
+            print_usage()
+            sys.exit()
+        elif opt in ("-m", "--monkey"):
+            path_monkey = arg
+        elif opt in ("-t", "--test"):
+            path_test = arg
+
+    if path_monkey == '':
+        print_usage()
+        sys.exit()
+    if path_test == '':
+        print_usage()
+        sys.exit()
+
+    return path_monkey, path_test
+
+def load_test_plan(path):
+    plan = []
+    with open(path, 'r') as stream:
+        try:
+            plan = (yaml.load(stream))
+        except:
+            print (exc)
+    return plan
+
+def get_indent(ctx):
+    return '  ' * ctx["depth"];
+
+def print_test_plan_info(ctx, plan):
+    print('Running test: [' + plan["group"] + '] ' + plan["title"])
+
+def run_test_step_action_launch(ctx, step):
+    print(get_indent(ctx) + "Action: " + step["action"])
+
+def run_test_step_action_window_new(ctx, step):
+    print(get_indent(ctx) + "Action: " + step["action"])
+
+def run_test_step_action_window_close(ctx, step):
+    print(get_indent(ctx) + "Action: " + step["action"])
+
+def run_test_step_action_navigate(ctx, step):
+    print(get_indent(ctx) + "Action: " + step["action"])
+
+def run_test_step_action_sleep_ms(ctx, step):
+    print(get_indent(ctx) + "Action: " + step["action"])
+
+def run_test_step_action_block(ctx, step):
+    print(get_indent(ctx) + "Action: " + step["action"])
+
+def run_test_step_action_repeat(ctx, step):
+    print(get_indent(ctx) + "Action: " + step["action"])
+    ctx["depth"] += 1
+    for step in step["steps"]:
+        run_test_step(ctx, step)
+    ctx["depth"] -= 1
+
+def run_test_step_action_timer_start(ctx, step):
+    print(get_indent(ctx) + "Action: " + step["action"])
+
+def run_test_step_action_timer_stop(ctx, step):
+    print(get_indent(ctx) + "Action: " + step["action"])
+
+def run_test_step_action_timer_check(ctx, step):
+    print(get_indent(ctx) + "Action: " + step["action"])
+
+def run_test_step_action_quit(ctx, step):
+    print(get_indent(ctx) + "Action: " + step["action"])
+
+step_handlers = {
+    "launch":       run_test_step_action_launch,
+    "window-new":   run_test_step_action_window_new,
+    "window-close": run_test_step_action_window_close,
+    "navigate":     run_test_step_action_navigate,
+    "sleep-ms":     run_test_step_action_sleep_ms,
+    "block":        run_test_step_action_block,
+    "repeat":       run_test_step_action_repeat,
+    "timer-start":  run_test_step_action_timer_start,
+    "timer-stop":   run_test_step_action_timer_stop,
+    "timer-check":  run_test_step_action_timer_check,
+    "quit":         run_test_step_action_quit,
+}
+
+def run_test_step(ctx, step):
+    step_handlers[step["action"]](ctx, step)
+
+def walk_test_plan(ctx, plan):
+    ctx["depth"] = 0
+    for step in plan["steps"]:
+        run_test_step(ctx, step)
+
+
+def main(argv):
+    ctx = {}
+    path_monkey, path_test = parse_argv(argv)
+    plan = load_test_plan(path_test)
+    print_test_plan_info(ctx, plan)
+    walk_test_plan(ctx, plan)
+
+# Some python weirdness to get to main().
+if __name__ == "__main__":
+    main(sys.argv[1:])
\ No newline at end of file
diff --git a/test/monkey-tests/cache-test.yaml 
b/test/monkey-tests/cache-test.yaml
new file mode 100644
index 0000000..d8c4571
--- /dev/null
+++ b/test/monkey-tests/cache-test.yaml
@@ -0,0 +1,35 @@
+title: cache test
+group: performance
+steps:
+- action: launch
+  language: en
+- action: timer-start
+  tag: timer1
+- action: window-new
+  tag: win1
+- action: navigate
+  window: win1
+  url: http://www.bbc.co.uk/news
+- action: block
+  conditions:
+  - window: win1
+    status: complete
+- action: timer-stop
+  timer: timer1
+- action: timer-start
+  tag: timer2
+- action: window-new
+  tag: win2
+- action: navigate
+  window: win2
+  url: http://www.bbc.co.uk/news
+- action: block
+  conditions:
+  - window: win2
+    status: complete
+- action: timer-stop
+  timer: timer2
+- action: timer-check
+  condition: timer2 < timer1
+- action: quit
+
diff --git a/test/monkey-tests/quit-mid-fetch.yaml 
b/test/monkey-tests/quit-mid-fetch.yaml
new file mode 100644
index 0000000..b033f67
--- /dev/null
+++ b/test/monkey-tests/quit-mid-fetch.yaml
@@ -0,0 +1,22 @@
+title: quitting mid-fetch
+group: cleanup
+steps:
+- action: repeat
+  min: 0
+  step: 50
+  name: sleepytimer
+  steps:
+  - action: launch
+  - action: window-new
+    tag: win1
+  - action: navigate
+    window: win1
+    url: http://www.bbc.co.uk/news
+  - action: sleep-ms
+    time: sleepytimer
+    conditions:
+    - window: win1
+      status: complete
+    breaks: sleepytimer
+  - action: quit
+


-----------------------------------------------------------------------

Summary of changes:
 test/monkey-driver.py                 |  119 +++++++++++++++++++++++++++++++++
 test/monkey-tests/cache-test.yaml     |   35 ++++++++++
 test/monkey-tests/quit-mid-fetch.yaml |   22 ++++++
 3 files changed, 176 insertions(+)
 create mode 100755 test/monkey-driver.py
 create mode 100644 test/monkey-tests/cache-test.yaml
 create mode 100644 test/monkey-tests/quit-mid-fetch.yaml

diff --git a/test/monkey-driver.py b/test/monkey-driver.py
new file mode 100755
index 0000000..25c6422
--- /dev/null
+++ b/test/monkey-driver.py
@@ -0,0 +1,119 @@
+#!/usr/bin/python3
+
+import sys, getopt, yaml
+
+def print_usage():
+    print('Usage:')
+    print('  ' + sys.argv[0] + ' -m <path to monkey> -t <path to test>')
+
+def parse_argv(argv):
+    path_monkey = ''
+    path_test = ''
+    try:
+        opts, args = getopt.getopt(argv,"hm:t:",["monkey=","test="])
+    except getopt.GetoptError:
+        print_usage()
+        sys.exit(2)
+    for opt, arg in opts:
+        if opt == '-h':
+            print_usage()
+            sys.exit()
+        elif opt in ("-m", "--monkey"):
+            path_monkey = arg
+        elif opt in ("-t", "--test"):
+            path_test = arg
+
+    if path_monkey == '':
+        print_usage()
+        sys.exit()
+    if path_test == '':
+        print_usage()
+        sys.exit()
+
+    return path_monkey, path_test
+
+def load_test_plan(path):
+    plan = []
+    with open(path, 'r') as stream:
+        try:
+            plan = (yaml.load(stream))
+        except:
+            print (exc)
+    return plan
+
+def get_indent(ctx):
+    return '  ' * ctx["depth"];
+
+def print_test_plan_info(ctx, plan):
+    print('Running test: [' + plan["group"] + '] ' + plan["title"])
+
+def run_test_step_action_launch(ctx, step):
+    print(get_indent(ctx) + "Action: " + step["action"])
+
+def run_test_step_action_window_new(ctx, step):
+    print(get_indent(ctx) + "Action: " + step["action"])
+
+def run_test_step_action_window_close(ctx, step):
+    print(get_indent(ctx) + "Action: " + step["action"])
+
+def run_test_step_action_navigate(ctx, step):
+    print(get_indent(ctx) + "Action: " + step["action"])
+
+def run_test_step_action_sleep_ms(ctx, step):
+    print(get_indent(ctx) + "Action: " + step["action"])
+
+def run_test_step_action_block(ctx, step):
+    print(get_indent(ctx) + "Action: " + step["action"])
+
+def run_test_step_action_repeat(ctx, step):
+    print(get_indent(ctx) + "Action: " + step["action"])
+    ctx["depth"] += 1
+    for step in step["steps"]:
+        run_test_step(ctx, step)
+    ctx["depth"] -= 1
+
+def run_test_step_action_timer_start(ctx, step):
+    print(get_indent(ctx) + "Action: " + step["action"])
+
+def run_test_step_action_timer_stop(ctx, step):
+    print(get_indent(ctx) + "Action: " + step["action"])
+
+def run_test_step_action_timer_check(ctx, step):
+    print(get_indent(ctx) + "Action: " + step["action"])
+
+def run_test_step_action_quit(ctx, step):
+    print(get_indent(ctx) + "Action: " + step["action"])
+
+step_handlers = {
+    "launch":       run_test_step_action_launch,
+    "window-new":   run_test_step_action_window_new,
+    "window-close": run_test_step_action_window_close,
+    "navigate":     run_test_step_action_navigate,
+    "sleep-ms":     run_test_step_action_sleep_ms,
+    "block":        run_test_step_action_block,
+    "repeat":       run_test_step_action_repeat,
+    "timer-start":  run_test_step_action_timer_start,
+    "timer-stop":   run_test_step_action_timer_stop,
+    "timer-check":  run_test_step_action_timer_check,
+    "quit":         run_test_step_action_quit,
+}
+
+def run_test_step(ctx, step):
+    step_handlers[step["action"]](ctx, step)
+
+def walk_test_plan(ctx, plan):
+    ctx["depth"] = 0
+    for step in plan["steps"]:
+        run_test_step(ctx, step)
+
+
+def main(argv):
+    ctx = {}
+    path_monkey, path_test = parse_argv(argv)
+    plan = load_test_plan(path_test)
+    print_test_plan_info(ctx, plan)
+    walk_test_plan(ctx, plan)
+
+# Some python weirdness to get to main().
+if __name__ == "__main__":
+    main(sys.argv[1:])
\ No newline at end of file
diff --git a/test/monkey-tests/cache-test.yaml 
b/test/monkey-tests/cache-test.yaml
new file mode 100644
index 0000000..d8c4571
--- /dev/null
+++ b/test/monkey-tests/cache-test.yaml
@@ -0,0 +1,35 @@
+title: cache test
+group: performance
+steps:
+- action: launch
+  language: en
+- action: timer-start
+  tag: timer1
+- action: window-new
+  tag: win1
+- action: navigate
+  window: win1
+  url: http://www.bbc.co.uk/news
+- action: block
+  conditions:
+  - window: win1
+    status: complete
+- action: timer-stop
+  timer: timer1
+- action: timer-start
+  tag: timer2
+- action: window-new
+  tag: win2
+- action: navigate
+  window: win2
+  url: http://www.bbc.co.uk/news
+- action: block
+  conditions:
+  - window: win2
+    status: complete
+- action: timer-stop
+  timer: timer2
+- action: timer-check
+  condition: timer2 < timer1
+- action: quit
+
diff --git a/test/monkey-tests/quit-mid-fetch.yaml 
b/test/monkey-tests/quit-mid-fetch.yaml
new file mode 100644
index 0000000..b033f67
--- /dev/null
+++ b/test/monkey-tests/quit-mid-fetch.yaml
@@ -0,0 +1,22 @@
+title: quitting mid-fetch
+group: cleanup
+steps:
+- action: repeat
+  min: 0
+  step: 50
+  name: sleepytimer
+  steps:
+  - action: launch
+  - action: window-new
+    tag: win1
+  - action: navigate
+    window: win1
+    url: http://www.bbc.co.uk/news
+  - action: sleep-ms
+    time: sleepytimer
+    conditions:
+    - window: win1
+      status: complete
+    breaks: sleepytimer
+  - action: quit
+


-- 
NetSurf Browser

_______________________________________________
netsurf-commits mailing list
[email protected]
http://listmaster.pepperfish.net/cgi-bin/mailman/listinfo/netsurf-commits-netsurf-browser.org

Reply via email to