Skip to content

[DO NOT MERGE] Debug xfails #123

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 3 additions & 35 deletions .github/workflows/MacOS.yml
Original file line number Diff line number Diff line change
Expand Up @@ -534,52 +534,20 @@ jobs:
run: |
# Run the tests
source ${{ github.workspace }}/CppInterOp/.venv/bin/activate
cd ${{ github.workspace }}/test/
cd ${{ github.workspace }}/test
echo ::group::Prepare For Testing
make all
python -m pip install --upgrade pip
python -m pip install pytest
python -m pip install pytest-xdist
python -m pip install numba
echo ::endgroup::
echo ::group::Run complete test suite
set -o pipefail
python -m pytest -sv -ra | tee complete_testrun.log 2>&1
set +o pipefail
echo ::group::Crashing Test Logs
# See if we don't have a crash that went away
# Comment out all xfails but the ones that have a run=False condition.
find . -name "*.py" -exec sed -i '/run=False/!s/^ *@mark.xfail\(.*\)/#&/' {} \;
python -m pytest -n 1 -m "xfail" --runxfail -sv -ra --max-worker-restart 512 | tee test_crashed.log 2>&1 || true
git checkout .
python -m pytest -n 1 -v -ra --max-worker-restart 512 | tee test_crashed.log 2>&1 || true
echo ::endgroup::
echo ::group::XFAIL Test Logs
# Rewrite all xfails that have a run clause to skipif. This way we will
# avoid conditionally crashing xfails
find . -name "*.py" -exec gsed -i -E 's/(^ *)@mark.xfail\(run=(.*)/\[email protected](condition=not \2/g' {} \;
# See if we don't have an xfail that went away
python -m pytest --runxfail -sv -ra | tee test_xfailed.log 2>&1 || true
git checkout .
echo ::endgroup::
echo ::group::Passing Test Logs

# Run the rest of the non-crashing tests.
declare -i RETCODE=0

set -o pipefail
export RETCODE=+$?
echo ::endgroup::

RETCODE=+$?

echo "Complete Test Suite Summary: \n"
tail -n1 complete_testrun.log
echo "Crashing Summary: \n"
echo "Crashing Summary:"
tail -n1 test_crashed.log
echo "XFAIL Summary:"
tail -n1 test_xfailed.log
echo "Return Code: ${RETCODE}"
exit $RETCODE

- name: Show debug info
if: ${{ failure() }}
Expand Down
14 changes: 1 addition & 13 deletions .github/workflows/Ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -620,10 +620,6 @@ jobs:
python -m uv pip install numba
python -m uv pip install psutil
echo ::endgroup::
echo ::group::Run complete test suite
set -o pipefail
python -m pytest -sv -ra | tee complete_testrun.log 2>&1
set +o pipefail
echo ::group::Crashing Test Logs
# See if we don't have a crash that went away
# Comment out all xfails but the ones that have a run=False condition.
Expand Down Expand Up @@ -666,16 +662,8 @@ jobs:
unset IS_VALGRIND
echo ::endgroup::

RETCODE=+$?

echo "Complete Test Suite Summary: \n"
tail -n1 complete_testrun.log
echo "Crashing Summary: \n"
echo "Crashing Summary:"
tail -n1 test_crashed.log
echo "XFAIL Summary:"
tail -n1 test_xfailed.log
echo "Return Code: ${RETCODE}"
exit $RETCODE

- name: Show debug info
if: ${{ failure() }}
Expand Down
2 changes: 1 addition & 1 deletion python/cppyy/_typemap.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,4 @@ def voidp_init(self, arg=0):
import cppyy, ctypes
if arg == cppyy.nullptr: arg = 0
ctypes.c_void_p.__init__(self, arg)
tm['void*'] = _create_mapper(ctypes.c_void_p, {'__init__' : voidp_init})
tm['void *'] = _create_mapper(ctypes.c_void_p, {'__init__' : voidp_init})
9 changes: 9 additions & 0 deletions test/support.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,12 @@ def setup_make(targetname):
#endif\n""") == 1)
IS_CLING = not IS_CLANG_REPL
IS_VALGRIND = True if os.getenv("IS_VALGRIND") else False

from pytest import mark

proxy = mark.xfail
def monkey_patch(*args, **kwargs):
if "run" in kwargs:
del kwargs["run"]

return proxy(*args, **kwargs)
4 changes: 3 additions & 1 deletion test/test_aclassloader.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import py, os, sys
from pytest import raises, mark
from .support import setup_make
from .support import setup_make, monkey_patch

