[Xfce4-commits] <midori:master> Replace MIDORI_TEST_UNDEFINED with 42s hard timeout
Christian Dywan
noreply at xfce.org
Fri Jan 4 01:04:02 CET 2013
Updating branch refs/heads/master
to 87101d9ae5b90293f721b09238c1ea6a349cf7a5 (commit)
from b0085aabd9830af5cf2e33ca3b36de110c56e4b7 (commit)
commit 87101d9ae5b90293f721b09238c1ea6a349cf7a5
Author: Christian Dywan <christian at twotoasts.de>
Date: Fri Jan 4 00:40:33 2013 +0100
Replace MIDORI_TEST_UNDEFINED with 42s hard timeout
The test process will be killed if run too long.
tests/download.vala | 2 --
tests/tab.vala | 2 --
wscript | 31 ++++++++++++++++++++-----------
3 files changed, 20 insertions(+), 15 deletions(-)
diff --git a/tests/download.vala b/tests/download.vala
index 262b969..f7ebe35 100644
--- a/tests/download.vala
+++ b/tests/download.vala
@@ -75,8 +75,6 @@ void download_properties () {
assert (Midori.Download.get_type (download) == Midori.DownloadType.OPEN);
assert (Midori.Download.get_progress (download) == 0.0);
- if (Environment.get_variable ("MIDORI_TEST_UNDEFINED") != "1") return;
-
try {
string filename;
FileUtils.close (FileUtils.open_tmp ("XXXXXX", out filename));
diff --git a/tests/tab.vala b/tests/tab.vala
index 5d388af..10d7bad 100644
--- a/tests/tab.vala
+++ b/tests/tab.vala
@@ -120,8 +120,6 @@ void tab_special () {
}
void tab_http () {
- if (Environment.get_variable ("MIDORI_TEST_UNDEFINED") != "1") return;
-
Midori.Test.grab_max_timeout ();
Midori.Test.log_set_fatal_handler_for_icons ();
diff --git a/wscript b/wscript
index 7946876..318a7a3 100644
--- a/wscript
+++ b/wscript
@@ -578,6 +578,23 @@ def shutdown ():
for x in ['XDG_CONFIG_HOME', 'XDG_CACHE_HOME', 'XDG_DATA_HOME', 'TMPDIR']:
os.environ[x] = (base % x).lower ()
Utils.check_dir (os.environ[x])
+
+ def subprocess_popen_timeout (args, stdout=None, stderr=None):
+ import threading
+ def t_kill ():
+ Utils.pprint ('RED', 'timed out')
+ os.kill (pp.pid, 0)
+ t = threading.Timer (42, t_kill)
+ t.start ()
+ if is_mingw (Build.bld.env):
+ args.insert (0, 'wine')
+ cwd = Build.bld.env['PREFIX'] + os.sep + 'bin'
+ pp = subprocess.Popen (args, cwd=cwd, stdout=stdout, stderr=stderr)
+ if stdout is None:
+ (out, err) = pp.communicate ()
+ t.cancel ()
+ return pp
+
# Avoid i18n-related false failures
os.environ['LC_ALL'] = 'C'
os.environ['UNIQUE_BACKEND'] = 'bacon'
@@ -606,10 +623,7 @@ def shutdown ():
if is_mingw (Build.bld.env):
filename += '.exe'
args = [filename]
- if is_mingw (Build.bld.env):
- args.insert (0, 'wine')
- pp = Utils.pproc.Popen (args, cwd=Build.bld.env['PREFIX'] + os.sep + 'bin')
- (out, err) = pp.communicate ()
+ pp = subprocess_popen_timeout (args)
test.unit_test_results[label] = int (pp.returncode == 0)
if not test.unit_test_results[label]:
test.num_tests_failed += 1
@@ -633,10 +647,7 @@ def shutdown ():
if is_mingw (Build.bld.env):
filename += '.exe'
args = ['gdb', '--batch', '-ex', 'set print thread-events off', '-ex', 'run', '-ex', 'bt', filename]
- if is_mingw (Build.bld.env):
- args.insert (0, 'wine')
- pp = Utils.pproc.Popen (args, cwd=Build.bld.env['PREFIX'] + os.sep + 'bin')
- (out, err) = pp.communicate ()
+ pp = subprocess_popen_timeout (args)
except OSError:
Utils.pprint ('RED', 'Install gdb to see backtraces')
except KeyboardInterrupt:
@@ -653,9 +664,7 @@ def shutdown ():
else:
continue
try:
- if is_mingw (Build.bld.env):
- args.insert (0, 'wine')
- pp = subprocess.Popen (args, cwd=Build.bld.env['PREFIX'] + os.sep + 'bin', stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+ pp = subprocess_popen_timeout (args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
skip = False
for line in iter(pp.stdout.readline, ''):
if line[:2] != '==':
More information about the Xfce4-commits
mailing list