2023-10-03 17:52:50 +00:00
|
|
|
import pytest
|
|
|
|
|
2023-10-03 18:24:52 +00:00
|
|
|
from invokeai.backend.model_management.libc_util import LibcUtil, Struct_mallinfo2
|
2023-10-03 17:52:50 +00:00
|
|
|
|
|
|
|
|
|
|
|
def test_libc_util_mallinfo2():
|
|
|
|
"""Smoke test of LibcUtil().mallinfo2()."""
|
|
|
|
try:
|
|
|
|
libc = LibcUtil()
|
|
|
|
except OSError:
|
|
|
|
# TODO: Set the expected result preemptively based on the system properties.
|
|
|
|
pytest.xfail("libc shared library is not available on this system.")
|
|
|
|
|
2023-10-14 09:10:10 +00:00
|
|
|
try:
|
|
|
|
info = libc.mallinfo2()
|
|
|
|
except AttributeError:
|
|
|
|
pytest.xfail("`mallinfo2` is not available on this system, likely due to glibc < 2.33.")
|
2023-10-03 17:52:50 +00:00
|
|
|
|
|
|
|
assert info.arena > 0
|
2023-10-03 18:24:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
def test_struct_mallinfo2_to_str():
|
|
|
|
"""Smoke test of Struct_mallinfo2.__str__()."""
|
|
|
|
info = Struct_mallinfo2()
|
|
|
|
info_str = str(info)
|
2023-10-03 19:00:03 +00:00
|
|
|
|
|
|
|
assert len(info_str) > 0
|