cschwan / sage-on-gentoo

(Unofficial) Gentoo Overlay for Sage- and Sage-related ebuilds
84 stars 26 forks source link

return of the memory handling test #526

Closed kiwifb closed 4 years ago

kiwifb commented 5 years ago

Things have improved in the memory management land of sage but a doctest has a bizarre behavior

sage -t --long /usr/lib64/python2.7/site-packages/sage/doctest/test.py
**********************************************************************
File "/usr/lib64/python2.7/site-packages/sage/doctest/test.py", line 511, in sage.doctest.test
Failed example:
    ok or out
Expected:
    True
Got:
    'Running doctests with ID 2018-10-23-09-06-49-e5df7191.\nUsing --optional=dochtml,memlimit,optional,sage\nDoctesting 1 file.\nsage -t --warn-long 0.0 memlimit.rst\n**********************************************************************\nFile "memlimit.rst", line 3, in sage.doctest.tests.memlimit\nFailed example:\n    256 ^ (2000 << 20)  # optional - memlimit\nException raised:\n    Traceback (most recent call last):\n      File "/usr/lib64/python2.7/site-packages/sage/doctest/forker.py", line 671, in _run\n        self.compile_and_execute(example, compiler, test.globs)\n      File "/usr/lib64/python2.7/site-packages/sage/doctest/forker.py", line 1086, in compile_and_execute\n        exec(compiled, globs)\n      File "<doctest sage.doctest.tests.memlimit[0]>", line 1, in <module>\n        Integer(256) ** (Integer(2000) << Integer(20))  # optional - memlimit\n      File "sage/rings/integer.pyx", line 2085, in sage.rings.integer.Integer.__pow__ (/dev/shm/portage/sci-mathematics/sage-9999/work/sage-9999/src-python2_7/build/cythonized/sage/rings/integer.c:14170)\n        return (<Integer>left)._pow_(right)\n      File "sage/rings/integer.pyx", line 2153, in sage.rings.integer.Integer._pow_ (/dev/shm/portage/sci-mathematics/sage-9999/work/sage-9999/src-python2_7/build/cythonized/sage/rings/integer.c:14447)\n        return self._pow_long(mpz_get_si(exp))\n      File "sage/rings/integer.pyx", line 2185, in sage.rings.integer.Integer._pow_long (/dev/shm/portage/sci-mathematics/sage-9999/work/sage-9999/src-python2_7/build/cythonized/sage/rings/integer.c:14842)\n        sig_on()\n    RuntimeError: Aborted\n**********************************************************************\n1 item had failures:\n   1 of   2 in sage.doctest.tests.memlimit\n    [1 test, 1 failure, 0.01 s]\n----------------------------------------------------------------------\nsage -t --warn-long 0.0 memlimit.rst  # 1 doctest failed\n----------------------------------------------------------------------\nTotal time for all tests: 0.0 seconds\n    cpu time: 0.0 seconds\n    cumulative wall time: 0.0 seconds\n'

The doctest should be

    sage: from platform import system
    sage: ok = True
    sage: if system() == "Linux":
    ....:     P = subprocess.Popen(["sage", "-t", "--warn-long", "0", "--memlimit=2000", "memlimit.rst"], stdout=subprocess.PIPE, **kwds)
    ....:     out, err = P.communicate()
    ....:     ok = ("MemoryError: failed to allocate" in out)
    sage: ok or out
    True

so err and out seem to be in a strange state.

kiwifb commented 5 years ago

Not helped by using pexpect-4.6.0 unless it depends on sage's speed up patch.

kiwifb commented 4 years ago

Not seen in a while. Closing.