mark.xfail = monkey_patch

currpath = py.path.local(__file__).dirpath()
test_dct = str(currpath.join("example01Dict"))
Expand Down
8 changes: 5 additions & 3 deletions test/test_advancedcpp.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import py, os, sys
from pytest import raises, skip, mark
from .support import setup_make, pylong, IS_WINDOWS, IS_MAC, IS_LINUX, ispypy, IS_CLANG_REPL, IS_MAC_ARM, IS_MAC_X86, IS_VALGRIND
from .support import setup_make, pylong, IS_WINDOWS, IS_MAC, IS_LINUX, ispypy, IS_CLANG_REPL, IS_MAC_ARM, IS_MAC_X86, IS_VALGRIND, IS_CLING, monkey_patch

mark.xfail = monkey_patch


currpath = py.path.local(__file__).dirpath()
test_dct = str(currpath.join("advancedcppDict"))
Expand Down Expand Up @@ -688,7 +691,7 @@ def test20_overload_order_with_proper_return(self):
assert cppyy.gbl.overload_one_way().gime() == 1
assert cppyy.gbl.overload_the_other_way().gime() == "aap"

@mark.xfail(run=not IS_VALGRIND, condition = (IS_CLANG_REPL or IS_LINUX), reason="Fails on both Cling and Clang-Repl, Valgrind issue on Clang-Repl")
@mark.xfail(run=not IS_VALGRIND, condition =(IS_LINUX and IS_CLING), reason="Fails on Linux Cling")
def test21_access_to_global_variables(self):
"""Access global_variables_and_pointers"""

Expand Down Expand Up @@ -842,7 +845,6 @@ def test26_using_directive(self):
assert cppyy.gbl.UserDirs.bar() == cppyy.gbl.UsedSpace2.bar()
assert cppyy.gbl.UserDirs.foo2() == cppyy.gbl.UsedSpace1.inner.foo2()

@mark.xfail(reason="See https://github.com/compiler-research/CppInterOp/pull/93")
def test27_shadowed_typedef(self):
"""Test that typedefs are not shadowed"""

Expand Down
4 changes: 3 additions & 1 deletion test/test_api.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import py, os, sys
from pytest import raises, skip, mark
from .support import ispypy, IS_MAC, IS_LINUX_ARM
from .support import ispypy, IS_MAC, IS_LINUX_ARM, monkey_patch

mark.xfail = monkey_patch


class TestAPI:
Expand Down
9 changes: 6 additions & 3 deletions test/test_boost.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import py, os, sys
from pytest import mark, raises, skip
from .support import setup_make, IS_CLANG_REPL, IS_MAC_X86, IS_MAC_ARM
from .support import setup_make, IS_CLANG_REPL, IS_MAC_X86, IS_MAC_ARM, monkey_patch

mark.xfail = monkey_patch


