Skip to content

Commit

Permalink
Skip the large bloom filter test if mmap fails on 32-bit archtectures.
Browse files Browse the repository at this point in the history
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
  • Loading branch information
rlbdv committed May 27, 2013
1 parent c02a235 commit 62d04ba
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions lib/bup/t/tbloom.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import tempfile
import errno, platform, tempfile
from bup import bloom
from bup.helpers import *
from wvtest import *
Expand Down Expand Up @@ -32,6 +32,21 @@ class Idx:
b = bloom.create('bup.bloom', f=tf, expected=100)
WVPASSEQ(b.rwfile, tf)
WVPASSEQ(b.k, 5)

# Test large (~1GiB) filter. This may fail on s390 (31-bit
# architecture), and anywhere else where the address space is
# sufficiently limited.
tf = tempfile.TemporaryFile()
b = bloom.create('bup.bloom', f=tf, expected=2**28, delaywrite=False)
WVPASSEQ(b.k, 4)
skip_test = False
try:
b = bloom.create('bup.bloom', f=tf, expected=2**28, delaywrite=False)
except EnvironmentError, ex:
(ptr_width, linkage) = platform.architecture()
if ptr_width == '32bit' and ex.errno == errno.ENOMEM:
WVMSG('skipping large bloom filter test (mmap probably failed) '
+ str(ex))
skip_test = True
else:
raise
if not skip_test:
WVPASSEQ(b.k, 4)

0 comments on commit 62d04ba

Please sign in to comment.