[SCM] morituri/master: * morituri/common/checksum.py: * morituri/test/Makefile.am: * morituri/test/test_common_checksum.py (added): Add a check to make sure that checksumming an empty file doesn't hang. Fix the hang.
js at users.alioth.debian.org
js at users.alioth.debian.org
Sun Oct 19 20:09:11 UTC 2014
The following commit has been merged in the master branch:
commit d9530cb82aa3e24b78bde4e73b364944520946d6
Author: Thomas Vander Stichele <thomas (at) apestaart (dot) org>
Date: Fri Sep 11 11:48:17 2009 +0000
* morituri/common/checksum.py:
* morituri/test/Makefile.am:
* morituri/test/test_common_checksum.py (added):
Add a check to make sure that checksumming an empty file doesn't
hang. Fix the hang.
diff --git a/ChangeLog b/ChangeLog
index d86be72..c2d6295 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2009-09-11 Thomas Vander Stichele <thomas at apestaart dot org>
+
+ * morituri/common/checksum.py:
+ * morituri/test/Makefile.am:
+ * morituri/test/test_common_checksum.py (added):
+ Add a check to make sure that checksumming an empty file doesn't
+ hang. Fix the hang.
+
2009-09-08 Thomas Vander Stichele <thomas at apestaart dot org>
* morituri.spec.in:
diff --git a/morituri/common/checksum.py b/morituri/common/checksum.py
index 84996b6..4938af3 100644
--- a/morituri/common/checksum.py
+++ b/morituri/common/checksum.py
@@ -82,7 +82,13 @@ class ChecksumTask(task.Task):
if self._frameLength < 0:
self.debug('query duration')
- length, qformat = sink.query_duration(gst.FORMAT_DEFAULT)
+ try:
+ length, qformat = sink.query_duration(gst.FORMAT_DEFAULT)
+ except gst.QueryError, e:
+ self.exception = e
+ self.stop()
+ return
+
# wavparse 0.10.14 returns in bytes
if qformat == gst.FORMAT_BYTES:
self.debug('query returned in BYTES format')
@@ -176,7 +182,7 @@ class ChecksumTask(task.Task):
if not self._last:
# see http://bugzilla.gnome.org/show_bug.cgi?id=578612
print 'ERROR: not a single buffer gotten'
- raise
+ #raise
else:
self._checksum = self._checksum % 2 ** 32
self.debug("last offset %r", self._last.offset)
@@ -328,6 +334,7 @@ class TRMTask(task.Task):
def _bus_error_cb(self, bus, message):
error = message.parse_error()
+ # FIXME: handle properly
print error
def _new_buffer_cb(self, sink):
diff --git a/morituri/test/Makefile.am b/morituri/test/Makefile.am
index 5cec124..6021e74 100644
--- a/morituri/test/Makefile.am
+++ b/morituri/test/Makefile.am
@@ -4,6 +4,7 @@ EXTRA_DIST = \
__init__.py \
common.py \
test_common_accurip.py \
+ test_common_checksum.py \
test_common_program.py \
test_common_renamer.py \
test_image_cue.py \
diff --git a/morituri/test/test_common_checksum.py b/morituri/test/test_common_checksum.py
new file mode 100644
index 0000000..dd720a8
--- /dev/null
+++ b/morituri/test/test_common_checksum.py
@@ -0,0 +1,27 @@
+# -*- Mode: Python; test-case-name: morituri.test.test_common_checksum -*-
+# vi:si:et:sw=4:sts=4:ts=4
+
+import os
+import unittest
+import tempfile
+
+import gobject
+gobject.threads_init()
+
+import gst
+
+from morituri.common import task, checksum
+
+def h(i):
+ return "0x%08x" % i
+
+class EmptyTestCase(unittest.TestCase):
+ def testEmpty(self):
+ # this test makes sure that checksumming empty files doesn't hang
+ self.runner = task.SyncRunner(verbose=False)
+ fd, path = tempfile.mkstemp(suffix='morituri.test.empty')
+ checksumtask = checksum.ChecksumTask(path)
+ # FIXME: do we want a specific error for this ?
+ self.assertRaises(gst.QueryError, self.runner.run,
+ checksumtask, verbose=False)
+ os.unlink(path)
--
morituri packaging
More information about the pkg-multimedia-commits
mailing list