noboost = False
if not (os.path.exists(os.path.join(os.path.sep, 'usr', 'include', 'boost')) or \
Expand Down Expand Up @@ -28,7 +31,7 @@ def test01_any_class(self):

assert std.list[any]

@mark.skip
@mark.xfail(run=False)
def test02_any_usage(self):
"""boost::any assignment and casting"""

Expand Down Expand Up @@ -101,7 +104,7 @@ def setup_class(cls):
cppyy.include("boost/variant/variant.hpp")
cppyy.include("boost/variant/get.hpp")

@mark.skip
@mark.xfail(run=False)
def test01_variant_usage(self):
"""boost::variant usage"""

Expand Down
4 changes: 3 additions & 1 deletion test/test_concurrent.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import py, os, sys
from pytest import raises, skip, mark
from .support import IS_MAC_ARM, IS_MAC_X86, IS_LINUX_ARM
from .support import IS_MAC_ARM, IS_MAC_X86, IS_LINUX_ARM, monkey_patch

mark.xfail = monkey_patch


class TestCONCURRENT:
Expand Down
5 changes: 4 additions & 1 deletion test/test_conversions.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import py, os, sys
from pytest import raises, mark
from .support import setup_make, IS_LINUX, IS_CLANG_REPL, IS_CLING, IS_MAC
from .support import setup_make, IS_LINUX, IS_CLANG_REPL, IS_CLING, IS_MAC, monkey_patch

mark.xfail = monkey_patch


currpath = py.path.local(__file__).dirpath()
test_dct = str(currpath.join("conversionsDict"))
Expand Down
4 changes: 3 additions & 1 deletion test/test_cpp11features.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import py, os, sys
from pytest import raises, mark
from .support import setup_make, ispypy, IS_CLANG_REPL, IS_LINUX_ARM, IS_LINUX, IS_MAC, IS_CLING, IS_VALGRIND
from .support import setup_make, ispypy, IS_CLANG_REPL, IS_LINUX_ARM, IS_LINUX, IS_MAC, IS_CLING, IS_VALGRIND, monkey_patch

mark.xfail = monkey_patch


currpath = py.path.local(__file__).dirpath()
Expand Down
6 changes: 4 additions & 2 deletions test/test_crossinheritance.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import py, os, sys
from pytest import raises, skip, mark
from .support import setup_make, pylong, IS_MAC_ARM, IS_MAC, IS_CLANG_REPL, IS_CLANG_DEBUG, IS_LINUX_ARM, IS_LINUX, IS_CLING, IS_VALGRIND
from .support import setup_make, pylong, IS_MAC_ARM, IS_MAC, IS_CLANG_REPL, IS_CLANG_DEBUG, IS_LINUX_ARM, IS_LINUX, IS_CLING, IS_VALGRIND, monkey_patch

mark.xfail = monkey_patch


currpath = py.path.local(__file__).dirpath()
Expand Down Expand Up @@ -1720,7 +1722,7 @@ def __del__(self):
del o1
assert Derived.was_py_deleted == True

@mark.xfail
@mark.xfail(condition=IS_MAC, reason="Fails on OSX")
def test37_deep_tree(self):
"""Find overridable methods deep in the tree"""

Expand Down
10 changes: 4 additions & 6 deletions test/test_datatypes.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import py, os, sys
from pytest import raises, skip, mark
from .support import setup_make, pylong, pyunicode, IS_CLANG_REPL, IS_CLING, IS_MAC_X86, IS_MAC_ARM, IS_MAC, IS_LINUX
from .support import setup_make, pylong, pyunicode, IS_CLANG_REPL, IS_CLING, IS_MAC_X86, IS_MAC_ARM, IS_MAC, IS_LINUX, monkey_patch

mark.xfail = monkey_patch

IS_MAC = IS_MAC_X86 or IS_MAC_ARM

Expand Down Expand Up @@ -192,7 +194,6 @@ def test01_instance_data_read_access(self):

c.__destruct__()

@mark.xfail
def test02_instance_data_write_access(self):
"""Test write access to instance public data and verify values"""

Expand Down Expand Up @@ -1270,7 +1271,7 @@ def run(self, f, buf, total):
if self.has_byte:
run(self, cppyy.gbl.sum_byte_data, buf, total)

@mark.xfail(run=not(IS_MAC), reason="Crashes on OS X")
@mark.xfail(run=False, condition=IS_MAC, reason="Crashes on OSX")
def test26_function_pointers(self):
"""Function pointer passing"""

Expand Down Expand Up @@ -2224,7 +2225,6 @@ def test45_const_ref_data(self):
b = ns.B()
assert b.body1.name == b.body2.name

@mark.xfail
def test46_small_int_enums(self):
"""Proper typing of small int enums"""

Expand Down Expand Up @@ -2279,7 +2279,6 @@ def test46_small_int_enums(self):
assert ns.func_int8() == -1
assert ns.func_uint8() == 255

@mark.xfail
def test47_hidden_name_enum(self):
"""Usage of hidden name enum"""

Expand Down Expand Up @@ -2315,7 +2314,6 @@ def test47_hidden_name_enum(self):
}""")
#ns.bar(ns.Foo.FOO)

@mark.xfail
def test48_bool_typemap(self):
"""Test mapping of bool type typedefs"""

Expand Down
27 changes: 13 additions & 14 deletions test/test_doc_features.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import py, os, sys
from pytest import raises, skip, mark
from .support import setup_make, ispypy, IS_WINDOWS, IS_CLANG_REPL, IS_CLING, IS_CLANG_DEBUG, IS_MAC, IS_MAC_X86, IS_MAC_ARM, IS_LINUX_ARM
from .support import setup_make, ispypy, IS_WINDOWS, IS_CLANG_REPL, IS_CLING, IS_CLANG_DEBUG, IS_MAC, IS_MAC_X86, IS_MAC_ARM, IS_LINUX_ARM, IS_VALGRIND, monkey_patch

mark.xfail = monkey_patch


currpath = py.path.local(__file__).dirpath()
test_dct = str(currpath.join("doc_helperDict"))
Expand Down Expand Up @@ -131,7 +134,7 @@ class Abstract2 {

template<class A, class B, class C = A>
C multiply(A a, B b) {
return C{a*b};
return static_cast<C>(a * b);
}

//-----
Expand Down Expand Up @@ -249,12 +252,11 @@ def test_keyword_arguments(self):
c = Concrete(**kwds)
assert c.m_int == 18

@mark.xfail
def test_doc_strings(self):
import cppyy
from cppyy.gbl import Concrete
assert 'void Concrete::array_method(int* ad, int size)' in Concrete.array_method.__doc__
assert 'void Concrete::array_method(double* ad, int size)' in Concrete.array_method.__doc__
assert 'void Concrete::array_method(int * ad, int size)' in Concrete.array_method.__doc__
assert 'void Concrete::array_method(double * ad, int size)' in Concrete.array_method.__doc__

def test_enums(self):
import cppyy
Expand Down Expand Up @@ -661,7 +663,7 @@ def test07_run_zoo(self):
assert Zoo.identify_animal(mouse) == "the animal is a mouse"
assert Zoo.identify_animal(lion) == "the animal is a lion"

@mark.xfail
@mark.xfail(condition=IS_MAC, reason="Fails on OSX")
def test08_shared_ptr(self):
"""Shared pointer transparency"""

Expand All @@ -682,12 +684,11 @@ def test08_shared_ptr(self):
assert type(Zoo.free_lion).__name__ == 'Lion'

smart_lion = Zoo.free_lion.__smartptr__()
assert type(smart_lion).__name__ in ['shared_ptr<Zoo::Lion>', 'std::shared_ptr<Zoo::Lion>']
assert type(smart_lion).__name__ in ['shared_ptr<Zoo::Lion>', 'std::shared_ptr<Zoo::Lion>', 'shared_ptr<Lion>', 'std::shared_ptr<Lion>']

assert Zoo.identify_animal(Zoo.free_lion) == "the animal is a lion"
assert Zoo.identify_animal_smart(Zoo.free_lion) == "the animal is a lion"

@mark.xfail
def test09_templated_function(self):
"""Templated free function"""

Expand All @@ -698,9 +699,9 @@ def test09_templated_function(self):
assert 'multiply' in cppyy.gbl.__dict__

assert mul(1, 2) == 2
assert 'multiply<int,int,int>' in cppyy.gbl.__dict__
assert 'multiply<int, int, int>' in cppyy.gbl.__dict__
assert mul(1., 5) == 5.
assert 'multiply<double,int,double>' in cppyy.gbl.__dict__
assert 'multiply<double, int, double>' in cppyy.gbl.__dict__

assert mul[int] (1, 1) == 1
assert 'multiply<int>' in cppyy.gbl.__dict__
Expand All @@ -722,7 +723,7 @@ def test09_templated_function(self):

assert mul['double, double, double'](1., 5) == 5.

@mark.xfail
@mark.xfail(condition=IS_MAC, reason="Fails on OSX")
def test10_stl_algorithm(self):
"""STL algorithm on std::string"""

Expand Down Expand Up @@ -763,7 +764,6 @@ def pythonize_A(klass, name):
assert Advert01.A(1)
raises(TypeError, Advert01.A, 1.)

@mark.xfail
def test02_use_c_void_p(self):
"""Use of opaque handles and ctypes.c_void_p"""

Expand Down Expand Up @@ -798,7 +798,6 @@ def test02_use_c_void_p(self):
Advert02.Picam_OpenFirstCamera(cam)
assert Advert02.Picam_CloseCamera(cam)

@mark.xfail
def test03_use_of_ctypes_and_enum(self):
"""Use of (opaque) enum through ctypes.c_void_p"""

Expand Down Expand Up @@ -1193,7 +1192,7 @@ def f(val):
assert CC.callPtr(lambda i: 5*i, 4) == 20
assert CC.callFun(lambda i: 6*i, 4) == 24

@mark.xfail
@mark.xfail(run=False, condition=IS_VALGRIND and IS_LINUX_ARM, reason="Crashes on Valgrind-ARM")
def test_templated_callback(self):
"""Templated callback example"""

Expand Down
5 changes: 4 additions & 1 deletion test/test_eigen.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import py, os, sys
from pytest import mark, raises
from .support import setup_make, IS_CLANG_REPL, IS_CLING, IS_MAC_X86
from .support import setup_make, IS_CLANG_REPL, IS_CLING, IS_MAC_X86, monkey_patch

mark.xfail = monkey_patch


inc_paths = [os.path.join(os.path.sep, 'usr', 'include'),
os.path.join(os.path.sep, 'usr', 'local', 'include')]
Expand Down
Loading
Loading