pybind11/tests/test_class_sh_shared_ptr_copy_move.py
Ralf W. Grosse-Kunstleve 752626d607 SegFault 20.04 C++11 MinSizeRel all tests, but only first pass after git clean -fdx
NO SegFault 20.04 C++11 Debug all tests, even in first pass after git clean -fdx
BUT then suddenly SegFaults not reproducible anymore even with MinSizeRel!?

Current thread 0x00007f6c7165e740 (most recent call first):
  File "/mounted_pybind11/tests/test_class_sh_shared_ptr_copy_move.py", line 9 in test_shptr_copy

line 9:
    lst = m.test_ShPtr_copy()

This line was added after last observed SegFault
    del mth
2024-07-09 08:39:48 -07:00

54 lines
1.4 KiB
Python

from __future__ import annotations
import pytest
from pybind11_tests import class_sh_shared_ptr_copy_move as m
def test_shptr_copy():
lst = m.test_ShPtr_copy()
itm = lst[0]
del lst
mth = itm.get_history
del itm
txt = mth()
del mth
assert txt == "FooShPtr_copy"
def test_smhld_copy():
pytest.skip("BAKEIN_BREAK: Segmentation fault")
txt = m.test_SmHld_copy()[0].get_history()
assert txt == "FooSmHld_copy"
def test_shptr_move():
pytest.skip("BAKEIN_BREAK: Segmentation fault")
txt = m.test_ShPtr_move()[0].get_history()
assert txt == "FooShPtr_move"
def test_smhld_move():
pytest.skip("BAKEIN_BREAK: Segmentation fault")
txt = m.test_SmHld_move()[0].get_history()
assert txt == "FooSmHld_move"
def _check_property(foo_typ, prop_typ, policy):
o = m.Outer()
name = f"{foo_typ}_{prop_typ}_{policy}"
history = f"Foo{foo_typ}_Outer"
f = getattr(o, name)
assert f.get_history() == history
# and try again to check that o did not get changed
f = getattr(o, name)
assert f.get_history() == history
def test_properties():
pytest.skip("BAKEIN_BREAK: Segmentation fault")
for prop_typ in ("readonly", "readwrite", "property_readonly"):
for foo_typ in ("ShPtr", "SmHld"):
for policy in ("default", "copy", "move"):
_check_property(foo_typ, prop_typ, policy)