[Xfce4-commits] <midori:master> Allow overriding test timeout with MIDORI_TIMEOUT

Christian Dywan noreply at xfce.org
Sat Mar 30 17:44:01 CET 2013


Updating branch refs/heads/master
         to aa149553d64cf1a54d4baa904e146e91ae06c972 (commit)
       from 4d6250359b950aa5267bc903d98bf28c499c0831 (commit)

commit aa149553d64cf1a54d4baa904e146e91ae06c972
Author: Christian Dywan <christian at twotoasts.de>
Date:   Sat Mar 30 16:59:48 2013 +0100

    Allow overriding test timeout with MIDORI_TIMEOUT
    
    The appropriate timeout depends on the system; if
    the default fails, it can now allow tests to pass.

 midori/midori-dialog.vala |    3 ++-
 wscript                   |    4 +++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/midori/midori-dialog.vala b/midori/midori-dialog.vala
index 4edade3..507f4e6 100644
--- a/midori/midori-dialog.vala
+++ b/midori/midori-dialog.vala
@@ -27,8 +27,9 @@ namespace Midori {
         internal static uint test_max_timeout = 0;
         internal static string? test_first_try = null;
         public void grab_max_timeout () {
+            int seconds = (Environment.get_variable ("MIDORI_TIMEOUT") ?? "42").to_int ();
             test_first_try = "once";
-            test_max_timeout = GLib.Timeout.add_seconds (21, ()=>{
+            test_max_timeout = GLib.Timeout.add_seconds (seconds > 0 ? seconds / 2 : 0, ()=>{
                 stdout.printf ("Timed out %s%s\n", test_first_try,
                     MainContext.default ().pending () ? " (loop)" : "");
                 if (test_first_try == "twice")
diff --git a/wscript b/wscript
index e197d3e..34aff6d 100644
--- a/wscript
+++ b/wscript
@@ -585,7 +585,7 @@ def shutdown ():
             def t_kill ():
                 Utils.pprint ('RED', 'timed out')
                 os.kill (pp.pid, signal.SIGABRT)
-            t = threading.Timer (42, t_kill)
+            t = threading.Timer (int(os.environ.get ('MIDORI_TIMEOUT', '42')), t_kill)
             t.start ()
             if is_mingw (Build.bld.env):
                 args.insert (0, 'wine')
@@ -687,6 +687,8 @@ def shutdown ():
             Utils.pprint ('BLUE', 'Set MIDORI_UNITS to select a subset of test cases')
         if not 'MIDORI_TEST' in os.environ:
             Utils.pprint ('BLUE', 'Set MIDORI_TEST to "valgrind" or "callgrind" to perform memory checks')
+        if not 'MIDORI_TIMEOUT' in os.environ:
+            Utils.pprint ('BLUE', 'Set MIDORI_TIMEOUT to set the maximum test runtime (default: 42)')
         # if test.num_tests_failed > 0 or test.num_tests_err > 0:
         #     sys.exit (1)
 


More information about the Xfce4-commits mailing list