Skip to content

Commit

Permalink
TEST: Fixes to regression test
Browse files Browse the repository at this point in the history
  • Loading branch information
pauldmccarthy committed Oct 18, 2021
1 parent 1d6e74e commit 5c973cd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
7 changes: 3 additions & 4 deletions indexed_gzip/tests/ctest_zran.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1448,7 +1448,7 @@ def test_inflateInit_leak_on_error():


# pauldmccarthy/indexed_gzip#80
def test_read_eof_memmove_rotate_bug():
def test_read_eof_memmove_rotate_bug(seed):

# This bug was triggered by the read buffer rotation
# that takes place in zran.c::_zran_read_data_from_file,
Expand All @@ -1471,17 +1471,16 @@ def test_read_eof_memmove_rotate_bug():
cdef FILE *cfid

with tempdir():
nelems = np.random.randint(524288, 525000, 1)
nelems = np.random.randint(524288, 525000, 1)[0]
data = np.random.random(nelems)
with gzip.open('test.gz', 'wb') as f:
f.write(data)
f.write(data.tobytes())

fsize = os.stat('test.gz').st_size
readbuf_size = fsize - 10

with open('test.gz', 'rb') as pyfid:
cfid = fdopen(pyfid.fileno(), 'rb')

assert not zran.zran_init(&index,
cfid,
NULL,
Expand Down
4 changes: 2 additions & 2 deletions indexed_gzip/tests/test_zran.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,5 +131,5 @@ def test_standard_usage_with_null_padding(concat):
def test_inflateInit_leak_on_error():
ctest_zran.test_inflateInit_leak_on_error()

def test_read_eof_memmove_rotate_bug():
ctest_zran.test_read_eof_memmove_rotate_bug()
def test_read_eof_memmove_rotate_bug(seed):
ctest_zran.test_read_eof_memmove_rotate_bug(seed)

0 comments on commit 5c973cd

Please sign in to comment.