Add basic test for Ftell() in python
authorPanu Matilainen <Panu Matilainen pmatilai@redhat.com>
Mon, 11 Jul 2011 07:13:00 +0000 (10:13 +0300)
committerPanu Matilainen <Panu Matilainen pmatilai@redhat.com>
Mon, 11 Jul 2011 07:13:00 +0000 (10:13 +0300)
tests/rpmpython.at

index 1669715..6e641ac 100644 (file)
@@ -39,11 +39,17 @@ data = msg * 10
 for iot in [ 'fpio', 'fdio', 'ufdio', 'gzdio' ]:
     fn = 'pyio.%s' % iot
     fd = rpm.fd(fn, 'w', iot)
+    pos = fd.tell()
+    if pos != -2 and pos != 0:
+        myprint('bad start pos %d' % fd.tell())
     if fd.write(data) != len(data):
         myprint('%s write fail' % iot)
     if fn != fd.name:
         myprint('bad file name %s' % fd.name)
     fd.flush()
+    pos = fd.tell()
+    if pos != -2 and pos != len(data):
+        myprint('bad end pos %d' % fd.tell())
     fd = rpm.fd(fn, 'r', iot)
     rdata = fd.read()
     if rdata != data: